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

[Xen-changelog] [xen-unstable] hvm emulate: Correctly probe when we are in 64-bit mode and set



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1204557579 0
# Node ID 7530c4dba8a5d8970d23f502369a342ee82a6541
# Parent  d0daf11fb35dab676e5e4ef9b1c02da649e4f9af
hvm emulate: Correctly probe when we are in 64-bit mode and set
address-size default appropriately.
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/arch/x86/hvm/emulate.c      |   21 +++++++++++++++------
 xen/arch/x86/mm/shadow/common.c |    4 ----
 2 files changed, 15 insertions(+), 10 deletions(-)

diff -r d0daf11fb35d -r 7530c4dba8a5 xen/arch/x86/hvm/emulate.c
--- a/xen/arch/x86/hvm/emulate.c        Mon Mar 03 13:54:05 2008 +0000
+++ b/xen/arch/x86/hvm/emulate.c        Mon Mar 03 15:19:39 2008 +0000
@@ -673,14 +673,23 @@ int hvm_emulate_one(
     struct hvm_emulate_ctxt *hvmemul_ctxt)
 {
     struct cpu_user_regs *regs = hvmemul_ctxt->ctxt.regs;
+    struct vcpu *curr = current;
     uint32_t new_intr_shadow;
     unsigned long addr;
     int rc;
 
-    hvmemul_ctxt->ctxt.addr_size =
-        hvmemul_ctxt->seg_reg[x86_seg_cs].attr.fields.db ? 32 : 16;
-    hvmemul_ctxt->ctxt.sp_size =
-        hvmemul_ctxt->seg_reg[x86_seg_ss].attr.fields.db ? 32 : 16;
+    if ( hvm_long_mode_enabled(curr) &&
+         hvmemul_ctxt->seg_reg[x86_seg_cs].attr.fields.l )
+    {
+        hvmemul_ctxt->ctxt.addr_size = hvmemul_ctxt->ctxt.sp_size = 64;
+    }
+    else
+    {
+        hvmemul_ctxt->ctxt.addr_size =
+            hvmemul_ctxt->seg_reg[x86_seg_cs].attr.fields.db ? 32 : 16;
+        hvmemul_ctxt->ctxt.sp_size =
+            hvmemul_ctxt->seg_reg[x86_seg_ss].attr.fields.db ? 32 : 16;
+    }
 
     hvmemul_ctxt->insn_buf_eip = regs->eip;
     hvmemul_ctxt->insn_buf_bytes =
@@ -715,11 +724,11 @@ int hvm_emulate_one(
     if ( hvmemul_ctxt->intr_shadow != new_intr_shadow )
     {
         hvmemul_ctxt->intr_shadow = new_intr_shadow;
-        hvm_funcs.set_interrupt_shadow(current, new_intr_shadow);
+        hvm_funcs.set_interrupt_shadow(curr, new_intr_shadow);
     }
 
     if ( hvmemul_ctxt->ctxt.retire.flags.hlt &&
-         !hvm_local_events_need_delivery(current) )
+         !hvm_local_events_need_delivery(curr) )
     {
         hvm_hlt(regs->eflags);
     }
diff -r d0daf11fb35d -r 7530c4dba8a5 xen/arch/x86/mm/shadow/common.c
--- a/xen/arch/x86/mm/shadow/common.c   Mon Mar 03 13:54:05 2008 +0000
+++ b/xen/arch/x86/mm/shadow/common.c   Mon Mar 03 15:19:39 2008 +0000
@@ -401,10 +401,6 @@ struct x86_emulate_ops *shadow_init_emul
     if ( hvm_long_mode_enabled(v) && creg->attr.fields.l )
     {
         sh_ctxt->ctxt.addr_size = sh_ctxt->ctxt.sp_size = 64;
-    }
-    else if ( regs->eflags & X86_EFLAGS_VM )
-    {
-        sh_ctxt->ctxt.addr_size = sh_ctxt->ctxt.sp_size = 16;
     }
     else
     {

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