From aef226a992149007c513e8bbcb4dc2e7b73cc7b9 Mon Sep 17 00:00:00 2001 From: ionescu007 Date: Sun, 28 Aug 2016 23:20:28 -0700 Subject: Fix bug which was causing us to return with hypervisor's RFLAGS This led to interrupts being disabled inside of ShvVpUninitialize, which is why when calling MmFreeContigousMemory, we were sometimes getting hangs, if a TLB flush had to be performed (IPI would not be delivered). Correct restore RFLAGS back to correct guest state. --- shvvmxhv.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/shvvmxhv.c b/shvvmxhv.c index 68a1fbd..886ad0d 100644 --- a/shvvmxhv.c +++ b/shvvmxhv.c @@ -284,12 +284,14 @@ ShvVmxEntryHandler ( __writecr3(ShvVmxRead(GUEST_CR3)); // - // Finally, set the stack and instruction pointer to whatever location - // had the instruction causing our VM-Exit, such as ShvVpUninitialize. - // This will effectively act as a longjmp back to that location. + // Finally, restore the stack, instruction pointer and EFLAGS to the + // original values present when the instruction causing our VM-Exit + // execute (such as ShvVpUninitialize). This will effectively act as + // a longjmp back to that location. // Context->Rsp = guestContext.GuestRsp; Context->Rip = (ULONG64)guestContext.GuestRip; + Context->EFlags = (ULONG)guestContext.GuestEFlags; // // Turn off VMX root mode on this logical processor. We're done here. -- cgit v1.2.3