[prev in list] [next in list] [prev in thread] [next in thread] 

List:       bochs-cvs
Subject:    [Bochs-cvs] CVS: bochs/cpu lazy_flags.cc,1.25,1.26 lazy_flags.h,1.17,1.18 mult16.cc,1.16,1.17 mult32
From:       Stanislav Shwartsman <sshwarts () users ! sourceforge ! net>
Date:       2004-08-31 19:44:01
Message-ID: E1C2EXx-0008Hv-Gt () sc8-pr-cvs1 ! sourceforge ! net
[Download RAW message or body]

Update of /cvsroot/bochs/bochs/cpu
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31726/cpu

Modified Files:
	lazy_flags.cc lazy_flags.h mult16.cc mult32.cc mult64.cc 
	mult8.cc 
Log Message:
Fix MUL/IMUL instructions flags handling 


Index: lazy_flags.cc
===================================================================
RCS file: /cvsroot/bochs/bochs/cpu/lazy_flags.cc,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- lazy_flags.cc	30 Aug 2004 21:47:24 -0000	1.25
+++ lazy_flags.cc	31 Aug 2004 19:43:58 -0000	1.26
@@ -227,21 +227,19 @@
               (64 - BX_CPU_THIS_PTR oszapc.op2_64)) & 0x01;
           break;
 #endif
-        case BX_INSTR_IMUL_AL:
+        case BX_INSTR_IMUL8:
           cf = ! ((BX_CPU_THIS_PTR oszapc.op1_8 < 0x80 &&
                    BX_CPU_THIS_PTR oszapc.op2_8 == 0) ||
                 ((BX_CPU_THIS_PTR oszapc.op1_8 & 0x80) && 
                   BX_CPU_THIS_PTR oszapc.op2_8 == 0xff));
           break;
         case BX_INSTR_IMUL16:
-        case BX_INSTR_IMUL_AX:
           cf = ! ((BX_CPU_THIS_PTR oszapc.op1_16 < 0x8000 &&
                    BX_CPU_THIS_PTR oszapc.op2_16 == 0) ||
                 ((BX_CPU_THIS_PTR oszapc.op1_16 & 0x8000) && 
                   BX_CPU_THIS_PTR oszapc.op2_16 == 0xffff));
           break;
         case BX_INSTR_IMUL32:
-        case BX_INSTR_IMUL_EAX:
           cf = ! ((BX_CPU_THIS_PTR oszapc.op1_32 < 0x80000000 &&
                    BX_CPU_THIS_PTR oszapc.op2_32 == 0) ||
                 ((BX_CPU_THIS_PTR oszapc.op1_32 & 0x80000000) && 
@@ -249,24 +247,23 @@
           break;
 #if BX_SUPPORT_X86_64
         case BX_INSTR_IMUL64:
-        case BX_INSTR_IMUL_RAX:
           cf = ! ((BX_CPU_THIS_PTR oszapc.op1_64 < BX_CONST64(0x8000000000000000) &&
                    BX_CPU_THIS_PTR oszapc.op2_64 == 0) ||
                 ((BX_CPU_THIS_PTR oszapc.op1_64 & BX_CONST64(0x8000000000000000)) && 
                   BX_CPU_THIS_PTR oszapc.op2_64 == BX_CONST64(0xffffffffffffffff)));
           break;
 #endif
-        case BX_INSTR_MUL_AL:
+        case BX_INSTR_MUL8:
           cf = (BX_CPU_THIS_PTR oszapc.op2_8 != 0);
           break;
-        case BX_INSTR_MUL_AX:
+        case BX_INSTR_MUL16:
           cf = (BX_CPU_THIS_PTR oszapc.op2_16 != 0);
           break;
-        case BX_INSTR_MUL_EAX:
+        case BX_INSTR_MUL32:
           cf = (BX_CPU_THIS_PTR oszapc.op2_32 != 0);
           break;
 #if BX_SUPPORT_X86_64
-        case BX_INSTR_MUL_RAX:
+        case BX_INSTR_MUL64:
           cf = (BX_CPU_THIS_PTR oszapc.op2_64 != 0);
           break;
 #endif
@@ -360,9 +357,8 @@
         case BX_INSTR_SAR64:
         case BX_INSTR_SHR64:
         case BX_INSTR_SHL64:
-        case BX_INSTR_IMUL_RAX:
         case BX_INSTR_IMUL64:
-        case BX_INSTR_MUL_RAX:
+        case BX_INSTR_MUL64:
 #endif
         case BX_INSTR_SAR8:
         case BX_INSTR_SAR16:
@@ -373,14 +369,12 @@
         case BX_INSTR_SHL8:
         case BX_INSTR_SHL16:
         case BX_INSTR_SHL32:
+        case BX_INSTR_IMUL8:
         case BX_INSTR_IMUL16:
         case BX_INSTR_IMUL32:
-        case BX_INSTR_IMUL_AL:
-        case BX_INSTR_IMUL_AX:
-        case BX_INSTR_IMUL_EAX:
-        case BX_INSTR_MUL_AL:
-        case BX_INSTR_MUL_AX:
-        case BX_INSTR_MUL_EAX:
+        case BX_INSTR_MUL8:
+        case BX_INSTR_MUL16:
+        case BX_INSTR_MUL32:
           af = 0;
           break;
         default:
@@ -496,36 +490,21 @@
           zf = (BX_CPU_THIS_PTR oszapc.result_64 == 0);
           break;
 #endif
-        case BX_INSTR_IMUL_AL:
-        case BX_INSTR_MUL_AL:
-          zf = (BX_CPU_THIS_PTR oszapc.op1_8 |
-                              BX_CPU_THIS_PTR oszapc.op2_8) == 0;
-          break;
-        case BX_INSTR_IMUL_AX:
-        case BX_INSTR_MUL_AX:
-          zf = (BX_CPU_THIS_PTR oszapc.op1_16 |
-                              BX_CPU_THIS_PTR oszapc.op2_16) == 0;
-          break;
-        case BX_INSTR_IMUL_EAX:
-        case BX_INSTR_MUL_EAX:
-          zf = (BX_CPU_THIS_PTR oszapc.op1_32 |
-                              BX_CPU_THIS_PTR oszapc.op2_32) == 0;
-          break;
-#if BX_SUPPORT_X86_64
-        case BX_INSTR_IMUL_RAX:
-        case BX_INSTR_MUL_RAX:
-          zf = (BX_CPU_THIS_PTR oszapc.op1_64 |
-                              BX_CPU_THIS_PTR oszapc.op2_64) == 0;
+        case BX_INSTR_IMUL8:
+        case BX_INSTR_MUL8:
+          zf = (BX_CPU_THIS_PTR oszapc.op1_8 == 0);
           break;
-#endif
         case BX_INSTR_IMUL16:
+        case BX_INSTR_MUL16:
           zf = (BX_CPU_THIS_PTR oszapc.op1_16 == 0);
           break;
         case BX_INSTR_IMUL32:
+        case BX_INSTR_MUL32:
           zf = (BX_CPU_THIS_PTR oszapc.op1_32 == 0);
           break;
 #if BX_SUPPORT_X86_64
         case BX_INSTR_IMUL64:
+        case BX_INSTR_MUL64:
           zf = (BX_CPU_THIS_PTR oszapc.op1_64 == 0);
           break;
 #endif
@@ -640,32 +619,21 @@
           sf = (BX_CPU_THIS_PTR oszapc.result_64 >= BX_CONST64(0x8000000000000000));
           break;
 #endif
-        case BX_INSTR_IMUL_AL:
-        case BX_INSTR_MUL_AL:
-          sf = (BX_CPU_THIS_PTR oszapc.op2_8 >= 0x80);
-          break;
-        case BX_INSTR_IMUL_AX:
-        case BX_INSTR_MUL_AX:
-          sf = (BX_CPU_THIS_PTR oszapc.op2_16 >= 0x8000);
-          break;
-        case BX_INSTR_IMUL_EAX:
-        case BX_INSTR_MUL_EAX:
-          sf = (BX_CPU_THIS_PTR oszapc.op2_32 >= 0x80000000);
-          break;
-#if BX_SUPPORT_X86_64
-        case BX_INSTR_IMUL_RAX:
-        case BX_INSTR_MUL_RAX:
-          sf = (BX_CPU_THIS_PTR oszapc.op2_64 >= BX_CONST64(0x8000000000000000));
+        case BX_INSTR_IMUL8:
+        case BX_INSTR_MUL8:
+          sf = (BX_CPU_THIS_PTR oszapc.op1_8 >= 0x80);
           break;
-#endif
         case BX_INSTR_IMUL16:
+        case BX_INSTR_MUL16:
           sf = (BX_CPU_THIS_PTR oszapc.op1_16 >= 0x8000);
           break;
         case BX_INSTR_IMUL32:
+        case BX_INSTR_MUL32:
           sf = (BX_CPU_THIS_PTR oszapc.op1_32 >= 0x80000000);
           break;
 #if BX_SUPPORT_X86_64
         case BX_INSTR_IMUL64:
+        case BX_INSTR_MUL64:
           sf = (BX_CPU_THIS_PTR oszapc.op1_64 >= BX_CONST64(0x8000000000000000));
           break;
 #endif
@@ -883,21 +851,19 @@
                       BX_CPU_THIS_PTR oszapc.result_64) & BX_CONST64(0x8000000000000000)) > 0;
           break;
 #endif
-        case BX_INSTR_IMUL_AL:
+        case BX_INSTR_IMUL8:
           of = ! ((BX_CPU_THIS_PTR oszapc.op1_8 < 0x80 &&
                    BX_CPU_THIS_PTR oszapc.op2_8 == 0) ||
                 ((BX_CPU_THIS_PTR oszapc.op1_8 & 0x80) && 
                   BX_CPU_THIS_PTR oszapc.op2_8 == 0xff));
           break;
         case BX_INSTR_IMUL16:
-        case BX_INSTR_IMUL_AX:
           of = ! ((BX_CPU_THIS_PTR oszapc.op1_16 < 0x8000 &&
                    BX_CPU_THIS_PTR oszapc.op2_16 == 0) ||
                 ((BX_CPU_THIS_PTR oszapc.op1_16 & 0x8000) && 
                   BX_CPU_THIS_PTR oszapc.op2_16 == 0xffff));
           break;
         case BX_INSTR_IMUL32:
-        case BX_INSTR_IMUL_EAX:
           of = ! ((BX_CPU_THIS_PTR oszapc.op1_32 < 0x80000000 &&
                    BX_CPU_THIS_PTR oszapc.op2_32 == 0) ||
                 ((BX_CPU_THIS_PTR oszapc.op1_32 & 0x80000000) && 
@@ -905,24 +871,23 @@
           break;
 #if BX_SUPPORT_X86_64
         case BX_INSTR_IMUL64:
-        case BX_INSTR_IMUL_RAX:
           of = ! ((BX_CPU_THIS_PTR oszapc.op1_64 < BX_CONST64(0x8000000000000000) &&
                    BX_CPU_THIS_PTR oszapc.op2_64 == 0) ||
                 ((BX_CPU_THIS_PTR oszapc.op1_64 & BX_CONST64(0x8000000000000000)) && 
                   BX_CPU_THIS_PTR oszapc.op2_64 == BX_CONST64(0xffffffffffffffff)));
           break;
 #endif
-        case BX_INSTR_MUL_AL:
+        case BX_INSTR_MUL8:
           of = (BX_CPU_THIS_PTR oszapc.op2_8 != 0);
           break;
-        case BX_INSTR_MUL_AX:
+        case BX_INSTR_MUL16:
           of = (BX_CPU_THIS_PTR oszapc.op2_16 != 0);
           break;
-        case BX_INSTR_MUL_EAX:
+        case BX_INSTR_MUL32:
           of = (BX_CPU_THIS_PTR oszapc.op2_32 != 0);
           break;
 #if BX_SUPPORT_X86_64
-        case BX_INSTR_MUL_RAX:
+        case BX_INSTR_MUL64:
           of = (BX_CPU_THIS_PTR oszapc.op2_64 != 0);
           break;
 #endif
@@ -1040,24 +1005,21 @@
           pf = bx_parity_lookup[(Bit8u) BX_CPU_THIS_PTR oszapc.result_64];
           break;
 #endif
-        case BX_INSTR_IMUL_AL:
-        case BX_INSTR_MUL_AL:
+        case BX_INSTR_IMUL8:
+        case BX_INSTR_MUL8:
           pf = bx_parity_lookup[BX_CPU_THIS_PTR oszapc.op1_8];
           break;
-        case BX_INSTR_IMUL_AX:
         case BX_INSTR_IMUL16:
-        case BX_INSTR_MUL_AX:
+        case BX_INSTR_MUL16:
           pf = bx_parity_lookup[(Bit8u) BX_CPU_THIS_PTR oszapc.op1_16];
           break;
-        case BX_INSTR_IMUL_EAX:
         case BX_INSTR_IMUL32:
-        case BX_INSTR_MUL_EAX:
+        case BX_INSTR_MUL32:
           pf = bx_parity_lookup[(Bit8u) BX_CPU_THIS_PTR oszapc.op1_32];
           break;
 #if BX_SUPPORT_X86_64
-        case BX_INSTR_IMUL_RAX:
         case BX_INSTR_IMUL64:
-        case BX_INSTR_MUL_RAX:
+        case BX_INSTR_MUL64:
           pf = bx_parity_lookup[(Bit8u) BX_CPU_THIS_PTR oszapc.op1_64];
           break;
 #endif

Index: lazy_flags.h
===================================================================
RCS file: /cvsroot/bochs/bochs/cpu/lazy_flags.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- lazy_flags.h	30 Aug 2004 21:47:24 -0000	1.17
+++ lazy_flags.h	31 Aug 2004 19:43:58 -0000	1.18
@@ -94,20 +94,15 @@
 #define BX_INSTR_SAR32          51
 #define BX_INSTR_SAR64          52
 
-#define BX_INSTR_MUL_AL         53
-#define BX_INSTR_MUL_AX         54
-#define BX_INSTR_MUL_EAX        55
-#define BX_INSTR_MUL_RAX        56
-
-#define BX_INSTR_IMUL_AL        57
-#define BX_INSTR_IMUL_AX        58
-#define BX_INSTR_IMUL_EAX       59
-#define BX_INSTR_IMUL_RAX       60
+#define BX_INSTR_MUL8           53
+#define BX_INSTR_MUL16          54
+#define BX_INSTR_MUL32          55
+#define BX_INSTR_MUL64          56
 
-//      BX_INSTR_IMUL8          not exists, leave number for alignment
-#define BX_INSTR_IMUL16         62
-#define BX_INSTR_IMUL32         63
-#define BX_INSTR_IMUL64         64
+#define BX_INSTR_IMUL8          57
+#define BX_INSTR_IMUL16         58
+#define BX_INSTR_IMUL32         59
+#define BX_INSTR_IMUL64         60
 
 
 #define BX_LF_INDEX_OSZAPC  1

Index: mult16.cc
===================================================================
RCS file: /cvsroot/bochs/bochs/cpu/mult16.cc,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- mult16.cc	30 Aug 2004 21:47:24 -0000	1.16
+++ mult16.cc	31 Aug 2004 19:43:58 -0000	1.17
@@ -51,7 +51,7 @@
     Bit16u product_16h =  product_32 >> 16;
 
     /* set EFLAGS */
-    SET_FLAGS_OSZAPC_S1S2_16(product_16l, product_16h, BX_INSTR_MUL_AX);
+    SET_FLAGS_OSZAPC_S1S2_16(product_16l, product_16h, BX_INSTR_MUL16);
 
     /* now write product back to destination */
     AX = product_16l;
@@ -86,7 +86,7 @@
      * IMUL r/m16: condition for clearing CF & OF:
      *   DX:AX = sign-extend of AX
      */
-    SET_FLAGS_OSZAPC_S1S2_16(product_16l, product_16h, BX_INSTR_IMUL_AX);
+    SET_FLAGS_OSZAPC_S1S2_16(product_16l, product_16h, BX_INSTR_IMUL16);
 }
 
   void

Index: mult32.cc
===================================================================
RCS file: /cvsroot/bochs/bochs/cpu/mult32.cc,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- mult32.cc	30 Aug 2004 21:47:24 -0000	1.16
+++ mult32.cc	31 Aug 2004 19:43:58 -0000	1.17
@@ -59,7 +59,7 @@
     product_32h = (Bit32u) (product_64 >> 32);
 
     /* set EFLAGS */
-    SET_FLAGS_OSZAPC_S1S2_32(product_32l, product_32h, BX_INSTR_MUL_EAX);
+    SET_FLAGS_OSZAPC_S1S2_32(product_32l, product_32h, BX_INSTR_MUL32);
 
     /* now write product back to destination */
     RAX = product_32l;
@@ -94,7 +94,7 @@
      * IMUL r/m32: condition for clearing CF & OF:
      *   EDX:EAX = sign-extend of EAX
      */
-    SET_FLAGS_OSZAPC_S1S2_32(product_32l, product_32h, BX_INSTR_IMUL_EAX);
+    SET_FLAGS_OSZAPC_S1S2_32(product_32l, product_32h, BX_INSTR_IMUL32);
 }
 
   void

Index: mult64.cc
===================================================================
RCS file: /cvsroot/bochs/bochs/cpu/mult64.cc,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- mult64.cc	30 Aug 2004 21:47:24 -0000	1.13
+++ mult64.cc	31 Aug 2004 19:43:58 -0000	1.14
@@ -229,7 +229,7 @@
     long_mul(&product_128,op1_64,op2_64);
 
     /* set EFLAGS */
-    SET_FLAGS_OSZAPC_S1S2_64(product_128.lo, product_128.hi, BX_INSTR_MUL_RAX);
+    SET_FLAGS_OSZAPC_S1S2_64(product_128.lo, product_128.hi, BX_INSTR_MUL64);
 
     /* now write product back to destination */
     RAX = product_128.lo;
@@ -267,7 +267,7 @@
      * IMUL r/m64: condition for clearing CF & OF:
      *   RDX:RAX = sign-extend of RAX
      */
-    SET_FLAGS_OSZAPC_S1S2_64(product_128.lo, product_128.hi, BX_INSTR_IMUL_RAX);
+    SET_FLAGS_OSZAPC_S1S2_64(product_128.lo, product_128.hi, BX_INSTR_IMUL64);
 }
 
   void

Index: mult8.cc
===================================================================
RCS file: /cvsroot/bochs/bochs/cpu/mult8.cc,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- mult8.cc	30 Aug 2004 21:47:24 -0000	1.16
+++ mult8.cc	31 Aug 2004 19:43:58 -0000	1.17
@@ -52,7 +52,7 @@
   Bit8u product_8h =  product_16 >> 8;
 
   /* set EFLAGS */
-  SET_FLAGS_OSZAPC_S1S2_8(product_8l, product_8h, BX_INSTR_MUL_AL);
+  SET_FLAGS_OSZAPC_S1S2_8(product_8l, product_8h, BX_INSTR_MUL8);
 
   /* now write product back to destination */
   AX = product_16;
@@ -81,9 +81,9 @@
 
   /* set EFLAGS:
    * IMUL r/m8: condition for clearing CF & OF:
-   *   AL = sign-extend of AL to 16 bits
+   *   AX = sign-extend of AL to 16 bits
    */
-  SET_FLAGS_OSZAPC_S1S2_8(product_8l, product_8h, BX_INSTR_IMUL_AL);
+  SET_FLAGS_OSZAPC_S1S2_8(product_8l, product_8h, BX_INSTR_IMUL8);
 
   /* now write product back to destination */
   AX = product_16;



-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
_______________________________________________
Bochs-cvs mailing list
Bochs-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bochs-cvs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic