[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] hvm: Sync SVM CR4 handling with VMX.
# HG changeset patch # User Keir Fraser <keir@xxxxxxxxxxxxx> # Date 1182971874 -3600 # Node ID 87d34c8c2fe1a444b24c4f6a7a3cde3d1baebb93 # Parent 5eec9a8825d466f76ecc847e9ecbbff5d166bbf1 hvm: Sync SVM CR4 handling with VMX. Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx> --- xen/arch/x86/hvm/svm/svm.c | 10 +++++----- xen/arch/x86/hvm/vmx/vmx.c | 2 +- xen/include/asm-x86/hvm/hvm.h | 9 ++++++++- xen/include/asm-x86/processor.h | 6 ------ 4 files changed, 14 insertions(+), 13 deletions(-) diff -r 5eec9a8825d4 -r 87d34c8c2fe1 xen/arch/x86/hvm/svm/svm.c --- a/xen/arch/x86/hvm/svm/svm.c Wed Jun 27 20:08:21 2007 +0100 +++ b/xen/arch/x86/hvm/svm/svm.c Wed Jun 27 20:17:54 2007 +0100 @@ -1828,11 +1828,11 @@ static int mov_to_cr(int gpreg, int cr, break; case 4: /* CR4 */ - if ( value & ~mmu_cr4_features ) - { - HVM_DBG_LOG(DBG_LEVEL_1, "Guest attempts to enable unsupported " - "CR4 features %lx (host %lx)", - value, mmu_cr4_features); + if ( value & HVM_CR4_GUEST_RESERVED_BITS ) + { + HVM_DBG_LOG(DBG_LEVEL_1, + "Guest attempts to set reserved bit in CR4: %lx", + value); svm_inject_exception(v, TRAP_gp_fault, 1, 0); break; } diff -r 5eec9a8825d4 -r 87d34c8c2fe1 xen/arch/x86/hvm/vmx/vmx.c --- a/xen/arch/x86/hvm/vmx/vmx.c Wed Jun 27 20:08:21 2007 +0100 +++ b/xen/arch/x86/hvm/vmx/vmx.c Wed Jun 27 20:17:54 2007 +0100 @@ -2387,7 +2387,7 @@ static int mov_to_cr(int gp, int cr, str case 4: /* CR4 */ old_cr = v->arch.hvm_vmx.cpu_shadow_cr4; - if ( value & X86_CR4_RESERVED_BITS ) + if ( value & HVM_CR4_GUEST_RESERVED_BITS ) { HVM_DBG_LOG(DBG_LEVEL_1, "Guest attempts to set reserved bit in CR4: %lx", diff -r 5eec9a8825d4 -r 87d34c8c2fe1 xen/include/asm-x86/hvm/hvm.h --- a/xen/include/asm-x86/hvm/hvm.h Wed Jun 27 20:08:21 2007 +0100 +++ b/xen/include/asm-x86/hvm/hvm.h Wed Jun 27 20:17:54 2007 +0100 @@ -302,10 +302,17 @@ static inline int hvm_event_injection_fa return hvm_funcs.event_injection_faulted(v); } -/* These bits in the CR4 are owned by the host */ +/* These bits in CR4 are owned by the host. */ #define HVM_CR4_HOST_MASK (mmu_cr4_features & \ (X86_CR4_VMXE | X86_CR4_PAE | X86_CR4_MCE)) +/* These bits in CR4 cannot be set by the guest. */ +#define HVM_CR4_GUEST_RESERVED_BITS \ + ~(X86_CR4_VME | X86_CR4_PVI | X86_CR4_TSD | \ + X86_CR4_DE | X86_CR4_PSE | X86_CR4_PAE | \ + X86_CR4_MCE | X86_CR4_PGE | X86_CR4_PCE | \ + X86_CR4_OSFXSR | X86_CR4_OSXMMEXCPT) + /* These exceptions must always be intercepted. */ #define HVM_TRAP_MASK (1U << TRAP_machine_check) diff -r 5eec9a8825d4 -r 87d34c8c2fe1 xen/include/asm-x86/processor.h --- a/xen/include/asm-x86/processor.h Wed Jun 27 20:08:21 2007 +0100 +++ b/xen/include/asm-x86/processor.h Wed Jun 27 20:17:54 2007 +0100 @@ -80,12 +80,6 @@ #define X86_CR4_OSFXSR 0x0200 /* enable fast FPU save and restore */ #define X86_CR4_OSXMMEXCPT 0x0400 /* enable unmasked SSE exceptions */ #define X86_CR4_VMXE 0x2000 /* enable VMX */ - -#define X86_CR4_RESERVED_BITS \ - ~(X86_CR4_VME | X86_CR4_PVI | X86_CR4_TSD | \ - X86_CR4_DE | X86_CR4_PSE | X86_CR4_PAE | \ - X86_CR4_MCE | X86_CR4_PGE | X86_CR4_PCE | \ - X86_CR4_OSFXSR | X86_CR4_OSXMMEXCPT | X86_CR4_VMXE) /* * Trap/fault mnemonics. _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |