Changeset 12763 in vbox
- Timestamp:
- Sep 26, 2008 11:01:01 AM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 37092
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp
r12756 r12763 461 461 uint32_t iGate = VMX_EXIT_INTERRUPTION_INFO_VECTOR(intInfo); 462 462 if (iGate == 0xE) 463 Log 2(("VMXR0InjectEvent: Injecting interrupt %d at %VGv error code=%08x CR2=%08x intInfo=%08x\n", iGate, pCtx->rip, errCode, pCtx->cr2, intInfo));463 LogFlow(("VMXR0InjectEvent: Injecting interrupt %d at %VGv error code=%08x CR2=%08x intInfo=%08x\n", iGate, pCtx->rip, errCode, pCtx->cr2, intInfo)); 464 464 else 465 465 if (iGate < 0x20) 466 Log 2(("VMXR0InjectEvent: Injecting interrupt %d at %VGv error code=%08x\n", iGate, pCtx->rip, errCode));466 LogFlow(("VMXR0InjectEvent: Injecting interrupt %d at %VGv error code=%08x\n", iGate, pCtx->rip, errCode)); 467 467 else 468 468 { 469 Log 2(("INJ-EI: %x at %VGv\n", iGate, pCtx->rip));469 LogFlow(("INJ-EI: %x at %VGv\n", iGate, pCtx->rip)); 470 470 Assert(!VM_FF_ISSET(pVM, VM_FF_INHIBIT_INTERRUPTS)); 471 471 Assert(pCtx->eflags.u32 & X86_EFL_IF); … … 515 515 if (!(pCtx->eflags.u32 & X86_EFL_IF)) 516 516 { 517 Log2(("Enable irq window exit!\n")); 518 pVM->hwaccm.s.vmx.proc_ctls |= VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_IRQ_WINDOW_EXIT; 519 rc = VMXWriteVMCS(VMX_VMCS_CTRL_PROC_EXEC_CONTROLS, pVM->hwaccm.s.vmx.proc_ctls); 520 AssertRC(rc); 517 if (!(pVM->hwaccm.s.vmx.proc_ctls & VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_IRQ_WINDOW_EXIT)) 518 { 519 LogFlow(("Enable irq window exit!\n")); 520 pVM->hwaccm.s.vmx.proc_ctls |= VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_IRQ_WINDOW_EXIT; 521 rc = VMXWriteVMCS(VMX_VMCS_CTRL_PROC_EXEC_CONTROLS, pVM->hwaccm.s.vmx.proc_ctls); 522 AssertRC(rc); 523 } 524 /* else nothing to do but wait */ 521 525 } 522 526 else … … 739 743 if (pVM->hwaccm.s.vmx.enmCurrGuestMode != enmGuestMode) 740 744 { 745 /* Correct weird requirements for switching to protected mode. */ 741 746 if ( pVM->hwaccm.s.vmx.enmCurrGuestMode == PGMMODE_REAL 742 && enmGuestMode == PGMMODE_PROTECTED) 743 { 744 pCtx->csHid.Attr.n.u2Dpl = 0; 745 pCtx->dsHid.Attr.n.u2Dpl = 0; 746 pCtx->esHid.Attr.n.u2Dpl = 0; 747 pCtx->fsHid.Attr.n.u2Dpl = 0; 748 pCtx->gsHid.Attr.n.u2Dpl = 0; 749 pCtx->ssHid.Attr.n.u2Dpl = 0; 747 && enmGuestMode >= PGMMODE_PROTECTED) 748 { 749 /* DPL of all hidden selector registers must match the current CPL (0). */ 750 pCtx->csHid.Attr.n.u2Dpl = 0; 751 pCtx->csHid.Attr.n.u4Type = X86_SEL_TYPE_CODE | X86_SEL_TYPE_RW_ACC; 752 753 pCtx->dsHid.Attr.n.u2Dpl = 0; 754 pCtx->esHid.Attr.n.u2Dpl = 0; 755 pCtx->fsHid.Attr.n.u2Dpl = 0; 756 pCtx->gsHid.Attr.n.u2Dpl = 0; 757 pCtx->ssHid.Attr.n.u2Dpl = 0; 758 759 /* RPL of all selectors must match the current CPL (0). */ 760 pCtx->cs &= ~X86_SEL_RPL; 761 pCtx->ds &= ~X86_SEL_RPL; 762 pCtx->es &= ~X86_SEL_RPL; 763 pCtx->fs &= ~X86_SEL_RPL; 764 pCtx->gs &= ~X86_SEL_RPL; 765 pCtx->ss &= ~X86_SEL_RPL; 766 } 767 else 768 /* Switching from protected mode to real mode. */ 769 if ( pVM->hwaccm.s.vmx.enmCurrGuestMode >= PGMMODE_PROTECTED 770 && enmGuestMode == PGMMODE_REAL) 771 { 772 /* The selector value & base must be adjusted or else... */ 773 pCtx->cs = pCtx->csHid.u64Base >> 4; 774 pCtx->ds = pCtx->dsHid.u64Base >> 4; 775 pCtx->es = pCtx->esHid.u64Base >> 4; 776 pCtx->fs = pCtx->fsHid.u64Base >> 4; 777 pCtx->gs = pCtx->gsHid.u64Base >> 4; 778 pCtx->ss = pCtx->ssHid.u64Base >> 4; 779 780 pCtx->dsHid.u64Base &= 0xfffff; 781 pCtx->esHid.u64Base &= 0xfffff; 782 pCtx->fsHid.u64Base &= 0xfffff; 783 pCtx->gsHid.u64Base &= 0xfffff; 784 750 785 } 751 786 pVM->hwaccm.s.vmx.enmCurrGuestMode = enmGuestMode; … … 1039 1074 { 1040 1075 eflags.Bits.u1VM = 1; 1041 eflags.Bits.u1VIF = pCtx->eflags.Bits.u1IF;1042 1076 eflags.Bits.u2IOPL = 3; 1043 1077 } … … 1613 1647 /* Hide our emulation flags */ 1614 1648 pCtx->eflags.Bits.u1VM = 0; 1615 pCtx->eflags.Bits.u1IF = pCtx->eflags.Bits.u1VIF;1616 pCtx->eflags.Bits.u1VIF = 0;1617 1649 pCtx->eflags.Bits.u2IOPL = 0; 1618 1650 … … 1930 1962 case VMX_EXIT_IRQ_WINDOW: /* 7 Interrupt window. */ 1931 1963 /* Clear VM-exit on IF=1 change. */ 1932 Log 2(("VMX_EXIT_IRQ_WINDOW %VGv\n", pCtx->rip));1964 LogFlow(("VMX_EXIT_IRQ_WINDOW %VGv pending=%d IF=%d\n", pCtx->rip, VM_FF_ISPENDING(pVM, (VM_FF_INTERRUPT_APIC|VM_FF_INTERRUPT_PIC)), pCtx->eflags.Bits.u1IF)); 1933 1965 pVM->hwaccm.s.vmx.proc_ctls &= ~VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_IRQ_WINDOW_EXIT; 1934 1966 rc = VMXWriteVMCS(VMX_VMCS_CTRL_PROC_EXEC_CONTROLS, pVM->hwaccm.s.vmx.proc_ctls);
Note:
See TracChangeset
for help on using the changeset viewer.