Hello. In my diploma project I'm trying to add VMX to qemu. It is first vmx incarnation, without ept, unrestricted guest and other improvements. It seems working in some way. Virtual Box can execute few hundreds of instructions until crash, but it's tricky for me to build it completely to add some logging features for debug. Because of it I begun debug with kvm. But with kvm problems started in very beginning. I am doing my experiments simultaneously on qemu, modified by me, and real intel machine, artificially restricted to support only first vmx version. When kvm configures guest and enters in it, #PF with 0xfe05b address happens. Kvm on both platforms goes to handle #PF. kvm_mmu_page_fault goes to nonpaging_page_fault, which don't find page in cache and calls nonpaging_map. nonpaging_map exits after critical section before out_unlock label. For me reaction is normal and looks the same on both platforms, but I think problem may be here deeper. After #PF handling kvm enters to guest again and here difference begins. Real machine have new #PF far away from this address, but qemu falls to kvm again with #PF on 0xfe05b. This situation repeats infinitely. Qemu vmcs fields after exit to kvm don't have important differencies (on my view) with Intel vmcs. Some more info I received after logging qemu's address translation. Qemu rises first #PF on first entry to guest (pml4e = 0x3d9fe001 pdpe = 0x0). On second entry to guest, after kvm handling, it rise #PF again (pml4e = 0x3d9fe021 pdpe = 0x3d9fa027 pde = 0x0). Next entries to guest is the same (PF and pml4e = 0x3d9fe021 pdpe = 0x3d9fa027 pde = 0x0). May be someone know, why it is happens and how I can fix my vmx realization, or where I should look.
Thank you.