Skip to content
Snippets Groups Projects
Commit cb8a5cba authored by iliya.saroukha's avatar iliya.saroukha :first_quarter_moon:
Browse files

feat: added macros for reading values from IA32_VMX_BASIC, lots of thing to debug i suppose

parent ceb71472
No related branches found
No related tags found
No related merge requests found
...@@ -22,6 +22,9 @@ ...@@ -22,6 +22,9 @@
// regions // regions
#define IA32_VMX_BASIC (0x480) #define IA32_VMX_BASIC (0x480)
#define VMCS_REVISION_ID (__rdmsr(IA32_VMX_BASIC) & 0x7fffffff)
#define REGION_SIZE ((__rdmsr(IA32_VMX_BASIC) >> 32) & 0x1fff)
// Appendix 8 p. 4'592 of Intel SDM // Appendix 8 p. 4'592 of Intel SDM
#define IA32_VMX_CR0_FIXED0 (0x486) #define IA32_VMX_CR0_FIXED0 (0x486)
#define IA32_VMX_CR0_FIXED1 (0x487) #define IA32_VMX_CR0_FIXED1 (0x487)
...@@ -158,7 +161,7 @@ static int my_init(void) { ...@@ -158,7 +161,7 @@ static int my_init(void) {
printk(KERN_INFO "Allocating memory for VMXON region\n"); printk(KERN_INFO "Allocating memory for VMXON region\n");
if (!vmxon_region_alloc()) { if (vmxon_region_alloc() != 0) {
pr_err("Failed to allocated memory for the VMXON region\n"); pr_err("Failed to allocated memory for the VMXON region\n");
return -1; return -1;
} }
...@@ -174,7 +177,10 @@ static int my_init(void) { ...@@ -174,7 +177,10 @@ static int my_init(void) {
unsigned long long vmx_basic_msr = __rdmsr(IA32_VMX_BASIC); unsigned long long vmx_basic_msr = __rdmsr(IA32_VMX_BASIC);
pr_debug("IA32_VMX_BASIC_MSR = 0x%llx\n", vmx_basic_msr); pr_debug("IA32_VMX_BASIC_MSR = 0x%llx\n", vmx_basic_msr);
unsigned long vmcs_revision_id = vmx_basic_msr & 0x7fffffff; unsigned long size_to_alloc = REGION_SIZE;
pr_debug("Region size to allocate = 0x%lx\n", size_to_alloc);
unsigned long vmcs_revision_id = VMCS_REVISION_ID;
pr_debug("VMCS revision identifier = 0x%lx\n", vmcs_revision_id); pr_debug("VMCS revision identifier = 0x%lx\n", vmcs_revision_id);
return 0; return 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment