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

[Xen-changelog] [xen master] x86emul: use DstEax also for {, I}{MUL, DIV}



commit a3db233edec1a253f8f47ebf1b89c0a309ef1e39
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Wed Aug 17 15:32:51 2016 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Aug 17 15:32:51 2016 +0200

    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>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c 
b/xen/arch/x86/x86_emulate/x86_emulate.c
index 940227c..dbabe96 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -1735,7 +1735,11 @@ x86_emulate(
                 case 5: /* imul */
                 case 6: /* div */
                 case 7: /* idiv */
-                    d = (d & (ByteOp | ModRM)) | DstImplicit | SrcMem;
+                    /*
+                     * DstEax isn't really precise for all cases; updates to
+                     * rDX get handled in an open coded manner.
+                     */
+                    d = (d & (ByteOp | ModRM)) | DstEax | SrcMem;
                     break;
                 }
                 break;
@@ -3544,11 +3548,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;
@@ -3584,10 +3585,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 )
@@ -3629,9 +3626,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;
@@ -3676,9 +3671,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;
--
generated by git-patchbot for /home/xen/git/xen.git#master

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

 


Rackspace

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