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

[Xen-changelog] [xen-unstable] [XEN] Fix shadow2 issues with HVM guests.



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Node ID 1ff4cc298bec6c4fc2a21315f25092ebf3b47117
# Parent  58a3a78492169db0e2bd608aaa586242fdd413da
[XEN] Fix shadow2 issues with HVM guests.

This supercedes 11243:51a98a6c2c054bfc37c90a5a3f29929f2347bda8
which was incorrect because the data operand type codes in
the opcode table are not correct for some special cases: one
of these happens to be PUSH, which is the instruction we
particularly need to fix!

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/arch/x86/x86_emulate.c |   30 ++++++++++++++----------------
 1 files changed, 14 insertions(+), 16 deletions(-)

diff -r 58a3a7849216 -r 1ff4cc298bec xen/arch/x86/x86_emulate.c
--- a/xen/arch/x86/x86_emulate.c        Wed Aug 23 23:12:56 2006 +0100
+++ b/xen/arch/x86/x86_emulate.c        Thu Aug 24 09:49:41 2006 +0100
@@ -632,14 +632,6 @@ x86_emulate_memop(
         }
         break;
     case DstMem:
-        /*
-         * We expect that the fault occurred while accessing the explicit
-         * destination memory operand. This is clearly not the case if the
-         * fault occurred on a read access (eg. POP has an *implicit* operand
-         * but we expect that the guest never uses special memory as stack).
-         */
-        if ( !(_regs.error_code & PFEC_write_access) )
-            goto cannot_emulate;
         dst.type  = OP_MEM;
         dst.ptr   = (unsigned long *)cr2;
         dst.bytes = (d & ByteOp) ? 1 : op_bytes;
@@ -684,14 +676,6 @@ x86_emulate_memop(
     case SrcMem:
         src.bytes = (d & ByteOp) ? 1 : op_bytes;
     srcmem_common:
-        /*
-         * We expect that the fault occurred while accessing the explicit
-         * source memory operand. This is clearly not the case if the fault
-         * occurred on a write access (eg. PUSH has an *implicit* operand
-         * but we expect that the guest never uses special memory as stack).
-         */
-        if ( _regs.error_code & PFEC_write_access )
-            goto cannot_emulate;
         src.type  = OP_MEM;
         src.ptr   = (unsigned long *)cr2;
         if ( (rc = ops->read_emulated((unsigned long)src.ptr, 
@@ -797,6 +781,13 @@ x86_emulate_memop(
         dst.val = src.val;
         break;
     case 0x8f: /* pop (sole member of Grp1a) */
+        /*
+         * If the faulting access was a read it means that the fault occurred
+         * when accessing the implicit stack operand. We assume the guest never
+         * uses special memory areas as stack space.
+         */
+        if ( !(_regs.error_code & PFEC_write_access) )
+            goto cannot_emulate; /* fault on stack access: bail */
         /* 64-bit mode: POP always pops a 64-bit operand. */
         if ( mode == X86EMUL_MODE_PROT64 )
             dst.bytes = 8;
@@ -874,6 +865,13 @@ x86_emulate_memop(
             emulate_1op("dec", dst, _regs.eflags);
             break;
         case 6: /* push */
+            /*
+             * If the faulting access was a write it means that the fault
+             * occurred when accessing the implicit stack operand. We assume
+             * the guest never uses special memory areas as stack space.
+             */
+            if ( _regs.error_code & PFEC_write_access )
+                goto cannot_emulate; /* fault on stack access: bail */
             /* 64-bit mode: PUSH always pushes a 64-bit operand. */
             if ( mode == X86EMUL_MODE_PROT64 )
             {

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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