direct-io.hg

changeset 15424:87d34c8c2fe1

hvm: Sync SVM CR4 handling with VMX.
Signed-off-by: Keir Fraser <keir@xensource.com>
author Keir Fraser <keir@xensource.com>
date Wed Jun 27 20:17:54 2007 +0100 (2007-06-27)
parents 5eec9a8825d4
children 6e934c799051
files xen/arch/x86/hvm/svm/svm.c xen/arch/x86/hvm/vmx/vmx.c xen/include/asm-x86/hvm/hvm.h xen/include/asm-x86/processor.h
line diff
     1.1 --- a/xen/arch/x86/hvm/svm/svm.c	Wed Jun 27 20:08:21 2007 +0100
     1.2 +++ b/xen/arch/x86/hvm/svm/svm.c	Wed Jun 27 20:17:54 2007 +0100
     1.3 @@ -1828,11 +1828,11 @@ static int mov_to_cr(int gpreg, int cr, 
     1.4          break;
     1.5  
     1.6      case 4: /* CR4 */
     1.7 -        if ( value & ~mmu_cr4_features )
     1.8 +        if ( value & HVM_CR4_GUEST_RESERVED_BITS )
     1.9          {
    1.10 -            HVM_DBG_LOG(DBG_LEVEL_1, "Guest attempts to enable unsupported "
    1.11 -                        "CR4 features %lx (host %lx)",
    1.12 -                        value, mmu_cr4_features);
    1.13 +            HVM_DBG_LOG(DBG_LEVEL_1,
    1.14 +                        "Guest attempts to set reserved bit in CR4: %lx",
    1.15 +                        value);
    1.16              svm_inject_exception(v, TRAP_gp_fault, 1, 0);
    1.17              break;
    1.18          }
     2.1 --- a/xen/arch/x86/hvm/vmx/vmx.c	Wed Jun 27 20:08:21 2007 +0100
     2.2 +++ b/xen/arch/x86/hvm/vmx/vmx.c	Wed Jun 27 20:17:54 2007 +0100
     2.3 @@ -2387,7 +2387,7 @@ static int mov_to_cr(int gp, int cr, str
     2.4      case 4: /* CR4 */
     2.5          old_cr = v->arch.hvm_vmx.cpu_shadow_cr4;
     2.6  
     2.7 -        if ( value & X86_CR4_RESERVED_BITS )
     2.8 +        if ( value & HVM_CR4_GUEST_RESERVED_BITS )
     2.9          {
    2.10              HVM_DBG_LOG(DBG_LEVEL_1,
    2.11                          "Guest attempts to set reserved bit in CR4: %lx",
     3.1 --- a/xen/include/asm-x86/hvm/hvm.h	Wed Jun 27 20:08:21 2007 +0100
     3.2 +++ b/xen/include/asm-x86/hvm/hvm.h	Wed Jun 27 20:17:54 2007 +0100
     3.3 @@ -302,10 +302,17 @@ static inline int hvm_event_injection_fa
     3.4      return hvm_funcs.event_injection_faulted(v);
     3.5  }
     3.6  
     3.7 -/* These bits in the CR4 are owned by the host */
     3.8 +/* These bits in CR4 are owned by the host. */
     3.9  #define HVM_CR4_HOST_MASK (mmu_cr4_features & \
    3.10      (X86_CR4_VMXE | X86_CR4_PAE | X86_CR4_MCE))
    3.11  
    3.12 +/* These bits in CR4 cannot be set by the guest. */
    3.13 +#define HVM_CR4_GUEST_RESERVED_BITS \
    3.14 +    ~(X86_CR4_VME | X86_CR4_PVI | X86_CR4_TSD | \
    3.15 +      X86_CR4_DE  | X86_CR4_PSE | X86_CR4_PAE | \
    3.16 +      X86_CR4_MCE | X86_CR4_PGE | X86_CR4_PCE | \
    3.17 +      X86_CR4_OSFXSR | X86_CR4_OSXMMEXCPT)
    3.18 +
    3.19  /* These exceptions must always be intercepted. */
    3.20  #define HVM_TRAP_MASK (1U << TRAP_machine_check)
    3.21  
     4.1 --- a/xen/include/asm-x86/processor.h	Wed Jun 27 20:08:21 2007 +0100
     4.2 +++ b/xen/include/asm-x86/processor.h	Wed Jun 27 20:17:54 2007 +0100
     4.3 @@ -81,12 +81,6 @@
     4.4  #define X86_CR4_OSXMMEXCPT	0x0400	/* enable unmasked SSE exceptions */
     4.5  #define X86_CR4_VMXE		0x2000  /* enable VMX */
     4.6  
     4.7 -#define X86_CR4_RESERVED_BITS   \
     4.8 -    ~(X86_CR4_VME | X86_CR4_PVI | X86_CR4_TSD | \
     4.9 -      X86_CR4_DE  | X86_CR4_PSE | X86_CR4_PAE | \
    4.10 -      X86_CR4_MCE | X86_CR4_PGE | X86_CR4_PCE | \
    4.11 -      X86_CR4_OSFXSR | X86_CR4_OSXMMEXCPT | X86_CR4_VMXE)
    4.12 -
    4.13  /*
    4.14   * Trap/fault mnemonics.
    4.15   */