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

[Xen-changelog] [xen-unstable] [HVM] Fix calculation of address size in long mode.



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1168876731 0
# Node ID ef23a0150abbfac85bf1c51d50c6acad1dd9f300
# Parent  0ba81aa56455be37c2d5c19920f3633ad267604c
[HVM] Fix calculation of address size in long mode.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/arch/x86/hvm/svm/svm.c      |    4 ++--
 xen/arch/x86/hvm/vmx/vmx.c      |    7 +++----
 xen/arch/x86/mm/shadow/common.c |   11 +++--------
 3 files changed, 8 insertions(+), 14 deletions(-)

diff -r 0ba81aa56455 -r ef23a0150abb xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c        Mon Jan 15 15:43:20 2007 +0000
+++ b/xen/arch/x86/hvm/svm/svm.c        Mon Jan 15 15:58:51 2007 +0000
@@ -482,8 +482,8 @@ static int svm_guest_x86_mode(struct vcp
 {
     struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
 
-    if ( vmcb->efer & EFER_LMA )
-        return (vmcb->cs.attr.fields.l ? 8 : 4);
+    if ( (vmcb->efer & EFER_LMA) && vmcb->cs.attr.fields.l )
+        return 8;
 
     if ( svm_realmode(v) )
         return 2;
diff -r 0ba81aa56455 -r ef23a0150abb xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c        Mon Jan 15 15:43:20 2007 +0000
+++ b/xen/arch/x86/hvm/vmx/vmx.c        Mon Jan 15 15:58:51 2007 +0000
@@ -491,8 +491,7 @@ static unsigned long vmx_get_segment_bas
     ASSERT(v == current);
 
 #ifdef __x86_64__
-    if ( vmx_long_mode_enabled(v) &&
-         (__vmread(GUEST_CS_AR_BYTES) & (1u<<13)) )
+    if ( vmx_long_mode_enabled(v) && (__vmread(GUEST_CS_AR_BYTES) & (1u<<13)) )
         long_mode = 1;
 #endif
 
@@ -667,8 +666,8 @@ static int vmx_guest_x86_mode(struct vcp
 
     cs_ar_bytes = __vmread(GUEST_CS_AR_BYTES);
 
-    if ( vmx_long_mode_enabled(v) )
-        return ((cs_ar_bytes & (1u<<13)) ? 8 : 4);
+    if ( vmx_long_mode_enabled(v) && (cs_ar_bytes & (1u<<13)) )
+        return 8;
 
     if ( vmx_realmode(v) )
         return 2;
diff -r 0ba81aa56455 -r ef23a0150abb xen/arch/x86/mm/shadow/common.c
--- a/xen/arch/x86/mm/shadow/common.c   Mon Jan 15 15:43:20 2007 +0000
+++ b/xen/arch/x86/mm/shadow/common.c   Mon Jan 15 15:58:51 2007 +0000
@@ -416,14 +416,9 @@ struct x86_emulate_ops *shadow_init_emul
     creg = hvm_get_seg_reg(x86_seg_cs, sh_ctxt);
 
     /* Work out the emulation mode. */
-    if ( hvm_long_mode_enabled(v) )
-    {
-        sh_ctxt->ctxt.addr_size = creg->attr.fields.l ? 64 : 32;
-        if ( (sh_ctxt->ctxt.sp_size = sh_ctxt->ctxt.addr_size) != 64 )
-        {
-            sreg = hvm_get_seg_reg(x86_seg_ss, sh_ctxt);
-            sh_ctxt->ctxt.sp_size = sreg->attr.fields.db ? 32 : 16;
-        }
+    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 )
     {

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