DarthTon / HyperBone

Minimalistic VT-x hypervisor with hooks
MIT License
822 stars 262 forks source link

Run in VMware will be fail and BSOD #1

Closed xiaobfly closed 8 years ago

xiaobfly commented 8 years ago

hi.

when I Run in VMware will be fail and BSOD.

I think this problem appeared in inline _IntelRestoreCPU _ function when _StartHV _ fail.

because if StartHV fail but the StopHV have to run, but vmx is not start.

should change Vcpu->VmxState to VMX_STATE_OFF when __vmx_vmlaunch fail in VmxSubvertCPU.

so I add the code in VmxSubvertCPU like this:

    // Setup various VMCS fields by VmxSetupVmcs. This will cause the
    // processor to jump to the return address of RtlCaptureContext in
    // VmxInitializeCPU, which called us.
    InterlockedIncrement( &g_Data->vcpus );
    int res = __vmx_vmlaunch();
    InterlockedDecrement( &g_Data->vcpus );

//if launch fail,set state to off.
Vcpu->VmxState = VMX_STATE_OFF;

StartHV in VMware will be fail but have not BSOD.