- Improved CPU status restore after restoring from Bochs saved image

- Changed many BX_ERROR messages about VMX VMEXIT takesn to BX_DEBUG
This commit is contained in:
Stanislav Shwartsman 2012-05-19 20:36:40 +00:00
parent 2644ef5f63
commit f9540f1c24
8 changed files with 52 additions and 39 deletions

View File

@ -33,6 +33,9 @@ Changes after 2.5.1 release:
- Moved MWAIT_IS_NOP .bochsrc option from CPUID to CPU so it can be set
even if cpu was configured using pre-defined CPUDB profile.
- pcidev: enable support for Linux kernel 3.x (Debian patch by Guillem Jover)
- Added new parameter 'rtc_sync' for the 'clock' option. If this option
is enabled together with the realtime synchronization, the RTC runs
at realtime speed.
- I/O Devices
- Networking
@ -50,6 +53,7 @@ Changes after 2.5.1 release:
- ROM BIOS
- improved PCI boot ROM support (for VGA and other devices)
- added MADT entry for Interrupt Source Override to ACPI tables
- GUI and display libraries
- implemented "auto-off" timer for status LEDs indicating a data transfer
@ -76,6 +80,7 @@ Changes after 2.5.1 release:
[3486555] Fix critical stack leak in Win32 GUI by Carlo Bramini
- these S.F. bugs were closed/fixed
[3526069] MADT:Interrupt Source Override missed
[3518753] update dump after manual chages to memory contents
[3516859] bug in svn e1000 module
[3516029] stepping not working in debugger GUI in case of smp vm

View File

@ -282,7 +282,7 @@ bx_bool BX_CPU_C::handleAsyncEvent(void)
#if BX_SUPPORT_VMX
else if (BX_CPU_THIS_PTR vmx_interrupt_window && BX_CPU_THIS_PTR get_IF()) {
// interrupt-window exiting
BX_ERROR(("VMEXIT: interrupt window exiting"));
BX_DEBUG(("VMEXIT: interrupt window exiting"));
VMexit(0, VMX_VMEXIT_INTERRUPT_WINDOW, 0);
}
#endif

View File

@ -754,18 +754,7 @@ void BX_CPU_C::param_restore(bx_param_c *param, Bit64s val)
void BX_CPU_C::after_restore_state(void)
{
TLB_flush();
#if BX_CPU_LEVEL >= 4
handleAlignmentCheck();
#endif
handleCpuModeChange();
#if BX_CPU_LEVEL >= 6
handleSseModeChange();
#if BX_SUPPORT_AVX
handleAvxModeChange();
#endif
#endif
handleCpuContextChange();
if (BX_CPU_THIS_PTR cpu_mode == BX_MODE_IA32_REAL) CPL = 0;
else {
@ -777,7 +766,6 @@ void BX_CPU_C::after_restore_state(void)
#endif
assert_checks();
invalidate_prefetch_q();
debug(RIP);
}
// end of save/restore functionality

View File

@ -73,7 +73,7 @@ BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::CPUID(bxInstruction_c *i)
#if BX_SUPPORT_VMX
if (BX_CPU_THIS_PTR in_vmx_guest) {
BX_ERROR(("VMEXIT: CPUID in VMX non-root operation"));
BX_DEBUG(("VMEXIT: CPUID in VMX non-root operation"));
VMexit(i, VMX_VMEXIT_CPUID, 0);
}
#endif
@ -226,7 +226,7 @@ BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::WBINVD(bxInstruction_c *i)
{
// CPL is always 0 in real mode
if (/* !real_mode() && */ CPL!=0) {
BX_ERROR(("INVD/WBINVD: priveledge check failed, generate #GP(0)"));
BX_ERROR(("WBINVD: priveledge check failed, generate #GP(0)"));
exception(BX_GP_EXCEPTION, 0);
}
@ -349,7 +349,7 @@ void BX_CPU_C::handleCpuModeChange(void)
#if BX_CPU_LEVEL >= 6
#if BX_SUPPORT_AVX
handleAvxModeChange();
handleAvxModeChange(); /* protected mode reloaded */
#endif
#endif
@ -450,10 +450,6 @@ void BX_CPU_C::handleCpuContextChange(void)
{
TLB_flush();
#if BX_SUPPORT_MONITOR_MWAIT
BX_CPU_THIS_PTR monitor.reset_monitor();
#endif
invalidate_prefetch_q();
invalidate_stack_cache();
#if BX_CPU_LEVEL >= 4
@ -479,7 +475,7 @@ BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::RDPMC(bxInstruction_c *i)
#if BX_SUPPORT_VMX
if (BX_CPU_THIS_PTR in_vmx_guest) {
if (VMEXIT(VMX_VM_EXEC_CTRL2_RDPMC_VMEXIT)) {
BX_ERROR(("VMEXIT: RDPMC"));
BX_DEBUG(("VMEXIT: RDPMC"));
VMexit(i, VMX_VMEXIT_RDPMC, 0);
}
}
@ -554,7 +550,7 @@ BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::RDTSC(bxInstruction_c *i)
#if BX_SUPPORT_VMX
if (BX_CPU_THIS_PTR in_vmx_guest) {
if (VMEXIT(VMX_VM_EXEC_CTRL2_RDTSC_VMEXIT)) {
BX_ERROR(("VMEXIT: RDTSC"));
BX_DEBUG(("VMEXIT: RDTSC"));
VMexit(i, VMX_VMEXIT_RDTSC, 0);
}
}
@ -599,7 +595,7 @@ BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::RDTSCP(bxInstruction_c *i)
#if BX_SUPPORT_VMX
if (BX_CPU_THIS_PTR in_vmx_guest) {
if (VMEXIT(VMX_VM_EXEC_CTRL2_RDTSC_VMEXIT)) {
BX_ERROR(("VMEXIT: RDTSCP"));
BX_DEBUG(("VMEXIT: RDTSCP"));
VMexit(i, VMX_VMEXIT_RDTSCP, 0);
}
}
@ -663,7 +659,7 @@ BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::MONITOR(bxInstruction_c *i)
#if BX_SUPPORT_VMX
if (BX_CPU_THIS_PTR in_vmx_guest) {
if (VMEXIT(VMX_VM_EXEC_CTRL2_MONITOR_VMEXIT)) {
BX_ERROR(("VMEXIT: MONITOR"));
BX_DEBUG(("VMEXIT: MONITOR"));
VMexit(i, VMX_VMEXIT_MONITOR, 0);
}
}
@ -739,7 +735,7 @@ BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::MWAIT(bxInstruction_c *i)
#if BX_SUPPORT_VMX
if (BX_CPU_THIS_PTR in_vmx_guest) {
if (VMEXIT(VMX_VM_EXEC_CTRL2_MWAIT_VMEXIT)) {
BX_ERROR(("VMEXIT: MWAIT"));
BX_DEBUG(("VMEXIT: MWAIT"));
VMexit(i, VMX_VMEXIT_MWAIT, BX_CPU_THIS_PTR monitor.armed);
}
}

View File

@ -225,6 +225,10 @@ void BX_CPU_C::enter_system_management_mode(void)
handleCpuContextChange();
#if BX_SUPPORT_MONITOR_MWAIT
BX_CPU_THIS_PTR monitor.reset_monitor();
#endif
BX_INSTR_TLB_CNTRL(BX_CPU_ID, BX_INSTR_CONTEXT_SWITCH, 0);
}
@ -673,6 +677,10 @@ bx_bool BX_CPU_C::smram_restore_state(const Bit32u *saved_state)
handleCpuContextChange();
#if BX_SUPPORT_MONITOR_MWAIT
BX_CPU_THIS_PTR monitor.reset_monitor();
#endif
BX_INSTR_TLB_CNTRL(BX_CPU_ID, BX_INSTR_CONTEXT_SWITCH, 0);
return 1;

View File

@ -257,6 +257,10 @@ void BX_CPU_C::SvmExitLoadHostState(SVM_HOST_STATE *host)
handleCpuContextChange();
#if BX_SUPPORT_MONITOR_MWAIT
BX_CPU_THIS_PTR monitor.reset_monitor();
#endif
BX_INSTR_TLB_CNTRL(BX_CPU_ID, BX_INSTR_CONTEXT_SWITCH, 0);
}
@ -556,6 +560,10 @@ bx_bool BX_CPU_C::SvmEnterLoadCheckGuestState(void)
handleCpuContextChange();
#if BX_SUPPORT_MONITOR_MWAIT
BX_CPU_THIS_PTR monitor.reset_monitor();
#endif
BX_INSTR_TLB_CNTRL(BX_CPU_ID, BX_INSTR_CONTEXT_SWITCH, 0);
return 1;

View File

@ -145,7 +145,7 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::VMexit_PAUSE(bxInstruction_c *i)
BX_ASSERT(BX_CPU_THIS_PTR in_vmx_guest);
if (VMEXIT(VMX_VM_EXEC_CTRL2_PAUSE_VMEXIT)) {
BX_ERROR(("VMEXIT: PAUSE"));
BX_DEBUG(("VMEXIT: PAUSE"));
VMexit(i, VMX_VMEXIT_PAUSE, 0);
}
@ -257,7 +257,7 @@ void BX_CPU_C::VMexit_Event(bxInstruction_c *i, unsigned type, unsigned vector,
return;
}
BX_ERROR(("VMEXIT: event vector 0x%02x type %d error code=0x%04x", vector, type, errcode));
BX_DEBUG(("VMEXIT: event vector 0x%02x type %d error code=0x%04x", vector, type, errcode));
// VMEXIT is not considered to occur during event delivery if it results
// in a double fault exception that causes VMEXIT directly
@ -346,7 +346,7 @@ void BX_CPP_AttrRegparmN(3) BX_CPU_C::VMexit_MSR(bxInstruction_c *i, unsigned op
}
if (vmexit) {
BX_ERROR(("VMEXIT: %sMSR 0x%08x", (op == VMX_VMEXIT_RDMSR) ? "RD" : "WR", msr));
BX_DEBUG(("VMEXIT: %sMSR 0x%08x", (op == VMX_VMEXIT_RDMSR) ? "RD" : "WR", msr));
VMexit(i, op, 0);
}
}
@ -401,7 +401,7 @@ void BX_CPP_AttrRegparmN(3) BX_CPU_C::VMexit_IO(bxInstruction_c *i, unsigned por
else if (VMEXIT(VMX_VM_EXEC_CTRL2_IO_VMEXIT)) vmexit = 1;
if (vmexit) {
BX_ERROR(("VMEXIT: I/O port 0x%04x", port));
BX_DEBUG(("VMEXIT: I/O port 0x%04x", port));
Bit32u qualification = 0;
@ -495,7 +495,7 @@ bx_bool BX_CPP_AttrRegparmN(1) BX_CPU_C::VMexit_CLTS(bxInstruction_c *i)
if (vm->vm_cr0_mask & vm->vm_cr0_read_shadow & 0x8)
{
BX_ERROR(("VMEXIT: CLTS"));
BX_DEBUG(("VMEXIT: CLTS"));
// all rest of the fields cleared to zero
Bit64u qualification = VMX_VMEXIT_CR_ACCESS_CLTS << 4;
@ -524,7 +524,7 @@ Bit32u BX_CPP_AttrRegparmN(2) BX_CPU_C::VMexit_LMSW(bxInstruction_c *i, Bit32u m
vmexit = 1;
if (vmexit) {
BX_ERROR(("VMEXIT: CR0 write by LMSW of value 0x%04x", msw));
BX_DEBUG(("VMEXIT: CR0 write by LMSW of value 0x%04x", msw));
Bit64u qualification = VMX_VMEXIT_CR_ACCESS_LMSW << 4;
qualification |= msw << 16;
@ -548,7 +548,7 @@ bx_address BX_CPP_AttrRegparmN(2) BX_CPU_C::VMexit_CR0_Write(bxInstruction_c *i,
if ((vm->vm_cr0_mask & vm->vm_cr0_read_shadow) != (vm->vm_cr0_mask & val))
{
BX_ERROR(("VMEXIT: CR0 write"));
BX_DEBUG(("VMEXIT: CR0 write"));
Bit64u qualification = i->rm() << 8;
VMexit(i, VMX_VMEXIT_CR_ACCESS, qualification);
}
@ -562,7 +562,7 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::VMexit_CR3_Read(bxInstruction_c *i)
BX_ASSERT(BX_CPU_THIS_PTR in_vmx_guest);
if (VMEXIT(VMX_VM_EXEC_CTRL2_CR3_READ_VMEXIT)) {
BX_ERROR(("VMEXIT: CR3 read"));
BX_DEBUG(("VMEXIT: CR3 read"));
Bit64u qualification = 3 | (VMX_VMEXIT_CR_ACCESS_CR_READ << 4);
qualification |= (i->rm() << 8);
@ -582,7 +582,7 @@ void BX_CPP_AttrRegparmN(2) BX_CPU_C::VMexit_CR3_Write(bxInstruction_c *i, bx_ad
if (vm->vm_cr3_target_value[n] == val) return;
}
BX_ERROR(("VMEXIT: CR3 write"));
BX_DEBUG(("VMEXIT: CR3 write"));
Bit64u qualification = 3 | (i->rm() << 8);
VMexit(i, VMX_VMEXIT_CR_ACCESS, qualification);
}
@ -596,7 +596,7 @@ bx_address BX_CPP_AttrRegparmN(2) BX_CPU_C::VMexit_CR4_Write(bxInstruction_c *i,
if ((vm->vm_cr4_mask & vm->vm_cr4_read_shadow) != (vm->vm_cr4_mask & val))
{
BX_ERROR(("VMEXIT: CR4 write"));
BX_DEBUG(("VMEXIT: CR4 write"));
Bit64u qualification = 4 | (i->rm() << 8);
VMexit(i, VMX_VMEXIT_CR_ACCESS, qualification);
}
@ -610,7 +610,7 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::VMexit_CR8_Read(bxInstruction_c *i)
BX_ASSERT(BX_CPU_THIS_PTR in_vmx_guest);
if (VMEXIT(VMX_VM_EXEC_CTRL2_CR8_READ_VMEXIT)) {
BX_ERROR(("VMEXIT: CR8 read"));
BX_DEBUG(("VMEXIT: CR8 read"));
Bit64u qualification = 8 | (VMX_VMEXIT_CR_ACCESS_CR_READ << 4);
qualification |= (i->rm() << 8);
@ -624,7 +624,7 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::VMexit_CR8_Write(bxInstruction_c *i)
BX_ASSERT(BX_CPU_THIS_PTR in_vmx_guest);
if (VMEXIT(VMX_VM_EXEC_CTRL2_CR8_WRITE_VMEXIT)) {
BX_ERROR(("VMEXIT: CR8 write"));
BX_DEBUG(("VMEXIT: CR8 write"));
Bit64u qualification = 8 | (i->rm() << 8);
VMexit(i, VMX_VMEXIT_CR_ACCESS, qualification);
}
@ -647,7 +647,7 @@ void BX_CPP_AttrRegparmN(2) BX_CPU_C::VMexit_DR_Access(bxInstruction_c *i, unsig
if (VMEXIT(VMX_VM_EXEC_CTRL2_DRx_ACCESS_VMEXIT))
{
BX_ERROR(("VMEXIT: DR%d %s access", i->nnn(), read ? "READ" : "WRITE"));
BX_DEBUG(("VMEXIT: DR%d %s access", i->nnn(), read ? "READ" : "WRITE"));
Bit64u qualification = i->nnn() | (i->rm() << 8);
if (read)

View File

@ -1639,6 +1639,10 @@ Bit32u BX_CPU_C::VMenterLoadCheckGuestState(Bit64u *qualification)
handleCpuContextChange();
#if BX_SUPPORT_MONITOR_MWAIT
BX_CPU_THIS_PTR monitor.reset_monitor();
#endif
BX_INSTR_TLB_CNTRL(BX_CPU_ID, BX_INSTR_CONTEXT_SWITCH, 0);
return VMXERR_NO_ERROR;
@ -2064,6 +2068,10 @@ void BX_CPU_C::VMexitLoadHostState(void)
handleCpuContextChange();
#if BX_SUPPORT_MONITOR_MWAIT
BX_CPU_THIS_PTR monitor.reset_monitor();
#endif
BX_INSTR_TLB_CNTRL(BX_CPU_ID, BX_INSTR_CONTEXT_SWITCH, 0);
}