direct-io.hg

changeset 13382:ef23a0150abb

[HVM] Fix calculation of address size in long mode.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Mon Jan 15 15:58:51 2007 +0000 (2007-01-15)
parents 0ba81aa56455
children ba18aa8b9315
files xen/arch/x86/hvm/svm/svm.c xen/arch/x86/hvm/vmx/vmx.c xen/arch/x86/mm/shadow/common.c
line diff
     1.1 --- a/xen/arch/x86/hvm/svm/svm.c	Mon Jan 15 15:43:20 2007 +0000
     1.2 +++ b/xen/arch/x86/hvm/svm/svm.c	Mon Jan 15 15:58:51 2007 +0000
     1.3 @@ -482,8 +482,8 @@ static int svm_guest_x86_mode(struct vcp
     1.4  {
     1.5      struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
     1.6  
     1.7 -    if ( vmcb->efer & EFER_LMA )
     1.8 -        return (vmcb->cs.attr.fields.l ? 8 : 4);
     1.9 +    if ( (vmcb->efer & EFER_LMA) && vmcb->cs.attr.fields.l )
    1.10 +        return 8;
    1.11  
    1.12      if ( svm_realmode(v) )
    1.13          return 2;
     2.1 --- a/xen/arch/x86/hvm/vmx/vmx.c	Mon Jan 15 15:43:20 2007 +0000
     2.2 +++ b/xen/arch/x86/hvm/vmx/vmx.c	Mon Jan 15 15:58:51 2007 +0000
     2.3 @@ -491,8 +491,7 @@ static unsigned long vmx_get_segment_bas
     2.4      ASSERT(v == current);
     2.5  
     2.6  #ifdef __x86_64__
     2.7 -    if ( vmx_long_mode_enabled(v) &&
     2.8 -         (__vmread(GUEST_CS_AR_BYTES) & (1u<<13)) )
     2.9 +    if ( vmx_long_mode_enabled(v) && (__vmread(GUEST_CS_AR_BYTES) & (1u<<13)) )
    2.10          long_mode = 1;
    2.11  #endif
    2.12  
    2.13 @@ -667,8 +666,8 @@ static int vmx_guest_x86_mode(struct vcp
    2.14  
    2.15      cs_ar_bytes = __vmread(GUEST_CS_AR_BYTES);
    2.16  
    2.17 -    if ( vmx_long_mode_enabled(v) )
    2.18 -        return ((cs_ar_bytes & (1u<<13)) ? 8 : 4);
    2.19 +    if ( vmx_long_mode_enabled(v) && (cs_ar_bytes & (1u<<13)) )
    2.20 +        return 8;
    2.21  
    2.22      if ( vmx_realmode(v) )
    2.23          return 2;
     3.1 --- a/xen/arch/x86/mm/shadow/common.c	Mon Jan 15 15:43:20 2007 +0000
     3.2 +++ b/xen/arch/x86/mm/shadow/common.c	Mon Jan 15 15:58:51 2007 +0000
     3.3 @@ -416,14 +416,9 @@ struct x86_emulate_ops *shadow_init_emul
     3.4      creg = hvm_get_seg_reg(x86_seg_cs, sh_ctxt);
     3.5  
     3.6      /* Work out the emulation mode. */
     3.7 -    if ( hvm_long_mode_enabled(v) )
     3.8 +    if ( hvm_long_mode_enabled(v) && creg->attr.fields.l )
     3.9      {
    3.10 -        sh_ctxt->ctxt.addr_size = creg->attr.fields.l ? 64 : 32;
    3.11 -        if ( (sh_ctxt->ctxt.sp_size = sh_ctxt->ctxt.addr_size) != 64 )
    3.12 -        {
    3.13 -            sreg = hvm_get_seg_reg(x86_seg_ss, sh_ctxt);
    3.14 -            sh_ctxt->ctxt.sp_size = sreg->attr.fields.db ? 32 : 16;
    3.15 -        }
    3.16 +        sh_ctxt->ctxt.addr_size = sh_ctxt->ctxt.sp_size = 64;
    3.17      }
    3.18      else if ( regs->eflags & X86_EFLAGS_VM )
    3.19      {