Booting OS as a VMM
Posted: Fri Aug 06, 2010 12:03 pm
HI,
Hoping someone can help. I am working on getting an OS booted in VMM mode on an intel processor. I am using OWC 17 as the compiler. So far I have paging enabled and working. (32 bit mode with segmentation enabled). I checked the cpuid for the processor I am using and it does support VMX. I allocate a region in memory equal to size shown in IA32_VMX_BASIC_MSR (bits44:32) = 800 so I set it up as 2048 = 2k region size. I set the VMCS revision Identifier as shown in bits 31:0 of this msr = 13 (on my test processor). It is a 4k aligned region. My vmxon address is 66c000 (looks ok). Control Registers:
CR0 = 8001003b
CR4 = 2200
IA32_FEATURE_CONTROL MSR = 0xd
IA32_EFER.LMA = 0x0
EFLAGS = 246
A20 = 0x0
Then when I call vmxon I get interrupt 13 a GP - seems to not like my memory reference to the vmxon region?
Watcom does not have support for the Intel VMX instruction set so had to add lib with opcode for vmxon
unsigned long long vmxon_region;
void __near vmxon(void);
#pragma aux vmxon = \
"nop" \
"nop" \
"push ebx" \
"mov ebx, offset vmxon_region" \
"nop" \
"nop" \
0xF3 0x0F 0xC7 0x33 \
"nop" \
"nop" \
"pop ebx" \
"nop" \
"nop";
I assign the 32 bit addres to vmxon_region (a 64 bit long long) in another function and then call vmxon. I am not real clear about how vmxon works does it take indirect or direct address? Tried both and haven't gotten anything but GP
Hoping someone can help. I am working on getting an OS booted in VMM mode on an intel processor. I am using OWC 17 as the compiler. So far I have paging enabled and working. (32 bit mode with segmentation enabled). I checked the cpuid for the processor I am using and it does support VMX. I allocate a region in memory equal to size shown in IA32_VMX_BASIC_MSR (bits44:32) = 800 so I set it up as 2048 = 2k region size. I set the VMCS revision Identifier as shown in bits 31:0 of this msr = 13 (on my test processor). It is a 4k aligned region. My vmxon address is 66c000 (looks ok). Control Registers:
CR0 = 8001003b
CR4 = 2200
IA32_FEATURE_CONTROL MSR = 0xd
IA32_EFER.LMA = 0x0
EFLAGS = 246
A20 = 0x0
Then when I call vmxon I get interrupt 13 a GP - seems to not like my memory reference to the vmxon region?
Watcom does not have support for the Intel VMX instruction set so had to add lib with opcode for vmxon
unsigned long long vmxon_region;
void __near vmxon(void);
#pragma aux vmxon = \
"nop" \
"nop" \
"push ebx" \
"mov ebx, offset vmxon_region" \
"nop" \
"nop" \
0xF3 0x0F 0xC7 0x33 \
"nop" \
"nop" \
"pop ebx" \
"nop" \
"nop";
I assign the 32 bit addres to vmxon_region (a 64 bit long long) in another function and then call vmxon. I am not real clear about how vmxon works does it take indirect or direct address? Tried both and haven't gotten anything but GP