Changeset 20838 in vbox
- Timestamp:
- Jun 23, 2009 2:15:46 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
-
include/VBox/hwaccm.h (modified) (1 diff)
-
include/VBox/vm.h (modified) (1 diff)
-
src/VBox/VMM/EM.cpp (modified) (1 diff)
-
src/VBox/VMM/HWACCM.cpp (modified) (2 diffs)
-
src/VBox/VMM/HWACCMInternal.h (modified) (2 diffs)
-
src/VBox/VMM/PDM.cpp (modified) (7 diffs)
-
src/VBox/VMM/VMMR0/HWSVMR0.cpp (modified) (2 diffs)
-
src/VBox/VMM/VMMR0/HWVMXR0.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/hwaccm.h
r20374 r20838 118 118 * @{ 119 119 */ 120 VMMR3DECL(bool) HWACCMR3IsEventPending(PVM pVM);120 VMMR3DECL(bool) HWACCMR3IsEventPending(PVMCPU pVCpu); 121 121 VMMR3DECL(int) HWACCMR3Init(PVM pVM); 122 122 VMMR3DECL(int) HWACCMR3InitCPU(PVM pVM); -
trunk/include/VBox/vm.h
r20835 r20838 302 302 #define VMCPU_FF_TIMER RT_BIT_32(2) 303 303 /** This action forces the VM to check any pending NMIs. */ 304 #define VMCPU_FF_INTERRUPT_NMI RT_BIT_32(3) 304 #define VMCPU_FF_INTERRUPT_NMI_BIT 3 305 #define VMCPU_FF_INTERRUPT_NMI RT_BIT_32(VMCPU_FF_INTERRUPT_NMI_BIT) 305 306 /** This action forces the VM to check any pending SMIs. */ 306 #define VMCPU_FF_INTERRUPT_SMI RT_BIT_32(4) 307 #define VMCPU_FF_INTERRUPT_SMI_BIT 4 308 #define VMCPU_FF_INTERRUPT_SMI RT_BIT_32(VMCPU_FF_INTERRUPT_SMI_BIT) 307 309 /** PDM critical section unlocking is pending, process promptly upon return to R3. */ 308 310 #define VMCPU_FF_PDM_CRITSECT RT_BIT_32(5) -
trunk/src/VBox/VMM/EM.cpp
r20671 r20838 3515 3515 && !TRPMHasTrap(pVCpu) /* an interrupt could already be scheduled for dispatching in the recompiler. */ 3516 3516 && PATMAreInterruptsEnabled(pVM) 3517 && !HWACCMR3IsEventPending(pV M))3517 && !HWACCMR3IsEventPending(pVCpu)) 3518 3518 { 3519 3519 Assert(pVCpu->em.s.enmState != EMSTATE_WAIT_SIPI); -
trunk/src/VBox/VMM/HWACCM.cpp
r20228 r20838 1628 1628 * @param pVM The VM to operate on. 1629 1629 */ 1630 VMMR3DECL(bool) HWACCMR3IsEventPending(PVM pVM) 1631 { 1632 /* @todo SMP */ 1633 return HWACCMIsEnabled(pVM) && pVM->aCpus[0].hwaccm.s.Event.fPending; 1634 } 1635 1636 1637 /** 1638 * Inject an NMI into a running VM 1630 VMMR3DECL(bool) HWACCMR3IsEventPending(PVMCPU pVCpu) 1631 { 1632 return HWACCMIsEnabled(pVCpu->pVMR3) && pVCpu->hwaccm.s.Event.fPending; 1633 } 1634 1635 1636 /** 1637 * Inject an NMI into a running VM (only VCPU 0!) 1639 1638 * 1640 1639 * @returns boolean … … 1643 1642 VMMR3DECL(int) HWACCMR3InjectNMI(PVM pVM) 1644 1643 { 1645 pVM->hwaccm.s.fInjectNMI = true;1644 VMCPU_FF_SET(&pVM->aCpus[0], VMCPU_FF_INTERRUPT_NMI); 1646 1645 return VINF_SUCCESS; 1647 1646 } -
trunk/src/VBox/VMM/HWACCMInternal.h
r20530 r20838 197 197 bool fAllowNestedPaging; 198 198 199 /** Set if we're supposed to inject an NMI. */200 bool fInjectNMI;201 202 199 /** Set if we can support 64-bit guests or not. */ 203 200 bool fAllow64BitGuests; … … 208 205 /** Explicit alignment padding to make 32-bit gcc align u64RegisterMask 209 206 * naturally. */ 210 bool padding[ 1];207 bool padding[2]; 211 208 212 209 /** And mask for copying register contents. */ -
trunk/src/VBox/VMM/PDM.cpp
r20187 r20838 280 280 *******************************************************************************/ 281 281 /** The PDM saved state version. */ 282 #define PDM_SAVED_STATE_VERSION 3 282 #define PDM_SAVED_STATE_VERSION 4 283 #define PDM_SAVED_STATE_VERSION_PRE_NMI_FF 3 283 284 284 285 … … 635 636 * Save interrupt and DMA states. 636 637 */ 637 for (unsigned idCpu =0;idCpu<pVM->cCPUs;idCpu++)638 for (unsigned idCpu = 0; idCpu < pVM->cCPUs; idCpu++) 638 639 { 639 640 PVMCPU pVCpu = &pVM->aCpus[idCpu]; 640 641 SSMR3PutUInt(pSSM, VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INTERRUPT_APIC)); 641 642 SSMR3PutUInt(pSSM, VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INTERRUPT_PIC)); 643 SSMR3PutUInt(pSSM, VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INTERRUPT_NMI)); 644 SSMR3PutUInt(pSSM, VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INTERRUPT_SMI)); 642 645 } 643 646 SSMR3PutUInt(pSSM, VM_FF_ISSET(pVM, VM_FF_PDM_DMA)); … … 699 702 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_APIC); 700 703 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_PIC); 704 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_NMI); 705 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_SMI); 701 706 } 702 707 VM_FF_CLEAR(pVM, VM_FF_PDM_DMA); … … 723 728 * Validate version. 724 729 */ 725 if (u32Version != PDM_SAVED_STATE_VERSION) 730 if ( u32Version != PDM_SAVED_STATE_VERSION 731 && u32Version != PDM_SAVED_STATE_VERSION_PRE_NMI_FF) 726 732 { 727 733 AssertMsgFailed(("pdmR3Load: Invalid version u32Version=%d!\n", u32Version)); … … 732 738 * Load the interrupt and DMA states. 733 739 */ 734 for (unsigned idCpu =0;idCpu<pVM->cCPUs;idCpu++)740 for (unsigned idCpu = 0; idCpu < pVM->cCPUs; idCpu++) 735 741 { 736 742 PVMCPU pVCpu = &pVM->aCpus[idCpu]; … … 763 769 if (fInterruptPending) 764 770 VMCPU_FF_SET(pVCpu, VMCPU_FF_INTERRUPT_PIC); 771 772 if (u32Version > PDM_SAVED_STATE_VERSION_PRE_NMI_FF) 773 { 774 /* NMI interrupt */ 775 RTUINT fInterruptPending = 0; 776 rc = SSMR3GetUInt(pSSM, &fInterruptPending); 777 if (RT_FAILURE(rc)) 778 return rc; 779 if (fInterruptPending & ~1) 780 { 781 AssertMsgFailed(("fInterruptPending=%#x (NMI)\n", fInterruptPending)); 782 return VERR_SSM_DATA_UNIT_FORMAT_CHANGED; 783 } 784 AssertRelease(!VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INTERRUPT_NMI)); 785 if (fInterruptPending) 786 VMCPU_FF_SET(pVCpu, VMCPU_FF_INTERRUPT_NMI); 787 788 /* SMI interrupt */ 789 fInterruptPending = 0; 790 rc = SSMR3GetUInt(pSSM, &fInterruptPending); 791 if (RT_FAILURE(rc)) 792 return rc; 793 if (fInterruptPending & ~1) 794 { 795 AssertMsgFailed(("fInterruptPending=%#x (SMI)\n", fInterruptPending)); 796 return VERR_SSM_DATA_UNIT_FORMAT_CHANGED; 797 } 798 AssertRelease(!VMCPU_FF_ISSET(pVCpu, VMCPU_FF_INTERRUPT_SMI)); 799 if (fInterruptPending) 800 VMCPU_FF_SET(pVCpu, VMCPU_FF_INTERRUPT_SMI); 801 } 765 802 } 766 803 … … 925 962 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_APIC); 926 963 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_PIC); 964 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_NMI); 965 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_SMI); 927 966 } 928 967 VM_FF_CLEAR(pVM, VM_FF_PDM_DMA); -
trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp
r20769 r20838 426 426 } 427 427 428 if ( pVM->hwaccm.s.fInjectNMI)428 if (VMCPU_FF_TESTANDCLEAR(pVCpu, VMCPU_FF_INTERRUPT_NMI_BIT)) 429 429 { 430 430 SVM_EVENT Event; 431 431 432 Log(("CPU%d: injecting #NMI\n", pVCpu->idCpu)); 432 433 Event.n.u8Vector = X86_XCPT_NMI; 433 434 Event.n.u1Valid = 1; … … 436 437 437 438 SVMR0InjectEvent(pVCpu, pVMCB, pCtx, &Event); 438 pVM->hwaccm.s.fInjectNMI = false;439 439 return VINF_SUCCESS; 440 440 } 441 442 /* @todo SMI interrupts. */ 441 443 442 444 /* When external interrupts are pending, we should exit the VM when IF is set. */ -
trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp
r20769 r20838 754 754 } 755 755 756 if ( pVM->hwaccm.s.fInjectNMI)756 if (VMCPU_FF_TESTANDCLEAR(pVCpu, VMCPU_FF_INTERRUPT_NMI_BIT)) 757 757 { 758 758 RTGCUINTPTR intInfo; 759 760 Log(("CPU%d: injecting #NMI\n", pVCpu->idCpu)); 759 761 760 762 intInfo = X86_XCPT_NMI; … … 765 767 AssertRC(rc); 766 768 767 pVM->hwaccm.s.fInjectNMI = false;768 769 return VINF_SUCCESS; 769 770 } 771 772 /* @todo SMI interrupts. */ 770 773 771 774 /* When external interrupts are pending, we should exit the VM when IF is set. */
Note:
See TracChangeset
for help on using the changeset viewer.

