diff --git a/proto/hypervisor.c b/proto/hypervisor.c index 7faf47bc2479a77ea29a4818972c54ee0847fcd4..fc44b494dc86a0def83fb710a0d545b5339c0655 100755 --- a/proto/hypervisor.c +++ b/proto/hypervisor.c @@ -23,7 +23,7 @@ #define IA32_VMX_BASIC (0x480) #define VMCS_REVISION_ID (__rdmsr(IA32_VMX_BASIC) & 0x7fffffff) -#define REGION_SIZE ((__rdmsr(IA32_VMX_BASIC) >> 32) & 0xfff) +#define REGION_SIZE ((__rdmsr(IA32_VMX_BASIC) >> 32) & 0x1fff) // Appendix 8 p. 4'592 of Intel SDM #define IA32_VMX_CR0_FIXED0 (0x486) @@ -118,7 +118,7 @@ static void restrictions_cr_msrs(void) { } static int vmxon_region_alloc(void) { - void *region = kzalloc(PAGE_SIZE, GFP_KERNEL); + void *region = kzalloc(REGION_SIZE, GFP_KERNEL); if (!region) { return -1; @@ -178,7 +178,7 @@ static int my_init(void) { pr_debug("IA32_VMX_BASIC_MSR = 0x%llx\n", vmx_basic_msr); unsigned long size_to_alloc = REGION_SIZE; - pr_debug("Region size to allocate = 0x%lx\n", size_to_alloc); + pr_debug("Region size to allocate = %lu bytes\n", size_to_alloc); unsigned long vmcs_revision_id = VMCS_REVISION_ID; pr_debug("VMCS revision identifier = 0x%lx\n", vmcs_revision_id);