Having problems with the MSR bitmaps.
I read the IA32_VMX_PROCBASED_CTLS MSR, set bit 28 and stored it into the vmcs's Primary proc-based VM-execution controls field.
I then have the following structure in the vmcs header file:
} __attribute__ (( aligned (4096) ));
and in the vmcs.cI have the following code that should clear all bits in the MSR bitmap pointed to by the MSR_BITMAP address of the vmcs field so that no MSR read or write will cause a VM exit:
struct MSR_BITMAP MSR_BITMAP1;
unsigned long MSR_BITMAP_ADDR = (unsigned long) &MSR_BITMAP1;
memset(&MSR_BITMAP1, 0, sizeof(MSR_BITMAP1)); //this should clear all bits in the bitmap forcing no MSRs to cause a VM exit
__vmwrite (MSR_BITMAP_LO, (u32)MSR_BITMAP_ADDR);
__vmwrite (MSR_BITMAP_HI, (u32)(MSR_BITMAP_ADDR >> 32));
In the VM i have the following code trying to read a MSR:
However when the VM tries to read the MSR I still get a VM-exit due to a MSR exception. How do I correctly setup the MSR bitmap of the VMCS so that I do not get a VM-exit caused by a MSR exception when I try to read a MSR in the VM. (Trying to write to an MSR in the VM causes a triple fault, hopefully solving this will fix that problem as well.)