ia64/xen-unstable

changeset 15674:9174a8cfb578

hvm: Fix CR0 handling, which I broke in 15652.
Thanks to Eric Liu for spotting this.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Tue Jul 31 09:47:11 2007 +0100 (2007-07-31)
parents 8daf61f4d89d
children 66147ca8f9c4
files xen/arch/x86/hvm/svm/svm.c xen/arch/x86/hvm/vmx/vmx.c xen/include/asm-x86/hvm/hvm.h
line diff
     1.1 --- a/xen/arch/x86/hvm/svm/svm.c	Tue Jul 31 09:39:14 2007 +0100
     1.2 +++ b/xen/arch/x86/hvm/svm/svm.c	Tue Jul 31 09:47:11 2007 +0100
     1.3 @@ -1677,7 +1677,7 @@ static int svm_set_cr0(unsigned long val
     1.4          return 0;
     1.5      }
     1.6  
     1.7 -    value &= HVM_CR0_GUEST_RESERVED_BITS;
     1.8 +    value &= ~HVM_CR0_GUEST_RESERVED_BITS;
     1.9  
    1.10      /* ET is reserved and should be always be 1. */
    1.11      value |= X86_CR0_ET;
     2.1 --- a/xen/arch/x86/hvm/vmx/vmx.c	Tue Jul 31 09:39:14 2007 +0100
     2.2 +++ b/xen/arch/x86/hvm/vmx/vmx.c	Tue Jul 31 09:47:11 2007 +0100
     2.3 @@ -2209,7 +2209,7 @@ static int vmx_set_cr0(unsigned long val
     2.4          return 0;
     2.5      }
     2.6  
     2.7 -    value &= HVM_CR0_GUEST_RESERVED_BITS;
     2.8 +    value &= ~HVM_CR0_GUEST_RESERVED_BITS;
     2.9  
    2.10      /* ET is reserved and should be always be 1. */
    2.11      value |= X86_CR0_ET;
     3.1 --- a/xen/include/asm-x86/hvm/hvm.h	Tue Jul 31 09:39:14 2007 +0100
     3.2 +++ b/xen/include/asm-x86/hvm/hvm.h	Tue Jul 31 09:47:11 2007 +0100
     3.3 @@ -301,22 +301,24 @@ static inline int hvm_event_injection_fa
     3.4  }
     3.5  
     3.6  /* These reserved bits in lower 32 remain 0 after any load of CR0 */
     3.7 -#define HVM_CR0_GUEST_RESERVED_BITS \
     3.8 -    ~(X86_CR0_PE | X86_CR0_MP | X86_CR0_EM | \
     3.9 -      X86_CR0_TS | X86_CR0_ET | X86_CR0_NE | \
    3.10 -      X86_CR0_WP | X86_CR0_AM | X86_CR0_NW | \
    3.11 -      X86_CR0_CD | X86_CR0_PG)
    3.12 +#define HVM_CR0_GUEST_RESERVED_BITS             \
    3.13 +    (~((unsigned long)                          \
    3.14 +       (X86_CR0_PE | X86_CR0_MP | X86_CR0_EM |  \
    3.15 +        X86_CR0_TS | X86_CR0_ET | X86_CR0_NE |  \
    3.16 +        X86_CR0_WP | X86_CR0_AM | X86_CR0_NW |  \
    3.17 +        X86_CR0_CD | X86_CR0_PG)))
    3.18  
    3.19  /* These bits in CR4 are owned by the host. */
    3.20  #define HVM_CR4_HOST_MASK (mmu_cr4_features & \
    3.21      (X86_CR4_VMXE | X86_CR4_PAE | X86_CR4_MCE))
    3.22  
    3.23  /* These bits in CR4 cannot be set by the guest. */
    3.24 -#define HVM_CR4_GUEST_RESERVED_BITS \
    3.25 -    ~(X86_CR4_VME | X86_CR4_PVI | X86_CR4_TSD | \
    3.26 -      X86_CR4_DE  | X86_CR4_PSE | X86_CR4_PAE | \
    3.27 -      X86_CR4_MCE | X86_CR4_PGE | X86_CR4_PCE | \
    3.28 -      X86_CR4_OSFXSR | X86_CR4_OSXMMEXCPT)
    3.29 +#define HVM_CR4_GUEST_RESERVED_BITS                     \
    3.30 +    (~((unsigned long)                                  \
    3.31 +       (X86_CR4_VME | X86_CR4_PVI | X86_CR4_TSD |       \
    3.32 +        X86_CR4_DE  | X86_CR4_PSE | X86_CR4_PAE |       \
    3.33 +        X86_CR4_MCE | X86_CR4_PGE | X86_CR4_PCE |       \
    3.34 +        X86_CR4_OSFXSR | X86_CR4_OSXMMEXCPT)))
    3.35  
    3.36  /* These exceptions must always be intercepted. */
    3.37  #define HVM_TRAP_MASK (1U << TRAP_machine_check)