ia64/xen-unstable

changeset 14040:f65a24235f58

hvm: Fix getvcpucontext to return the correct CR3 value.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Tue Feb 20 23:54:42 2007 +0000 (2007-02-20)
parents c39a6b458bd0
children 8bcd71c3b495
files xen/arch/x86/domctl.c xen/arch/x86/hvm/vmx/vmx.c
line diff
     1.1 --- a/xen/arch/x86/domctl.c	Tue Feb 20 20:49:44 2007 +0000
     1.2 +++ b/xen/arch/x86/domctl.c	Tue Feb 20 23:54:42 2007 +0000
     1.3 @@ -441,6 +441,10 @@ void arch_get_info_guest(struct vcpu *v,
     1.4          XLAT_vcpu_guest_context(c.cmp, &v->arch.guest_context);
     1.5  #endif
     1.6  
     1.7 +    c(flags &= ~(VGCF_i387_valid|VGCF_in_kernel));
     1.8 +    if ( test_bit(_VCPUF_fpu_initialised, &v->vcpu_flags) )
     1.9 +        c(flags |= VGCF_i387_valid);
    1.10 +
    1.11      if ( is_hvm_vcpu(v) )
    1.12      {
    1.13          if ( !IS_COMPAT(v->domain) )
    1.14 @@ -464,23 +468,21 @@ void arch_get_info_guest(struct vcpu *v,
    1.15          /* IOPL privileges are virtualised: merge back into returned eflags. */
    1.16          BUG_ON((c(user_regs.eflags) & EF_IOPL) != 0);
    1.17          c(user_regs.eflags |= v->arch.iopl << 12);
    1.18 -    }
    1.19 -
    1.20 -    c(flags &= ~(VGCF_i387_valid|VGCF_in_kernel));
    1.21 -    if ( test_bit(_VCPUF_fpu_initialised, &v->vcpu_flags) )
    1.22 -        c(flags |= VGCF_i387_valid);
    1.23 -    if ( guest_kernel_mode(v, &v->arch.guest_context.user_regs) )
    1.24 -        c(flags |= VGCF_in_kernel);
    1.25  
    1.26 -    if ( !IS_COMPAT(v->domain) )
    1.27 -        c.nat->ctrlreg[3] = xen_pfn_to_cr3(pagetable_get_pfn(v->arch.guest_table));
    1.28 +        if ( !IS_COMPAT(v->domain) )
    1.29 +            c.nat->ctrlreg[3] = xen_pfn_to_cr3(
    1.30 +                pagetable_get_pfn(v->arch.guest_table));
    1.31  #ifdef CONFIG_COMPAT
    1.32 -    else
    1.33 -    {
    1.34 -        l4_pgentry_t *l4e = __va(pagetable_get_paddr(v->arch.guest_table));
    1.35 -        c.cmp->ctrlreg[3] = compat_pfn_to_cr3(l4e_get_pfn(*l4e));
    1.36 +        else
    1.37 +        {
    1.38 +            l4_pgentry_t *l4e = __va(pagetable_get_paddr(v->arch.guest_table));
    1.39 +            c.cmp->ctrlreg[3] = compat_pfn_to_cr3(l4e_get_pfn(*l4e));
    1.40 +        }
    1.41 +#endif
    1.42 +
    1.43 +        if ( guest_kernel_mode(v, &v->arch.guest_context.user_regs) )
    1.44 +            c(flags |= VGCF_in_kernel);
    1.45      }
    1.46 -#endif
    1.47  
    1.48      c(vm_assist = v->domain->vm_assist);
    1.49  #undef c
     2.1 --- a/xen/arch/x86/hvm/vmx/vmx.c	Tue Feb 20 20:49:44 2007 +0000
     2.2 +++ b/xen/arch/x86/hvm/vmx/vmx.c	Tue Feb 20 23:54:42 2007 +0000
     2.3 @@ -696,7 +696,7 @@ static void vmx_store_cpu_guest_regs(
     2.4      {
     2.5          crs[0] = v->arch.hvm_vmx.cpu_shadow_cr0;
     2.6          crs[2] = v->arch.hvm_vmx.cpu_cr2;
     2.7 -        crs[3] = __vmread(GUEST_CR3);
     2.8 +        crs[3] = v->arch.hvm_vmx.cpu_cr3;
     2.9          crs[4] = v->arch.hvm_vmx.cpu_shadow_cr4;
    2.10      }
    2.11