[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 1/3] x86emul: use DstEax also for {, I}{MUL, DIV}



Just like said in commit c0bc0adf24 ("x86emul: use DstEax where
possible"): While it avoids just a few instructions, we should
nevertheless make use of generic code as much as possible.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -1738,7 +1738,7 @@ x86_emulate(
                 case 5: /* imul */
                 case 6: /* div */
                 case 7: /* idiv */
-                    d = (d & (ByteOp | ModRM)) | DstImplicit | SrcMem;
+                    d = (d & (ByteOp | ModRM)) | DstEax | SrcMem;
                     break;
                 }
                 break;
@@ -3554,11 +3554,8 @@ x86_emulate(
             emulate_1op("neg", dst, _regs.eflags);
             break;
         case 4: /* mul */
-            dst.type = OP_REG;
-            dst.reg  = (unsigned long *)&_regs.eax;
-            dst.val  = *dst.reg;
             _regs.eflags &= ~(EFLG_OF|EFLG_CF);
-            switch ( dst.bytes = src.bytes )
+            switch ( dst.bytes )
             {
             case 1:
                 dst.val = (uint8_t)dst.val;
@@ -3594,10 +3591,6 @@ x86_emulate(
             }
             break;
         case 5: /* imul */
-            dst.type = OP_REG;
-            dst.reg  = (unsigned long *)&_regs.eax;
-            dst.val  = *dst.reg;
-            dst.bytes = src.bytes;
         imul:
             _regs.eflags &= ~(EFLG_OF|EFLG_CF);
             switch ( dst.bytes )
@@ -3639,9 +3632,7 @@ x86_emulate(
             }
             break;
         case 6: /* div */
-            dst.type = OP_REG;
-            dst.reg  = (unsigned long *)&_regs.eax;
-            switch ( dst.bytes = src.bytes )
+            switch ( src.bytes )
             {
             case 1:
                 u[0] = (uint16_t)_regs.eax;
@@ -3686,9 +3677,7 @@ x86_emulate(
             }
             break;
         case 7: /* idiv */
-            dst.type = OP_REG;
-            dst.reg  = (unsigned long *)&_regs.eax;
-            switch ( dst.bytes = src.bytes )
+            switch ( src.bytes )
             {
             case 1:
                 u[0] = (int16_t)_regs.eax;



Attachment: x86emul-use-DstEax-mul-div.patch
Description: Text document

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.