direct-io.hg

changeset 3566:a396b30da79d

bitkeeper revision 1.1159.231.9 (41f97c50Eg32TPmD9lVOyWCldhbhDA)

Some guests depend on getting a #GP fault in order to boot. This patch
makes sure that the GP fault is injected into the guest properly.

Signed-off-by: Arun Sharma <arun.sharma@intel.com>
Signed-off-by: ian.pratt@cl.cam.ac.uk
author iap10@labyrinth.cl.cam.ac.uk
date Thu Jan 27 23:42:08 2005 +0000 (2005-01-27)
parents 2e60786262c4
children 3fef449b1078
files xen/arch/x86/vmx.c
line diff
     1.1 --- a/xen/arch/x86/vmx.c	Thu Jan 27 18:05:01 2005 +0000
     1.2 +++ b/xen/arch/x86/vmx.c	Thu Jan 27 23:42:08 2005 +0000
     1.3 @@ -41,6 +41,11 @@ unsigned int opt_vmx_debug_level;
     1.4  extern long evtchn_send(int lport);
     1.5  extern long do_block(void);
     1.6  
     1.7 +#define VECTOR_DB   1
     1.8 +#define VECTOR_BP   3
     1.9 +#define VECTOR_GP   13
    1.10 +#define VECTOR_PG   14
    1.11 +
    1.12  int start_vmx()
    1.13  {
    1.14      struct vmcs_struct *vmcs;
    1.15 @@ -142,19 +147,26 @@ static int vmx_do_page_fault(unsigned lo
    1.16  static void vmx_do_general_protection_fault(struct xen_regs *regs) 
    1.17  {
    1.18      unsigned long eip, error_code;
    1.19 +    unsigned long intr_fields;
    1.20  
    1.21      __vmread(GUEST_EIP, &eip);
    1.22      __vmread(VM_EXIT_INTR_ERROR_CODE, &error_code);
    1.23  
    1.24 -    VMX_DBG_LOG(DBG_LEVEL_1, 
    1.25 +    VMX_DBG_LOG(DBG_LEVEL_1,
    1.26              "vmx_general_protection_fault: eip = %lx, erro_code = %lx\n",
    1.27              eip, error_code);
    1.28  
    1.29 -    VMX_DBG_LOG(DBG_LEVEL_1, 
    1.30 +    VMX_DBG_LOG(DBG_LEVEL_1,
    1.31              "eax=%x, ebx=%x, ecx=%x, edx=%x, esi=%x, edi=%x\n",
    1.32              regs->eax, regs->ebx, regs->ecx, regs->edx, regs->esi, regs->edi);
    1.33  
    1.34 -    __vmx_bug(regs);
    1.35 +    /* Reflect it back into the guest */
    1.36 +    intr_fields = (INTR_INFO_VALID_MASK | 
    1.37 +		   INTR_TYPE_EXCEPTION |
    1.38 +		   INTR_INFO_DELIEVER_CODE_MASK |
    1.39 +		   VECTOR_GP);
    1.40 +    __vmwrite(VM_ENTRY_INTR_INFO_FIELD, intr_fields);
    1.41 +    __vmwrite(VM_ENTRY_EXCEPTION_ERROR_CODE, error_code);
    1.42  }
    1.43  
    1.44  static void vmx_vmexit_do_cpuid(unsigned long input, struct xen_regs *regs) 
    1.45 @@ -725,11 +737,6 @@ asmlinkage void vmx_vmexit_handler(struc
    1.46      switch (exit_reason) {
    1.47      case EXIT_REASON_EXCEPTION_NMI:
    1.48      {
    1.49 -#define VECTOR_DB   1
    1.50 -#define VECTOR_BP   3
    1.51 -#define VECTOR_GP   13
    1.52 -#define VECTOR_PG   14
    1.53 -
    1.54          /*
    1.55           * We don't set the software-interrupt exiting (INT n). 
    1.56           * (1) We can get an exception (e.g. #PG) in the guest, or