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

[Xen-changelog] [xen-unstable] vmx realmode: Fix emulation of exception delivery (stack pointer must



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1196095630 0
# Node ID 11bfa26dd1250a90e00f8537d060433e911bcd3b
# Parent  c5332fa8b68da2a524932ec37941a2f04acd4588
vmx realmode: Fix emulation of exception delivery (stack pointer must
be adjusted for FLAGS push), and fix up vmx_realmode() exit protocol
now that it is called from asm stub context.
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/arch/x86/hvm/vmx/realmode.c   |   16 +++++-----------
 xen/include/asm-x86/hvm/vmx/vmx.h |    2 +-
 2 files changed, 6 insertions(+), 12 deletions(-)

diff -r c5332fa8b68d -r 11bfa26dd125 xen/arch/x86/hvm/vmx/realmode.c
--- a/xen/arch/x86/hvm/vmx/realmode.c   Mon Nov 26 16:46:22 2007 +0000
+++ b/xen/arch/x86/hvm/vmx/realmode.c   Mon Nov 26 16:47:10 2007 +0000
@@ -88,12 +88,12 @@ static void realmode_deliver_exception(
 
     if ( rm_ctxt->ctxt.addr_size == 32 )
     {
-        regs->esp -= 4;
+        regs->esp -= 6;
         pstk = regs->esp;
     }
     else
     {
-        pstk = (uint16_t)(regs->esp - 4);
+        pstk = (uint16_t)(regs->esp - 6);
         regs->esp &= ~0xffff;
         regs->esp |= pstk;
     }
@@ -419,12 +419,12 @@ static struct x86_emulate_ops realmode_e
     .inject_sw_interrupt = realmode_inject_sw_interrupt
 };
 
-int vmx_realmode(struct cpu_user_regs *regs)
+void vmx_realmode(struct cpu_user_regs *regs)
 {
     struct vcpu *curr = current;
     struct realmode_emulate_ctxt rm_ctxt;
     unsigned long intr_info;
-    int i, rc = 0;
+    int i, rc;
     u32 intr_shadow, new_intr_shadow;
 
     rm_ctxt.ctxt.regs = regs;
@@ -487,10 +487,7 @@ int vmx_realmode(struct cpu_user_regs *r
             hvm_hlt(regs->eflags);
 
         if ( curr->arch.hvm_vmx.real_mode_io_in_progress )
-        {
-            rc = 0;
             break;
-        }
 
         if ( rc == X86EMUL_UNHANDLEABLE )
         {
@@ -501,15 +498,12 @@ int vmx_realmode(struct cpu_user_regs *r
                      rm_ctxt.insn_buf[2], rm_ctxt.insn_buf[3],
                      rm_ctxt.insn_buf[4], rm_ctxt.insn_buf[5]);
             gdprintk(XENLOG_ERR, "Emulation failed\n");
-            rc = -EINVAL;
-            break;
+            domain_crash_synchronous();
         }
     }
 
     for ( i = 0; i < 10; i++ )
         hvm_set_segment_register(curr, i, &rm_ctxt.seg_reg[i]);
-
-    return rc;
 }
 
 int vmx_realmode_io_complete(void)
diff -r c5332fa8b68d -r 11bfa26dd125 xen/include/asm-x86/hvm/vmx/vmx.h
--- a/xen/include/asm-x86/hvm/vmx/vmx.h Mon Nov 26 16:46:22 2007 +0000
+++ b/xen/include/asm-x86/hvm/vmx/vmx.h Mon Nov 26 16:47:10 2007 +0000
@@ -37,7 +37,7 @@ void vmx_cpuid_intercept(
     unsigned int *eax, unsigned int *ebx,
     unsigned int *ecx, unsigned int *edx);
 void vmx_wbinvd_intercept(void);
-int vmx_realmode(struct cpu_user_regs *regs);
+void vmx_realmode(struct cpu_user_regs *regs);
 int vmx_realmode_io_complete(void);
 
 /*

_______________________________________________
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®.