ia64/xen-unstable

changeset 16479:11bfa26dd125

vmx realmode: Fix emulation of exception delivery (stack pointer must
be adjusted for FLAGS push), and fix up vmx_realmode() exit protocol
now that it is called from asm stub context.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Nov 26 16:47:10 2007 +0000 (2007-11-26)
parents c5332fa8b68d
children 4deb65519d9b
files xen/arch/x86/hvm/vmx/realmode.c xen/include/asm-x86/hvm/vmx/vmx.h
line diff
     1.1 --- a/xen/arch/x86/hvm/vmx/realmode.c	Mon Nov 26 16:46:22 2007 +0000
     1.2 +++ b/xen/arch/x86/hvm/vmx/realmode.c	Mon Nov 26 16:47:10 2007 +0000
     1.3 @@ -88,12 +88,12 @@ static void realmode_deliver_exception(
     1.4  
     1.5      if ( rm_ctxt->ctxt.addr_size == 32 )
     1.6      {
     1.7 -        regs->esp -= 4;
     1.8 +        regs->esp -= 6;
     1.9          pstk = regs->esp;
    1.10      }
    1.11      else
    1.12      {
    1.13 -        pstk = (uint16_t)(regs->esp - 4);
    1.14 +        pstk = (uint16_t)(regs->esp - 6);
    1.15          regs->esp &= ~0xffff;
    1.16          regs->esp |= pstk;
    1.17      }
    1.18 @@ -419,12 +419,12 @@ static struct x86_emulate_ops realmode_e
    1.19      .inject_sw_interrupt = realmode_inject_sw_interrupt
    1.20  };
    1.21  
    1.22 -int vmx_realmode(struct cpu_user_regs *regs)
    1.23 +void vmx_realmode(struct cpu_user_regs *regs)
    1.24  {
    1.25      struct vcpu *curr = current;
    1.26      struct realmode_emulate_ctxt rm_ctxt;
    1.27      unsigned long intr_info;
    1.28 -    int i, rc = 0;
    1.29 +    int i, rc;
    1.30      u32 intr_shadow, new_intr_shadow;
    1.31  
    1.32      rm_ctxt.ctxt.regs = regs;
    1.33 @@ -487,10 +487,7 @@ int vmx_realmode(struct cpu_user_regs *r
    1.34              hvm_hlt(regs->eflags);
    1.35  
    1.36          if ( curr->arch.hvm_vmx.real_mode_io_in_progress )
    1.37 -        {
    1.38 -            rc = 0;
    1.39              break;
    1.40 -        }
    1.41  
    1.42          if ( rc == X86EMUL_UNHANDLEABLE )
    1.43          {
    1.44 @@ -501,15 +498,12 @@ int vmx_realmode(struct cpu_user_regs *r
    1.45                       rm_ctxt.insn_buf[2], rm_ctxt.insn_buf[3],
    1.46                       rm_ctxt.insn_buf[4], rm_ctxt.insn_buf[5]);
    1.47              gdprintk(XENLOG_ERR, "Emulation failed\n");
    1.48 -            rc = -EINVAL;
    1.49 -            break;
    1.50 +            domain_crash_synchronous();
    1.51          }
    1.52      }
    1.53  
    1.54      for ( i = 0; i < 10; i++ )
    1.55          hvm_set_segment_register(curr, i, &rm_ctxt.seg_reg[i]);
    1.56 -
    1.57 -    return rc;
    1.58  }
    1.59  
    1.60  int vmx_realmode_io_complete(void)
     2.1 --- a/xen/include/asm-x86/hvm/vmx/vmx.h	Mon Nov 26 16:46:22 2007 +0000
     2.2 +++ b/xen/include/asm-x86/hvm/vmx/vmx.h	Mon Nov 26 16:47:10 2007 +0000
     2.3 @@ -37,7 +37,7 @@ void vmx_cpuid_intercept(
     2.4      unsigned int *eax, unsigned int *ebx,
     2.5      unsigned int *ecx, unsigned int *edx);
     2.6  void vmx_wbinvd_intercept(void);
     2.7 -int vmx_realmode(struct cpu_user_regs *regs);
     2.8 +void vmx_realmode(struct cpu_user_regs *regs);
     2.9  int vmx_realmode_io_complete(void);
    2.10  
    2.11  /*