* MSR_BITMAP question
@ 2016-12-28 3:04 jack.chen
0 siblings, 0 replies; only message in thread
From: jack.chen @ 2016-12-28 3:04 UTC (permalink / raw)
To: KVM maillist
Hello,now I'd like to set vm-exit when GUEST_SYSENTER_EIP(176h) was
read,and I set use msr bitmap in CPU_BASED_USE_MSR_BITMAPS,and then
set corresponding bit in bitmap,but when I start VM,I host occur a
fetal error!
/*function set bit map*/
static int setMsrBitMap(unsigned long *msr_bitmap,u32 msr,int type){
int f = sizeof(unsigned long);
if (!cpu_has_vmx_msr_bitmap())
return;
if (type & MSR_TYPE_R)
/* read-low */
__set_bit(msr, msr_bitmap + 0x000 / f);
if (type & MSR_TYPE_W)
/* write-low */
__set_bit(msr, msr_bitmap + 0x800 / f);
}
/*main code in vmx_vcpu_run */
u32 vm_exec=vmcs_read32(CPU_BASED_VM_EXEC_CONTROL);
//printk("CPU_BASED_VM_EXEC_CONTROL:%08x\n",vm_exec);
if((vm_exec&CPU_BASED_USE_MSR_BITMAPS)){
printk("not use msr bitmap,set it!\n");
vm_exec |=CPU_BASED_USE_MSR_BITMAPS;
vmcs_write32(CPU_BASED_VM_EXEC_CONTROL,vm_exec);
}
if((vm_exec&CPU_BASED_USE_MSR_BITMAPS)){
printk("use msr bitmap!\n");
u64 msr_bitmap=vmcs_read64(MSR_BITMAP);
setMsrBitMap(msr_bitmap,0x176,MSR_TYPE_R);
}
thanks in advance!!
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-12-28 3:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-28 3:04 MSR_BITMAP question jack.chen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.