direct-io.hg

changeset 15503:27e993c80ceb

VMX: Fix function return code when a GP fault is generated on CR accesses.
Signed-off-by: Xin Li <xin.b.li@intel.com>
author kfraser@localhost.localdomain
date Mon Jul 09 09:47:20 2007 +0100 (2007-07-09)
parents 99143d572521
children 27768e6ca214
files xen/arch/x86/hvm/vmx/vmx.c
line diff
     1.1 --- a/xen/arch/x86/hvm/vmx/vmx.c	Mon Jul 09 09:41:45 2007 +0100
     1.2 +++ b/xen/arch/x86/hvm/vmx/vmx.c	Mon Jul 09 09:47:20 2007 +0100
     1.3 @@ -2153,7 +2153,7 @@ static int vmx_assist(struct vcpu *v, in
     1.4              goto error;
     1.5          if ( cp != 0 ) {
     1.6              vmx_world_save(v, &c);
     1.7 -            if ( hvm_copy_to_guest_phys(cp, &c, sizeof(c)))
     1.8 +            if ( hvm_copy_to_guest_phys(cp, &c, sizeof(c)) )
     1.9                  goto error;
    1.10          }
    1.11  
    1.12 @@ -2220,7 +2220,7 @@ static int vmx_set_cr0(unsigned long val
    1.13      /* ET is reserved and should be always be 1. */
    1.14      value |= X86_CR0_ET;
    1.15  
    1.16 -    if ( (value & (X86_CR0_PE|X86_CR0_PG)) == X86_CR0_PG )
    1.17 +    if ( (value & (X86_CR0_PE | X86_CR0_PG)) == X86_CR0_PG )
    1.18      {
    1.19          vmx_inject_hw_exception(v, TRAP_gp_fault, 0);
    1.20          return 0;
    1.21 @@ -2253,12 +2253,11 @@ static int vmx_set_cr0(unsigned long val
    1.22                  HVM_DBG_LOG(DBG_LEVEL_1, "Guest enabled paging "
    1.23                              "with EFER.LME set but not CR4.PAE");
    1.24                  vmx_inject_hw_exception(v, TRAP_gp_fault, 0);
    1.25 +                return 0;
    1.26              }
    1.27 -            else
    1.28 -            {
    1.29 -                HVM_DBG_LOG(DBG_LEVEL_1, "Enabling long mode");
    1.30 -                vmx_enable_long_mode(v);
    1.31 -            }
    1.32 +
    1.33 +            HVM_DBG_LOG(DBG_LEVEL_1, "Enabling long mode");
    1.34 +            vmx_enable_long_mode(v);
    1.35          }
    1.36  
    1.37          /*
    1.38 @@ -2312,8 +2311,8 @@ static int vmx_set_cr0(unsigned long val
    1.39       */
    1.40      if ( (value & X86_CR0_PE) == 0 )
    1.41      {
    1.42 -        if ( value & X86_CR0_PG ) {
    1.43 -            /* inject GP here */
    1.44 +        if ( value & X86_CR0_PG )
    1.45 +        {
    1.46              vmx_inject_hw_exception(v, TRAP_gp_fault, 0);
    1.47              return 0;
    1.48          }
    1.49 @@ -2408,7 +2407,8 @@ static int mov_to_cr(int gp, int cr, str
    1.50          /*
    1.51           * If paging is not enabled yet, simply copy the value to CR3.
    1.52           */
    1.53 -        if ( !vmx_paging_enabled(v) ) {
    1.54 +        if ( !vmx_paging_enabled(v) )
    1.55 +        {
    1.56              v->arch.hvm_vmx.cpu_cr3 = value;
    1.57              break;
    1.58          }
    1.59 @@ -2454,7 +2454,7 @@ static int mov_to_cr(int gp, int cr, str
    1.60                          "Guest attempts to set reserved bit in CR4: %lx",
    1.61                          value);
    1.62              vmx_inject_hw_exception(v, TRAP_gp_fault, 0);
    1.63 -            break;
    1.64 +            return 0;
    1.65          }
    1.66  
    1.67          if ( (value & X86_CR4_PAE) && !(old_cr & X86_CR4_PAE) )
    1.68 @@ -2472,7 +2472,6 @@ static int mov_to_cr(int gp, int cr, str
    1.69                  /*
    1.70                   * Now arch.guest_table points to machine physical.
    1.71                   */
    1.72 -
    1.73                  old_base_mfn = pagetable_get_pfn(v->arch.guest_table);
    1.74                  v->arch.guest_table = pagetable_from_pfn(mfn);
    1.75                  if ( old_base_mfn )
    1.76 @@ -2494,6 +2493,7 @@ static int mov_to_cr(int gp, int cr, str
    1.77                  HVM_DBG_LOG(DBG_LEVEL_1, "Guest cleared CR4.PAE while "
    1.78                              "EFER.LMA is set");
    1.79                  vmx_inject_hw_exception(v, TRAP_gp_fault, 0);
    1.80 +                return 0;
    1.81              }
    1.82          }
    1.83