MSR_BITMAP question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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!!
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux