KVM: Use standard CR8 flags, and fix TPR definition
authorRusty Russell <rusty@rustcorp.com.au>
Tue, 17 Jul 2007 13:37:17 +0000 (23:37 +1000)
committerAvi Kivity <avi@qumranet.com>
Sat, 13 Oct 2007 08:18:19 +0000 (10:18 +0200)
Intel manual (and KVM definition) say the TPR is 4 bits wide.  Also fix
CR8_RESEVED_BITS typo.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Acked-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
drivers/kvm/kvm_main.c
include/asm-x86/processor-flags.h

index 193197fb399ea30091ebf21b3d4c83592c9bb890..f0fc8d9e71e67d9fb5fd17322f3d3799895ef5e8 100644 (file)
@@ -92,7 +92,7 @@ static struct dentry *debugfs_dir;
                          | X86_CR4_PGE | X86_CR4_PCE | X86_CR4_OSFXSR  \
                          | X86_CR4_OSXMMEXCPT | X86_CR4_VMXE))
 
-#define CR8_RESEVED_BITS (~0x0fULL)
+#define CR8_RESERVED_BITS (~(unsigned long)X86_CR8_TPR)
 #define EFER_RESERVED_BITS 0xfffffffffffff2fe
 
 #ifdef CONFIG_X86_64
@@ -625,7 +625,7 @@ EXPORT_SYMBOL_GPL(set_cr3);
 
 void set_cr8(struct kvm_vcpu *vcpu, unsigned long cr8)
 {
-       if ( cr8 & CR8_RESEVED_BITS) {
+       if (cr8 & CR8_RESERVED_BITS) {
                printk(KERN_DEBUG "set_cr8: #GP, reserved bits 0x%lx\n", cr8);
                inject_gp(vcpu);
                return;
index 5404e90edd57907e776e13b80e460863ac07bf7e..199cab107d85d134d697dcc3b6ab4227513a2bb9 100644 (file)
@@ -63,7 +63,7 @@
 /*
  * x86-64 Task Priority Register, CR8
  */
-#define X86_CR8_TPR    0x00000007 /* task priority register */
+#define X86_CR8_TPR    0x0000000F /* task priority register */
 
 /*
  * AMD and Transmeta use MSRs for configuration; see <asm/msr-index.h>