mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
[HVM] Fix calculation of address size in long mode.
Signed-off-by: Keir Fraser <keir@xensource.com>
This commit is contained in:
1 parent
12d473893b
commit
6127793b4c
3 files changed
+7
-13
No files matched your search
@@ -482,8 +482,8 @@ static int svm_guest_x86_mode(struct vcpu *v)
|
||||
{
|
||||
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;
|
||||
|
||||
@@ -491,8 +491,7 @@ static unsigned long vmx_get_segment_base(struct vcpu *v, enum x86_segment seg)
|
||||
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 vcpu *v)
|
||||
|
||||
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;
|
||||
|
||||
@@ -416,14 +416,9 @@ struct x86_emulate_ops *shadow_init_emulation(
|
||||
creg = hvm_get_seg_reg(x86_seg_cs, sh_ctxt);
|
||||
|
||||
/* Work out the emulation mode. */
|
||||
if ( hvm_long_mode_enabled(v) )
|
||||
if ( hvm_long_mode_enabled(v) && creg->attr.fields.l )
|
||||
{
|
||||
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;
|
||||
}
|
||||
sh_ctxt->ctxt.addr_size = sh_ctxt->ctxt.sp_size = 64;
|
||||
}
|
||||
else if ( regs->eflags & X86_EFLAGS_VM )
|
||||
{
|
||||
|
||||