From ea3c1c77eb230f1b6848378c23723dadd450ac81 Mon Sep 17 00:00:00 2001 From: Stanislav Shwartsman Date: Fri, 9 Oct 2015 06:18:14 +0000 Subject: [PATCH] added vmx consistency checks related to recently implemented support for vm-entering shutdown/wait-for-sipi state --- bochs/cpu/cpu.cc | 5 ----- bochs/cpu/vmx.cc | 8 ++++++++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/bochs/cpu/cpu.cc b/bochs/cpu/cpu.cc index d6e0f53c2..d7beb0464 100644 --- a/bochs/cpu/cpu.cc +++ b/bochs/cpu/cpu.cc @@ -233,11 +233,6 @@ BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::linkTrace(bxInstruction_c *i) bxInstruction_c *next = i->getNextTrace(BX_CPU_THIS_PTR iCache.traceLinkTimeStamp); if (next) { -// bx_address eipBiased = RIP + BX_CPU_THIS_PTR eipPageBias; -// if (eipBiased >= BX_CPU_THIS_PTR eipPageWindowSize) { -// prefetch(); -// } - BX_EXECUTE_INSTRUCTION(next); return; } diff --git a/bochs/cpu/vmx.cc b/bochs/cpu/vmx.cc index cbb160daf..ab3f62565 100644 --- a/bochs/cpu/vmx.cc +++ b/bochs/cpu/vmx.cc @@ -1756,6 +1756,14 @@ Bit32u BX_CPU_C::VMenterLoadCheckGuestState(Bit64u *qualification) return VMX_VMEXIT_VMENTRY_FAILURE_GUEST_STATE; } } + if (guest.activity_state == BX_ACTIVITY_STATE_WAIT_FOR_SIPI) { + BX_ERROR(("VMENTER FAIL: No guest interruptions are allowed when entering Wait-For-Sipi state")); + return VMX_VMEXIT_VMENTRY_FAILURE_GUEST_STATE; + } + if (guest.activity_state == BX_ACTIVITY_STATE_SHUTDOWN && event_type != BX_NMI) { + BX_ERROR(("VMENTER FAIL: No NMI guest interruption is allowed when entering Shotdown state")); + return VMX_VMEXIT_VMENTRY_FAILURE_GUEST_STATE; + } } if (vmentry_ctrls & VMX_VMENTRY_CTRL1_SMM_ENTER) {