ia64/xen-unstable

changeset 11772:b92104e0cf08

Since shadow_update_paging_modes() will modify v->arch.hvm_vcpu.hw_cr3,
so we should always do shadow_update_paging_modes() before we writes to
GUEST_CR3 with v->arch.hvm_vcpu.hw_cr3.

Signed-off-by: Xiaohui Xin xiaohui.xin@intel.com
Signed-off-by: Xin Li <xin.b.li@intel.com>
author Tim Deegan <tim.deegan@xensource.com>
date Mon Oct 09 10:18:11 2006 +0100 (2006-10-09)
parents a5469bf602ef
children e1f3af226a8e
files xen/arch/x86/hvm/vmx/vmx.c
line diff
     1.1 --- a/xen/arch/x86/hvm/vmx/vmx.c	Sun Oct 08 18:05:57 2006 +0100
     1.2 +++ b/xen/arch/x86/hvm/vmx/vmx.c	Mon Oct 09 10:18:11 2006 +0100
     1.3 @@ -1250,7 +1250,7 @@ static int vmx_world_save(struct vcpu *v
     1.4  
     1.5  static int vmx_world_restore(struct vcpu *v, struct vmx_assist_context *c)
     1.6  {
     1.7 -    unsigned long mfn, old_cr4, old_base_mfn;
     1.8 +    unsigned long mfn, old_base_mfn;
     1.9      int error = 0;
    1.10  
    1.11      error |= __vmwrite(GUEST_RIP, c->eip);
    1.12 @@ -1304,9 +1304,7 @@ static int vmx_world_restore(struct vcpu
    1.13          HVM_DBG_LOG(DBG_LEVEL_VMMU, "switching to vmxassist. use phys table");
    1.14      else
    1.15          HVM_DBG_LOG(DBG_LEVEL_VMMU, "Update CR3 value = %x", c->cr3);
    1.16 -    __vmwrite(GUEST_CR3, v->arch.hvm_vcpu.hw_cr3);
    1.17  
    1.18 -    error |= __vmread(CR4_READ_SHADOW, &old_cr4);
    1.19      error |= __vmwrite(GUEST_CR4, (c->cr4 | VMX_CR4_HOST_MASK));
    1.20      error |= __vmwrite(CR4_READ_SHADOW, c->cr4);
    1.21  
    1.22 @@ -1357,6 +1355,7 @@ static int vmx_world_restore(struct vcpu
    1.23      error |= __vmwrite(GUEST_LDTR_AR_BYTES, c->ldtr_arbytes.bytes);
    1.24  
    1.25      shadow_update_paging_modes(v);
    1.26 +    __vmwrite(GUEST_CR3, v->arch.hvm_vcpu.hw_cr3);
    1.27  
    1.28      return !error;
    1.29  }
    1.30 @@ -1572,8 +1571,8 @@ static int vmx_set_cr0(unsigned long val
    1.31      }
    1.32      else if ( (value & (X86_CR0_PE | X86_CR0_PG)) == X86_CR0_PE )
    1.33      {
    1.34 +        shadow_update_paging_modes(v);
    1.35          __vmwrite(GUEST_CR3, v->arch.hvm_vcpu.hw_cr3);
    1.36 -        shadow_update_paging_modes(v);
    1.37      }
    1.38  
    1.39      return 1;