jonomango / hv

Lightweight Intel VT-x Hypervisor.
MIT License
409 stars 87 forks source link

__debugbreak() freezing #10

Closed JoeSwansons closed 1 year ago

JoeSwansons commented 1 year ago

I have tried using all sorts of debugging in vmexit and it keeps freezing me, dbgprint, dbgbreak etc

P.S: the irql level is at DISPATCH_LEVEL as recommended by msdn and then restored after sending the dbgprint

is there any sort of vmcs setting that I need to be aware of?

I thought it could be because of the custom idt table, any thoughts?

jonomango commented 1 year ago

Yep, it is freezing because of the custom IDT. This is getting called everytime __debugbreak() is called in root-mode. I'll be adding a logging system soon and I might add a way to temporarily store/restore the guest context so you can call guest functions from root-mode (even though this is incredibly unsafe and prone to crashes).

JoeSwansons commented 1 year ago

Do you know the correct way of handling such an instruction call in the idt?

jonomango commented 1 year ago

Do you know the correct way of handling such an instruction call in the idt?

There is no "correct" way. This is one of the reasons why hypervisor development is so annoying and difficult. Debugging issues that occur in root-mode becomes a nightmare since there is no infrastructure to support it.