ia64/xen-unstable

changeset 17178:7530c4dba8a5

hvm emulate: Correctly probe when we are in 64-bit mode and set
address-size default appropriately.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Mar 03 15:19:39 2008 +0000 (2008-03-03)
parents d0daf11fb35d
children f76f151a7431
files xen/arch/x86/hvm/emulate.c xen/arch/x86/mm/shadow/common.c
line diff
     1.1 --- a/xen/arch/x86/hvm/emulate.c	Mon Mar 03 13:54:05 2008 +0000
     1.2 +++ b/xen/arch/x86/hvm/emulate.c	Mon Mar 03 15:19:39 2008 +0000
     1.3 @@ -673,14 +673,23 @@ int hvm_emulate_one(
     1.4      struct hvm_emulate_ctxt *hvmemul_ctxt)
     1.5  {
     1.6      struct cpu_user_regs *regs = hvmemul_ctxt->ctxt.regs;
     1.7 +    struct vcpu *curr = current;
     1.8      uint32_t new_intr_shadow;
     1.9      unsigned long addr;
    1.10      int rc;
    1.11  
    1.12 -    hvmemul_ctxt->ctxt.addr_size =
    1.13 -        hvmemul_ctxt->seg_reg[x86_seg_cs].attr.fields.db ? 32 : 16;
    1.14 -    hvmemul_ctxt->ctxt.sp_size =
    1.15 -        hvmemul_ctxt->seg_reg[x86_seg_ss].attr.fields.db ? 32 : 16;
    1.16 +    if ( hvm_long_mode_enabled(curr) &&
    1.17 +         hvmemul_ctxt->seg_reg[x86_seg_cs].attr.fields.l )
    1.18 +    {
    1.19 +        hvmemul_ctxt->ctxt.addr_size = hvmemul_ctxt->ctxt.sp_size = 64;
    1.20 +    }
    1.21 +    else
    1.22 +    {
    1.23 +        hvmemul_ctxt->ctxt.addr_size =
    1.24 +            hvmemul_ctxt->seg_reg[x86_seg_cs].attr.fields.db ? 32 : 16;
    1.25 +        hvmemul_ctxt->ctxt.sp_size =
    1.26 +            hvmemul_ctxt->seg_reg[x86_seg_ss].attr.fields.db ? 32 : 16;
    1.27 +    }
    1.28  
    1.29      hvmemul_ctxt->insn_buf_eip = regs->eip;
    1.30      hvmemul_ctxt->insn_buf_bytes =
    1.31 @@ -715,11 +724,11 @@ int hvm_emulate_one(
    1.32      if ( hvmemul_ctxt->intr_shadow != new_intr_shadow )
    1.33      {
    1.34          hvmemul_ctxt->intr_shadow = new_intr_shadow;
    1.35 -        hvm_funcs.set_interrupt_shadow(current, new_intr_shadow);
    1.36 +        hvm_funcs.set_interrupt_shadow(curr, new_intr_shadow);
    1.37      }
    1.38  
    1.39      if ( hvmemul_ctxt->ctxt.retire.flags.hlt &&
    1.40 -         !hvm_local_events_need_delivery(current) )
    1.41 +         !hvm_local_events_need_delivery(curr) )
    1.42      {
    1.43          hvm_hlt(regs->eflags);
    1.44      }
     2.1 --- a/xen/arch/x86/mm/shadow/common.c	Mon Mar 03 13:54:05 2008 +0000
     2.2 +++ b/xen/arch/x86/mm/shadow/common.c	Mon Mar 03 15:19:39 2008 +0000
     2.3 @@ -402,10 +402,6 @@ struct x86_emulate_ops *shadow_init_emul
     2.4      {
     2.5          sh_ctxt->ctxt.addr_size = sh_ctxt->ctxt.sp_size = 64;
     2.6      }
     2.7 -    else if ( regs->eflags & X86_EFLAGS_VM )
     2.8 -    {
     2.9 -        sh_ctxt->ctxt.addr_size = sh_ctxt->ctxt.sp_size = 16;
    2.10 -    }
    2.11      else
    2.12      {
    2.13          sreg = hvm_get_seg_reg(x86_seg_ss, sh_ctxt);