儲存庫 vbox 的更動 19015
- 時間撮記:
- 2009-4-20 上午07:54:29 (16 年 以前)
- 位置:
- trunk
- 檔案:
-
- 修改 26 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/include/VBox/trpm.h
r18927 r19015 74 74 #define TRPM_INVALID_HANDLER 0 75 75 76 VMMDECL(int) TRPMQueryTrap(PVM pVM, uint8_t *pu8TrapNo, PTRPMEVENT pEnmType);77 VMMDECL(uint8_t) TRPMGetTrapNo(PVM pVM);78 VMMDECL(RTGCUINT) TRPMGetErrorCode(PVM pVM);79 VMMDECL(RTGCUINTPTR) TRPMGetFaultAddress(PVM pVM);80 VMMDECL(int) TRPMResetTrap(PVM pVM);81 VMMDECL(int) TRPMAssertTrap(PVM pVM, uint8_t u8TrapNo, TRPMEVENT enmType);82 VMMDECL(void) TRPMSetErrorCode(PVM pVM, RTGCUINT uErrorCode);83 VMMDECL(void) TRPMSetFaultAddress(PVM pVM, RTGCUINTPTR uCR2);84 VMMDECL(bool) TRPMIsSoftwareInterrupt(PVM pVM);85 VMMDECL(bool) TRPMHasTrap(PVM pVM);86 VMMDECL(int) TRPMQueryTrapAll(PVM pVM, uint8_t *pu8TrapNo, PTRPMEVENT pEnmType, PRTGCUINT puErrorCode, PRTGCUINTPTR puCR2);87 VMMDECL(void) TRPMSaveTrap(PVM pVM);88 VMMDECL(void) TRPMRestoreTrap(PVM pVM);89 VMMDECL(int) TRPMForwardTrap(PVM pVM, PCPUMCTXCORE pRegFrame, uint32_t iGate, uint32_t opsize, TRPMERRORCODE enmError, TRPMEVENT enmType, int32_t iOrgTrap);90 VMMDECL(int) TRPMRaiseXcpt(PVM pVM, PCPUMCTXCORE pCtxCore, X86XCPT enmXcpt);91 VMMDECL(int) TRPMRaiseXcptErr(PVM pVM, PCPUMCTXCORE pCtxCore, X86XCPT enmXcpt, uint32_t uErr);92 VMMDECL(int) TRPMRaiseXcptErrCR2(PVM pVM, PCPUMCTXCORE pCtxCore, X86XCPT enmXcpt, uint32_t uErr, RTGCUINTPTR uCR2);76 VMMDECL(int) TRPMQueryTrap(PVMCPU pVCpu, uint8_t *pu8TrapNo, PTRPMEVENT pEnmType); 77 VMMDECL(uint8_t) TRPMGetTrapNo(PVMCPU pVCpu); 78 VMMDECL(RTGCUINT) TRPMGetErrorCode(PVMCPU pVCpu); 79 VMMDECL(RTGCUINTPTR) TRPMGetFaultAddress(PVMCPU pVCpu); 80 VMMDECL(int) TRPMResetTrap(PVMCPU pVCpu); 81 VMMDECL(int) TRPMAssertTrap(PVMCPU pVCpu, uint8_t u8TrapNo, TRPMEVENT enmType); 82 VMMDECL(void) TRPMSetErrorCode(PVMCPU pVCpu, RTGCUINT uErrorCode); 83 VMMDECL(void) TRPMSetFaultAddress(PVMCPU pVCpu, RTGCUINTPTR uCR2); 84 VMMDECL(bool) TRPMIsSoftwareInterrupt(PVMCPU pVCpu); 85 VMMDECL(bool) TRPMHasTrap(PVMCPU pVCpu); 86 VMMDECL(int) TRPMQueryTrapAll(PVMCPU pVCpu, uint8_t *pu8TrapNo, PTRPMEVENT pEnmType, PRTGCUINT puErrorCode, PRTGCUINTPTR puCR2); 87 VMMDECL(void) TRPMSaveTrap(PVMCPU pVCpu); 88 VMMDECL(void) TRPMRestoreTrap(PVMCPU pVCpu); 89 VMMDECL(int) TRPMForwardTrap(PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, uint32_t iGate, uint32_t opsize, TRPMERRORCODE enmError, TRPMEVENT enmType, int32_t iOrgTrap); 90 VMMDECL(int) TRPMRaiseXcpt(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, X86XCPT enmXcpt); 91 VMMDECL(int) TRPMRaiseXcptErr(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, X86XCPT enmXcpt, uint32_t uErr); 92 VMMDECL(int) TRPMRaiseXcptErrCR2(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, X86XCPT enmXcpt, uint32_t uErr, RTGCUINTPTR uCR2); 93 93 94 94 -
trunk/include/VBox/vm.h
r18927 r19015 150 150 char padding[2048]; /* multiple of 64 */ 151 151 } em; 152 153 /** TRPM part. */ 154 union 155 { 156 #ifdef ___TRPMInternal_h 157 struct TRPMCPU s; 158 #endif 159 char padding[64]; /* multiple of 64 */ 160 } trpm; 152 161 153 162 /** TM part. */ -
trunk/src/VBox/VMM/EM.cpp
r19006 r19015 1552 1552 RTGCUINT uErrorCode; 1553 1553 RTGCUINTPTR uCR2; 1554 int rc = TRPMQueryTrapAll(pV M, &u8TrapNo, &enmType, &uErrorCode, &uCR2);1554 int rc = TRPMQueryTrapAll(pVCpu, &u8TrapNo, &enmType, &uErrorCode, &uCR2); 1555 1555 if (RT_FAILURE(rc)) 1556 1556 { … … 1609 1609 ? TRPM_TRAP_HAS_ERRORCODE 1610 1610 : TRPM_TRAP_NO_ERRORCODE; 1611 rc = TRPMForwardTrap(pV M, CPUMCTX2CORE(pCtx), u8TrapNo, uErrorCode, enmError, TRPM_TRAP, -1);1611 rc = TRPMForwardTrap(pVCpu, CPUMCTX2CORE(pCtx), u8TrapNo, uErrorCode, enmError, TRPM_TRAP, -1); 1612 1612 if (rc == VINF_SUCCESS /* Don't use RT_SUCCESS */) 1613 1613 { 1614 TRPMResetTrap(pV M);1614 TRPMResetTrap(pVCpu); 1615 1615 return VINF_EM_RESCHEDULE_RAW; 1616 1616 } … … 1647 1647 if (u32ExtFeatures & X86_CPUID_FEATURE_ECX_MONITOR) 1648 1648 { 1649 rc = TRPMResetTrap(pV M);1649 rc = TRPMResetTrap(pVCpu); 1650 1650 AssertRC(rc); 1651 1651 … … 1681 1681 * lazy approach really makes things worse. 1682 1682 */ 1683 rc = TRPMResetTrap(pV M);1683 rc = TRPMResetTrap(pVCpu); 1684 1684 AssertRC(rc); 1685 1685 return emR3RawExecuteInstruction(pVM, pVCpu, "IO Guest Trap: "); … … 1806 1806 else 1807 1807 { 1808 rc = TRPMQueryTrapAll(pV M, &u8TrapNo, &enmType, &uErrorCode, &uCR2);1808 rc = TRPMQueryTrapAll(pVCpu, &u8TrapNo, &enmType, &uErrorCode, &uCR2); 1809 1809 if (RT_FAILURE(rc)) 1810 1810 { … … 1813 1813 } 1814 1814 /* Reset the trap as we'll execute the original instruction again. */ 1815 TRPMResetTrap(pV M);1815 TRPMResetTrap(pVCpu); 1816 1816 } 1817 1817 … … 2387 2387 case VINF_EM_RAW_INTERRUPT_PENDING: 2388 2388 case VINF_EM_RAW_RING_SWITCH_INT: 2389 Assert(TRPMHasTrap(pV M));2389 Assert(TRPMHasTrap(pVCpu)); 2390 2390 Assert(!PATMIsPatchGCAddr(pVM, (RTGCPTR)pCtx->eip)); 2391 2391 2392 if (TRPMHasTrap(pV M))2392 if (TRPMHasTrap(pVCpu)) 2393 2393 { 2394 2394 /* If the guest gate is marked unpatched, then we will check again if we can patch it. */ 2395 uint8_t u8Interrupt = TRPMGetTrapNo(pV M);2395 uint8_t u8Interrupt = TRPMGetTrapNo(pVCpu); 2396 2396 if (TRPMR3GetGuestTrapHandler(pVM, u8Interrupt) == TRPM_INVALID_HANDLER) 2397 2397 { … … 2965 2965 * Log important stuff before entering GC. 2966 2966 */ 2967 if (TRPMHasTrap(pV M))2968 Log(("Pending hardware interrupt=0x%x cs:rip=%04X:%RGv\n", TRPMGetTrapNo(pV M), pCtx->cs, (RTGCPTR)pCtx->rip));2967 if (TRPMHasTrap(pVCpu)) 2968 Log(("Pending hardware interrupt=0x%x cs:rip=%04X:%RGv\n", TRPMGetTrapNo(pVCpu), pCtx->cs, (RTGCPTR)pCtx->rip)); 2969 2969 2970 2970 uint32_t cpl = CPUMGetGuestCPL(pVCpu, CPUMCTX2CORE(pCtx)); … … 3387 3387 if ( !VM_FF_ISPENDING(pVM, VM_FF_INHIBIT_INTERRUPTS | VM_FF_PGM_NO_MEMORY) 3388 3388 && (!rc || rc >= VINF_EM_RESCHEDULE_HWACC) 3389 && !TRPMHasTrap(pV M) /* an interrupt could already be scheduled for dispatching in the recompiler. */3389 && !TRPMHasTrap(pVCpu) /* an interrupt could already be scheduled for dispatching in the recompiler. */ 3390 3390 && PATMAreInterruptsEnabled(pVM) 3391 3391 && !HWACCMR3IsEventPending(pVM)) -
trunk/src/VBox/VMM/PDMLdr.cpp
r18431 r19015 336 336 else if (!strcmp(pszSymbol, "g_TRPM")) 337 337 *pValue = VM_RC_ADDR(pVM, &pVM->trpm); 338 else if (!strcmp(pszSymbol, "g_TRPMCPU")) 339 *pValue = VM_RC_ADDR(pVM, &pVM->aCpus[0].trpm); 338 340 else if ( !strncmp(pszSymbol, "VMM", 3) 339 341 || !strcmp(pszSymbol, "g_Logger") -
trunk/src/VBox/VMM/TRPM.cpp
r18927 r19015 431 431 432 432 /** TRPM saved state version. */ 433 #define TRPM_SAVED_STATE_VERSION 8 433 #define TRPM_SAVED_STATE_VERSION 9 434 #define TRPM_SAVED_STATE_VERSION_UNI 8 /* SMP support bumped the version */ 434 435 435 436 … … 464 465 */ 465 466 pVM->trpm.s.offVM = RT_OFFSETOF(VM, trpm); 466 pVM->trpm.s.uActiveVector = ~0; 467 pVM->trpm.s.offTRPMCPU = RT_OFFSETOF(VM, aCpus[0].trpm) - RT_OFFSETOF(VM, trpm); 468 469 for (unsigned i=0;i<pVM->cCPUs;i++) 470 { 471 PVMCPU pVCpu = &pVM->aCpus[i]; 472 473 pVCpu->trpm.s.offVM = RT_OFFSETOF(VM, aCpus[i].trpm); 474 pVCpu->trpm.s.uActiveVector = ~0; 475 } 476 467 477 pVM->trpm.s.GuestIdtr.pIdt = RTRCPTR_MAX; 468 478 pVM->trpm.s.pvMonShwIdtRC = RTRCPTR_MAX; … … 731 741 * Reinitialize other members calling the relocator to get things right. 732 742 */ 733 pVM->trpm.s.uActiveVector = ~0; 743 for (unsigned i=0;i<pVM->cCPUs;i++) 744 { 745 PVMCPU pVCpu = &pVM->aCpus[i]; 746 pVCpu->trpm.s.uActiveVector = ~0; 747 } 734 748 memcpy(&pVM->trpm.s.aIdt[0], &g_aIdt[0], sizeof(pVM->trpm.s.aIdt)); 735 749 memset(pVM->trpm.s.aGuestTrapHandler, 0, sizeof(pVM->trpm.s.aGuestTrapHandler)); … … 752 766 static DECLCALLBACK(int) trpmR3Save(PVM pVM, PSSMHANDLE pSSM) 753 767 { 768 PTRPM pTrpm = &pVM->trpm.s; 754 769 LogFlow(("trpmR3Save:\n")); 755 770 … … 757 772 * Active and saved traps. 758 773 */ 759 PTRPM pTrpm = &pVM->trpm.s; 760 SSMR3PutUInt(pSSM, pTrpm->uActiveVector); 761 SSMR3PutUInt(pSSM, pTrpm->enmActiveType); 762 SSMR3PutGCUInt(pSSM, pTrpm->uActiveErrorCode); 763 SSMR3PutGCUIntPtr(pSSM, pTrpm->uActiveCR2); 764 SSMR3PutGCUInt(pSSM, pTrpm->uSavedVector); 765 SSMR3PutUInt(pSSM, pTrpm->enmSavedType); 766 SSMR3PutGCUInt(pSSM, pTrpm->uSavedErrorCode); 767 SSMR3PutGCUIntPtr(pSSM, pTrpm->uSavedCR2); 768 SSMR3PutGCUInt(pSSM, pTrpm->uPrevVector); 769 #if 0 /** @todo Enable this (+ load change) on the next version change. */ 774 for (unsigned i=0;i<pVM->cCPUs;i++) 775 { 776 PTRPMCPU pTrpmCpu = &pVM->aCpus[i].trpm.s; 777 778 SSMR3PutUInt(pSSM, pTrpmCpu->uActiveVector); 779 SSMR3PutUInt(pSSM, pTrpmCpu->enmActiveType); 780 SSMR3PutGCUInt(pSSM, pTrpmCpu->uActiveErrorCode); 781 SSMR3PutGCUIntPtr(pSSM, pTrpmCpu->uActiveCR2); 782 SSMR3PutGCUInt(pSSM, pTrpmCpu->uSavedVector); 783 SSMR3PutUInt(pSSM, pTrpmCpu->enmSavedType); 784 SSMR3PutGCUInt(pSSM, pTrpmCpu->uSavedErrorCode); 785 SSMR3PutGCUIntPtr(pSSM, pTrpmCpu->uSavedCR2); 786 SSMR3PutGCUInt(pSSM, pTrpmCpu->uPrevVector); 787 } 770 788 SSMR3PutBool(pSSM, pTrpm->fDisableMonitoring); 771 #else772 SSMR3PutGCUInt(pSSM, pTrpm->fDisableMonitoring);773 #endif774 789 SSMR3PutUInt(pSSM, VM_FF_ISSET(pVM, VM_FF_TRPM_SYNC_IDT)); 775 790 SSMR3PutMem(pSSM, &pTrpm->au32IdtPatched[0], sizeof(pTrpm->au32IdtPatched)); … … 808 823 * Validate version. 809 824 */ 810 if (u32Version != TRPM_SAVED_STATE_VERSION) 825 if ( u32Version != TRPM_SAVED_STATE_VERSION 826 && u32Version != TRPM_SAVED_STATE_VERSION_UNI) 811 827 { 812 828 AssertMsgFailed(("trpmR3Load: Invalid version u32Version=%d!\n", u32Version)); … … 823 839 */ 824 840 PTRPM pTrpm = &pVM->trpm.s; 825 SSMR3GetUInt(pSSM, &pTrpm->uActiveVector); 826 SSMR3GetUInt(pSSM, (uint32_t *)&pTrpm->enmActiveType); 827 SSMR3GetGCUInt(pSSM, &pTrpm->uActiveErrorCode); 828 SSMR3GetGCUIntPtr(pSSM, &pTrpm->uActiveCR2); 829 SSMR3GetGCUInt(pSSM, &pTrpm->uSavedVector); 830 SSMR3GetUInt(pSSM, (uint32_t *)&pTrpm->enmSavedType); 831 SSMR3GetGCUInt(pSSM, &pTrpm->uSavedErrorCode); 832 SSMR3GetGCUIntPtr(pSSM, &pTrpm->uSavedCR2); 833 SSMR3GetGCUInt(pSSM, &pTrpm->uPrevVector); 834 #if 0 /** @todo Enable this + the corresponding save code on the next version change. */ 835 SSMR3GetBool(pSSM, &pTrpm->fDisableMonitoring); 836 #else 837 RTGCUINT fDisableMonitoring; 838 SSMR3GetGCUInt(pSSM, &fDisableMonitoring); 839 pTrpm->fDisableMonitoring = !!fDisableMonitoring; 840 #endif 841 842 if (u32Version == TRPM_SAVED_STATE_VERSION) 843 { 844 for (unsigned i=0;i<pVM->cCPUs;i++) 845 { 846 PTRPMCPU pTrpmCpu = &pVM->aCpus[i].trpm.s; 847 SSMR3GetUInt(pSSM, &pTrpmCpu->uActiveVector); 848 SSMR3GetUInt(pSSM, (uint32_t *)&pTrpmCpu->enmActiveType); 849 SSMR3GetGCUInt(pSSM, &pTrpmCpu->uActiveErrorCode); 850 SSMR3GetGCUIntPtr(pSSM, &pTrpmCpu->uActiveCR2); 851 SSMR3GetGCUInt(pSSM, &pTrpmCpu->uSavedVector); 852 SSMR3GetUInt(pSSM, (uint32_t *)&pTrpmCpu->enmSavedType); 853 SSMR3GetGCUInt(pSSM, &pTrpmCpu->uSavedErrorCode); 854 SSMR3GetGCUIntPtr(pSSM, &pTrpmCpu->uSavedCR2); 855 SSMR3GetGCUInt(pSSM, &pTrpmCpu->uPrevVector); 856 } 857 858 SSMR3GetBool(pSSM, &pVM->trpm.s.fDisableMonitoring); 859 } 860 else 861 { 862 PTRPMCPU pTrpmCpu = &pVM->aCpus[0].trpm.s; 863 SSMR3GetUInt(pSSM, &pTrpmCpu->uActiveVector); 864 SSMR3GetUInt(pSSM, (uint32_t *)&pTrpmCpu->enmActiveType); 865 SSMR3GetGCUInt(pSSM, &pTrpmCpu->uActiveErrorCode); 866 SSMR3GetGCUIntPtr(pSSM, &pTrpmCpu->uActiveCR2); 867 SSMR3GetGCUInt(pSSM, &pTrpmCpu->uSavedVector); 868 SSMR3GetUInt(pSSM, (uint32_t *)&pTrpmCpu->enmSavedType); 869 SSMR3GetGCUInt(pSSM, &pTrpmCpu->uSavedErrorCode); 870 SSMR3GetGCUIntPtr(pSSM, &pTrpmCpu->uSavedCR2); 871 SSMR3GetGCUInt(pSSM, &pTrpmCpu->uPrevVector); 872 873 RTGCUINT fDisableMonitoring; 874 SSMR3GetGCUInt(pSSM, &fDisableMonitoring); 875 pTrpm->fDisableMonitoring = !!fDisableMonitoring; 876 } 841 877 842 878 RTUINT fSyncIDT; … … 1417 1453 if (HWACCMR3IsActive(pVM)) 1418 1454 { 1419 rc = TRPMAssertTrap(pV M, u8Interrupt, enmEvent);1455 rc = TRPMAssertTrap(pVCpu, u8Interrupt, enmEvent); 1420 1456 AssertRC(rc); 1421 1457 STAM_COUNTER_INC(&pVM->trpm.s.paStatForwardedIRQR3[u8Interrupt]); … … 1436 1472 { 1437 1473 /* There's a handler -> let's execute it in raw mode */ 1438 rc = TRPMForwardTrap(pV M, CPUMCTX2CORE(pCtx), u8Interrupt, 0, TRPM_TRAP_NO_ERRORCODE, enmEvent, -1);1474 rc = TRPMForwardTrap(pVCpu, CPUMCTX2CORE(pCtx), u8Interrupt, 0, TRPM_TRAP_NO_ERRORCODE, enmEvent, -1); 1439 1475 if (rc == VINF_SUCCESS /* Don't use RT_SUCCESS */) 1440 1476 { -
trunk/src/VBox/VMM/TRPMInternal.h
r14515 r19015 74 74 #define TRPM2VM(pTRPM) ( (PVM)((char*)pTRPM - pTRPM->offVM) ) 75 75 76 /** 77 * Converts a TRPMCPU pointer into a VM pointer. 78 * @returns Pointer to the VM structure the TRPMCPU is part of. 79 * @param pTRPM Pointer to TRPMCPU instance data. 80 */ 81 #define TRPMCPU2VM(pTrpmCpu) ( (PVM)((char*)pTrpmCpu - pTrpmCpu->offVM) ) 82 83 /** 84 * Converts a TRPM pointer into a TRPMCPU pointer. 85 * @returns Pointer to the VM structure the TRPMCPU is part of. 86 * @param pTRPM Pointer to TRPMCPU instance data. 87 */ 88 #define TRPM2TRPMCPU(pTrpmCpu) ( (PTRPMCPU)((char*)pTrpmCpu + pTrpmCpu->offTRPMCPU) ) 76 89 77 90 /** … … 86 99 * See TRPM2VM(). */ 87 100 RTINT offVM; 88 89 /** Active Interrupt or trap vector number. 90 * If not ~0U this indicates that we're currently processing 91 * a interrupt, trap, fault, abort, whatever which have arrived 92 * at that vector number. 93 */ 94 RTUINT uActiveVector; 95 96 /** Active trap type. */ 97 TRPMEVENT enmActiveType; 98 99 /** Errorcode for the active interrupt/trap. */ 100 RTGCUINT uActiveErrorCode; /**< @todo don't use RTGCUINT */ 101 102 /** CR2 at the time of the active exception. */ 103 RTGCUINTPTR uActiveCR2; 104 105 /** Saved trap vector number. */ 106 RTGCUINT uSavedVector; /**< @todo don't use RTGCUINT */ 107 108 /** Saved trap type. */ 109 TRPMEVENT enmSavedType; 110 111 /** Saved errorcode. */ 112 RTGCUINT uSavedErrorCode; 113 114 /** Saved cr2. */ 115 RTGCUINTPTR uSavedCR2; 116 117 /** Previous trap vector # - for debugging. */ 118 RTGCUINT uPrevVector; 101 /** Offset to the TRPMCPU structure. 102 * See TRPM2TRPMCPU(). */ 103 RTINT offTRPMCPU; 119 104 120 105 /** IDT monitoring and sync flag (HWACC). */ … … 136 121 137 122 /** Padding to get the IDTs at a 16 byte alignement. */ 138 #if GC_ARCH_BITS == 32139 123 uint8_t abPadding1[6]; 140 #else141 uint8_t abPadding1[14];142 #endif143 124 /** IDTs. Aligned at 16 byte offset for speed. */ 144 125 VBOXIDTE aIdt[256]; … … 190 171 #endif 191 172 } TRPM; 192 #pragma pack()193 173 194 174 /** Pointer to TRPM Data. */ 195 175 typedef TRPM *PTRPM; 176 177 178 typedef struct TRPMCPU 179 { 180 /** Offset to the VM structure. 181 * See TRPMCPU2VM(). */ 182 RTINT offVM; 183 /** Active Interrupt or trap vector number. 184 * If not ~0U this indicates that we're currently processing 185 * a interrupt, trap, fault, abort, whatever which have arrived 186 * at that vector number. 187 */ 188 RTUINT uActiveVector; 189 190 /** Active trap type. */ 191 TRPMEVENT enmActiveType; 192 193 /** Errorcode for the active interrupt/trap. */ 194 RTGCUINT uActiveErrorCode; /**< @todo don't use RTGCUINT */ 195 196 /** CR2 at the time of the active exception. */ 197 RTGCUINTPTR uActiveCR2; 198 199 /** Saved trap vector number. */ 200 RTGCUINT uSavedVector; /**< @todo don't use RTGCUINT */ 201 202 /** Saved trap type. */ 203 TRPMEVENT enmSavedType; 204 205 /** Saved errorcode. */ 206 RTGCUINT uSavedErrorCode; 207 208 /** Saved cr2. */ 209 RTGCUINTPTR uSavedCR2; 210 211 /** Previous trap vector # - for debugging. */ 212 RTGCUINT uPrevVector; 213 } TRPMCPU; 214 215 /** Pointer to TRPMCPU Data. */ 216 typedef TRPMCPU *PTRPMCPU; 217 218 #pragma pack() 219 196 220 197 221 VMMRCDECL(int) trpmRCGuestIDTWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange); -
trunk/src/VBox/VMM/TRPMInternal.mac
r14351 r19015 34 34 struc TRPM 35 35 .offVM resd 1 36 .uActiveVector resd 1 37 .enmActiveType resd 1 38 .uActiveErrorCode RTGCPTR_RES 1 39 .uActiveCR2 RTGCPTR_RES 1 40 .uSavedVector RTGCPTR_RES 1 41 .enmSavedType resd 1 42 .uSavedErrorCode RTGCPTR_RES 1 43 .uSavedCR2 RTGCPTR_RES 1 44 .uPrevVector RTGCPTR_RES 1 36 .offTRPMCPU resd 1 45 37 .fDisableMonitoring resb 1 46 38 .fSafeToDropGuestIDTMonitoring resb 1 47 %if GC_ARCH_BITS == 3248 39 .abPadding1 resb 6 49 %else50 .abPadding1 resb 1451 %endif52 40 .aIdt resd 512 53 41 .au32IdtPatched resd 8 … … 80 68 .paStatForwardedIRQRC RTRCPTR_RES 1 81 69 %endif 70 endstruc 71 72 struc TRPMCPU 73 .offVM resd 1 74 .uActiveVector resd 1 75 .enmActiveType resd 1 76 .uActiveErrorCode RTGCPTR_RES 1 77 .uActiveCR2 RTGCPTR_RES 1 78 .uSavedVector RTGCPTR_RES 1 79 .enmSavedType resd 1 80 .uSavedErrorCode RTGCPTR_RES 1 81 .uSavedCR2 RTGCPTR_RES 1 82 .uPrevVector RTGCPTR_RES 1 82 83 endstruc 83 84 -
trunk/src/VBox/VMM/VMMAll/EMAll.cpp
r18992 r19015 451 451 452 452 #ifdef IN_RC 453 if (TRPMHasTrap(pV M))454 { 455 if (TRPMGetErrorCode(pV M) & X86_TRAP_PF_RW)453 if (TRPMHasTrap(pVCpu)) 454 { 455 if (TRPMGetErrorCode(pVCpu) & X86_TRAP_PF_RW) 456 456 { 457 457 #endif … … 580 580 581 581 #ifdef IN_RC 582 if (TRPMHasTrap(pV M))583 { 584 if (TRPMGetErrorCode(pV M) & X86_TRAP_PF_RW)582 if (TRPMHasTrap(pVCpu)) 583 { 584 if (TRPMGetErrorCode(pVCpu) & X86_TRAP_PF_RW) 585 585 { 586 586 #endif … … 648 648 649 649 #ifdef IN_RC 650 if (TRPMHasTrap(pV M))651 { 652 if (TRPMGetErrorCode(pV M) & X86_TRAP_PF_RW)650 if (TRPMHasTrap(pVCpu)) 651 { 652 if (TRPMGetErrorCode(pVCpu) & X86_TRAP_PF_RW) 653 653 { 654 654 #endif … … 733 733 734 734 #ifdef IN_RC 735 if (TRPMHasTrap(pV M))736 { 737 if (TRPMGetErrorCode(pV M) & X86_TRAP_PF_RW)735 if (TRPMHasTrap(pVCpu)) 736 { 737 if (TRPMGetErrorCode(pVCpu) & X86_TRAP_PF_RW) 738 738 { 739 739 #endif … … 845 845 #ifdef IN_RC 846 846 /* Safety check (in theory it could cross a page boundary and fault there though) */ 847 Assert( TRPMHasTrap(pV M)848 && (TRPMGetErrorCode(pV M) & X86_TRAP_PF_RW));847 Assert( TRPMHasTrap(pVCpu) 848 && (TRPMGetErrorCode(pVCpu) & X86_TRAP_PF_RW)); 849 849 EM_ASSERT_FAULT_RETURN(GCPtrPar1 == pvFault, VERR_EM_INTERPRETER); 850 850 #endif … … 911 911 912 912 #ifdef IN_RC 913 if (TRPMHasTrap(pV M))914 { 915 if (TRPMGetErrorCode(pV M) & X86_TRAP_PF_RW)913 if (TRPMHasTrap(pVCpu)) 914 { 915 if (TRPMGetErrorCode(pVCpu) & X86_TRAP_PF_RW) 916 916 { 917 917 #endif … … 1015 1015 1016 1016 #ifdef IN_RC 1017 if (TRPMHasTrap(pV M))1018 { 1019 if (TRPMGetErrorCode(pV M) & X86_TRAP_PF_RW)1017 if (TRPMHasTrap(pVCpu)) 1018 { 1019 if (TRPMGetErrorCode(pVCpu) & X86_TRAP_PF_RW) 1020 1020 { 1021 1021 #endif … … 1111 1111 GCPtrPar1 = emConvertToFlatAddr(pVM, pRegFrame, pDISState, &pDISState->param1, GCPtrPar1); 1112 1112 #ifdef IN_RC 1113 Assert(TRPMHasTrap(pV M));1113 Assert(TRPMHasTrap(pVCpu)); 1114 1114 EM_ASSERT_FAULT_RETURN((RTGCPTR)((RTGCUINTPTR)GCPtrPar1 & ~(RTGCUINTPTR)3) == pvFault, VERR_EM_INTERPRETER); 1115 1115 #endif … … 1169 1169 1170 1170 #ifdef IN_RC 1171 if (TRPMHasTrap(pV M))1172 { 1173 if (TRPMGetErrorCode(pV M) & X86_TRAP_PF_RW)1171 if (TRPMHasTrap(pVCpu)) 1172 { 1173 if (TRPMGetErrorCode(pVCpu) & X86_TRAP_PF_RW) 1174 1174 { 1175 1175 #else … … 1582 1582 return VERR_EM_INTERPRETER; 1583 1583 1584 if (TRPMHasTrap(pV M))1585 { 1586 if (TRPMGetErrorCode(pV M) & X86_TRAP_PF_RW)1584 if (TRPMHasTrap(pVCpu)) 1585 { 1586 if (TRPMGetErrorCode(pVCpu) & X86_TRAP_PF_RW) 1587 1587 { 1588 1588 RTRCPTR pParam1; … … 1654 1654 return VERR_EM_INTERPRETER; 1655 1655 1656 if (TRPMHasTrap(pV M))1657 { 1658 if (TRPMGetErrorCode(pV M) & X86_TRAP_PF_RW)1656 if (TRPMHasTrap(pVCpu)) 1657 { 1658 if (TRPMGetErrorCode(pVCpu) & X86_TRAP_PF_RW) 1659 1659 { 1660 1660 RTRCPTR pParam1; … … 1725 1725 return VERR_EM_INTERPRETER; 1726 1726 1727 if (TRPMHasTrap(pV M))1728 { 1729 if (TRPMGetErrorCode(pV M) & X86_TRAP_PF_RW)1727 if (TRPMHasTrap(pVCpu)) 1728 { 1729 if (TRPMGetErrorCode(pVCpu) & X86_TRAP_PF_RW) 1730 1730 { 1731 1731 RTRCPTR pParam1; -
trunk/src/VBox/VMM/VMMAll/IOMAll.cpp
r18927 r19015 736 736 { 737 737 Log(("iomInterpretCheckPortIOAccess: Port=%RTiop cb=%d %Rrc -> #GP(0)\n", Port, cb, rc)); 738 return TRPMRaiseXcptErr(pV M, pCtxCore, X86_XCPT_GP, 0);738 return TRPMRaiseXcptErr(pVCpu, pCtxCore, X86_XCPT_GP, 0); 739 739 } 740 740 … … 744 744 Log(("iomInterpretCheckPortIOAccess: Port=%RTiop cb=%d cbTss=%#x fCanHaveIOBitmap=%RTbool -> #GP(0)\n", 745 745 Port, cb, cbTss, fCanHaveIOBitmap)); 746 return TRPMRaiseXcptErr(pV M, pCtxCore, X86_XCPT_GP, 0);746 return TRPMRaiseXcptErr(pVCpu, pCtxCore, X86_XCPT_GP, 0); 747 747 } 748 748 … … 767 767 Log(("iomInterpretCheckPortIOAccess: Port=%RTiop cb=%d offTss=%#x cbTss=%#x -> #GP(0)\n", 768 768 Port, cb, offTss, cbTss)); 769 return TRPMRaiseXcptErr(pV M, pCtxCore, X86_XCPT_GP, 0);769 return TRPMRaiseXcptErr(pVCpu, pCtxCore, X86_XCPT_GP, 0); 770 770 } 771 771 uint16_t u16; … … 785 785 Log(("iomInterpretCheckPortIOAccess: Port=%RTiop cb=%d u16=%#x -> #GP(0)\n", 786 786 Port, cb, u16, offTss)); 787 return TRPMRaiseXcptErr(pV M, pCtxCore, X86_XCPT_GP, 0);787 return TRPMRaiseXcptErr(pVCpu, pCtxCore, X86_XCPT_GP, 0); 788 788 } 789 789 LogFlow(("iomInterpretCheckPortIOAccess: Port=%RTiop cb=%d offTss=%#x cbTss=%#x u16=%#x -> OK\n", -
trunk/src/VBox/VMM/VMMAll/PGMAllBth.h
r18992 r19015 101 101 { 102 102 uErr &= ~X86_TRAP_PF_ID; 103 TRPMSetErrorCode(pV M, uErr);103 TRPMSetErrorCode(pVCpu, uErr); 104 104 } 105 105 # endif … … 140 140 # endif 141 141 STAM_STATS({ pVCpu->pgm.s.CTX_SUFF(pStatTrap0eAttribution) = &pVCpu->pgm.s.StatRZTrap0eTime2GuestTrap; }); 142 TRPMSetErrorCode(pV M, uErr);142 TRPMSetErrorCode(pVCpu, uErr); 143 143 return VINF_EM_RAW_GUEST_TRAP; 144 144 } … … 329 329 * Pretend we're not here and let the guest handle the trap. 330 330 */ 331 TRPMSetErrorCode(pV M, uErr & ~X86_TRAP_PF_P);331 TRPMSetErrorCode(pVCpu, uErr & ~X86_TRAP_PF_P); 332 332 STAM_COUNTER_INC(&pVCpu->pgm.s.StatRZTrap0eGuestPFMapping); 333 333 LogFlow(("PGM: Mapping access -> route trap to recompiler!\n")); … … 2201 2201 */ 2202 2202 if (pPdeSrc->n.u1Present && pPteSrc->n.u1Present) 2203 TRPMSetErrorCode(pV M, uErr | X86_TRAP_PF_P); /* page-level protection violation */2203 TRPMSetErrorCode(pVCpu, uErr | X86_TRAP_PF_P); /* page-level protection violation */ 2204 2204 2205 2205 STAM_PROFILE_STOP(&pVCpu->pgm.s.CTX_MID_Z(Stat,DirtyBitTracking), a); … … 2328 2328 if (pPdeSrc->b.u1Size && fBigPagesSupported) 2329 2329 { 2330 TRPMSetErrorCode(pV M, uErr | X86_TRAP_PF_P); /* page-level protection violation */2330 TRPMSetErrorCode(pVCpu, uErr | X86_TRAP_PF_P); /* page-level protection violation */ 2331 2331 } 2332 2332 else … … 2342 2342 const GSTPTE PteSrc = *pPteSrc; 2343 2343 if (pPteSrc->n.u1Present) 2344 TRPMSetErrorCode(pV M, uErr | X86_TRAP_PF_P); /* page-level protection violation */2344 TRPMSetErrorCode(pVCpu, uErr | X86_TRAP_PF_P); /* page-level protection violation */ 2345 2345 } 2346 2346 AssertRC(rc); -
trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp
r18988 r19015 2756 2756 } 2757 2757 Log(("PGMPhysInterpretedRead: GCPtrSrc=%RGv cb=%#x -> #PF(%#x)\n", GCPtrSrc, cb, uErr)); 2758 return TRPMRaiseXcptErrCR2(pV M, pCtxCore, X86_XCPT_PF, uErr, GCPtrSrc);2758 return TRPMRaiseXcptErrCR2(pVCpu, pCtxCore, X86_XCPT_PF, uErr, GCPtrSrc); 2759 2759 } 2760 2760 … … 2948 2948 { 2949 2949 Log(("PGMPhysInterpretedReadNoHandlers: GCPtrSrc=%RGv cb=%#x -> Raised #PF(%#x)\n", GCPtrSrc, cb, uErr)); 2950 return TRPMRaiseXcptErrCR2(pV M, pCtxCore, X86_XCPT_PF, uErr, GCPtrSrc);2950 return TRPMRaiseXcptErrCR2(pVCpu, pCtxCore, X86_XCPT_PF, uErr, GCPtrSrc); 2951 2951 } 2952 2952 Log(("PGMPhysInterpretedReadNoHandlers: GCPtrSrc=%RGv cb=%#x -> #PF(%#x) [!raised]\n", GCPtrSrc, cb, uErr)); … … 3151 3151 { 3152 3152 Log(("PGMPhysInterpretedWriteNoHandlers: GCPtrDst=%RGv cb=%#x -> Raised #PF(%#x)\n", GCPtrDst, cb, uErr)); 3153 return TRPMRaiseXcptErrCR2(pV M, pCtxCore, X86_XCPT_PF, uErr, GCPtrDst);3153 return TRPMRaiseXcptErrCR2(pVCpu, pCtxCore, X86_XCPT_PF, uErr, GCPtrDst); 3154 3154 } 3155 3155 Log(("PGMPhysInterpretedWriteNoHandlers: GCPtrDst=%RGv cb=%#x -> #PF(%#x) [!raised]\n", GCPtrDst, cb, uErr)); -
trunk/src/VBox/VMM/VMMAll/TRPMAll.cpp
r18992 r19015 49 49 * 50 50 * @returns VBox status code. 51 * @param pV M The virtual machine.51 * @param pVCpu VMCPU handle. 52 52 * @param pu8TrapNo Where to store the trap number. 53 53 * @param pEnmType Where to store the trap type 54 54 */ 55 VMMDECL(int) TRPMQueryTrap(PVM pVM, uint8_t *pu8TrapNo, TRPMEVENT *pEnmType)55 VMMDECL(int) TRPMQueryTrap(PVMCPU pVCpu, uint8_t *pu8TrapNo, TRPMEVENT *pEnmType) 56 56 { 57 57 /* 58 58 * Check if we have a trap at present. 59 59 */ 60 if (pV M->trpm.s.uActiveVector != ~0U)60 if (pVCpu->trpm.s.uActiveVector != ~0U) 61 61 { 62 62 if (pu8TrapNo) 63 *pu8TrapNo = (uint8_t)pV M->trpm.s.uActiveVector;63 *pu8TrapNo = (uint8_t)pVCpu->trpm.s.uActiveVector; 64 64 if (pEnmType) 65 *pEnmType = pV M->trpm.s.enmActiveType;65 *pEnmType = pVCpu->trpm.s.enmActiveType; 66 66 return VINF_SUCCESS; 67 67 } … … 78 78 * 79 79 * @returns The current trap number. 80 * @param pV M VMhandle.81 */ 82 VMMDECL(uint8_t) TRPMGetTrapNo(PVM pVM)83 { 84 AssertMsg(pV M->trpm.s.uActiveVector != ~0U, ("No active trap!\n"));85 return (uint8_t)pV M->trpm.s.uActiveVector;80 * @param pVCpu VMCPU handle. 81 */ 82 VMMDECL(uint8_t) TRPMGetTrapNo(PVMCPU pVCpu) 83 { 84 AssertMsg(pVCpu->trpm.s.uActiveVector != ~0U, ("No active trap!\n")); 85 return (uint8_t)pVCpu->trpm.s.uActiveVector; 86 86 } 87 87 … … 94 94 * 95 95 * @returns Error code. 96 * @param pV M VMhandle.97 */ 98 VMMDECL(RTGCUINT) TRPMGetErrorCode(PVM pVM)99 { 100 AssertMsg(pV M->trpm.s.uActiveVector != ~0U, ("No active trap!\n"));96 * @param pVCpu VMCPU handle. 97 */ 98 VMMDECL(RTGCUINT) TRPMGetErrorCode(PVMCPU pVCpu) 99 { 100 AssertMsg(pVCpu->trpm.s.uActiveVector != ~0U, ("No active trap!\n")); 101 101 #ifdef VBOX_STRICT 102 switch (pV M->trpm.s.uActiveVector)102 switch (pVCpu->trpm.s.uActiveVector) 103 103 { 104 104 case 0x0a: … … 111 111 break; 112 112 default: 113 AssertMsgFailed(("This trap (%#x) doesn't have any error code\n", pV M->trpm.s.uActiveVector));113 AssertMsgFailed(("This trap (%#x) doesn't have any error code\n", pVCpu->trpm.s.uActiveVector)); 114 114 break; 115 115 } 116 116 #endif 117 return pV M->trpm.s.uActiveErrorCode;117 return pVCpu->trpm.s.uActiveErrorCode; 118 118 } 119 119 … … 126 126 * 127 127 * @returns Fault address associated with the trap. 128 * @param pV M VMhandle.129 */ 130 VMMDECL(RTGCUINTPTR) TRPMGetFaultAddress(PVM pVM)131 { 132 AssertMsg(pV M->trpm.s.uActiveVector != ~0U, ("No active trap!\n"));133 AssertMsg(pV M->trpm.s.uActiveVector == 0xe, ("Not trap 0e!\n"));134 return pV M->trpm.s.uActiveCR2;128 * @param pVCpu VMCPU handle. 129 */ 130 VMMDECL(RTGCUINTPTR) TRPMGetFaultAddress(PVMCPU pVCpu) 131 { 132 AssertMsg(pVCpu->trpm.s.uActiveVector != ~0U, ("No active trap!\n")); 133 AssertMsg(pVCpu->trpm.s.uActiveVector == 0xe, ("Not trap 0e!\n")); 134 return pVCpu->trpm.s.uActiveCR2; 135 135 } 136 136 … … 143 143 * 144 144 * @returns VBox status code. 145 * @param pV M The virtual machinehandle.146 */ 147 VMMDECL(int) TRPMResetTrap(PVM pVM)145 * @param pVCpu VMCPU handle. 146 */ 147 VMMDECL(int) TRPMResetTrap(PVMCPU pVCpu) 148 148 { 149 149 /* 150 150 * Cannot reset non-existing trap! 151 151 */ 152 if (pV M->trpm.s.uActiveVector == ~0U)152 if (pVCpu->trpm.s.uActiveVector == ~0U) 153 153 { 154 154 AssertMsgFailed(("No active trap!\n")); … … 159 159 * Reset it. 160 160 */ 161 pV M->trpm.s.uActiveVector = ~0U;161 pVCpu->trpm.s.uActiveVector = ~0U; 162 162 return VINF_SUCCESS; 163 163 } … … 171 171 * 172 172 * @returns VBox status code. 173 * @param pV M The virtual machine.173 * @param pVCpu VMCPU handle. 174 174 * @param u8TrapNo The trap vector to assert. 175 175 * @param enmType Trap type. 176 176 */ 177 VMMDECL(int) TRPMAssertTrap(PVM pVM, uint8_t u8TrapNo, TRPMEVENT enmType)177 VMMDECL(int) TRPMAssertTrap(PVMCPU pVCpu, uint8_t u8TrapNo, TRPMEVENT enmType) 178 178 { 179 179 Log2(("TRPMAssertTrap: u8TrapNo=%02x type=%d\n", u8TrapNo, enmType)); … … 182 182 * Cannot assert a trap when one is already active. 183 183 */ 184 if (pV M->trpm.s.uActiveVector != ~0U)184 if (pVCpu->trpm.s.uActiveVector != ~0U) 185 185 { 186 AssertMsgFailed(("Active trap %#x\n", pV M->trpm.s.uActiveVector));186 AssertMsgFailed(("Active trap %#x\n", pVCpu->trpm.s.uActiveVector)); 187 187 return VERR_TRPM_ACTIVE_TRAP; 188 188 } 189 189 190 pV M->trpm.s.uActiveVector = u8TrapNo;191 pV M->trpm.s.enmActiveType = enmType;192 pV M->trpm.s.uActiveErrorCode = ~0;193 pV M->trpm.s.uActiveCR2 = 0xdeadface;190 pVCpu->trpm.s.uActiveVector = u8TrapNo; 191 pVCpu->trpm.s.enmActiveType = enmType; 192 pVCpu->trpm.s.uActiveErrorCode = ~0; 193 pVCpu->trpm.s.uActiveCR2 = 0xdeadface; 194 194 return VINF_SUCCESS; 195 195 } … … 203 203 * which takes an errorcode when making this request. 204 204 * 205 * @param pV M The virtual machine.206 * @param uErrorCode The new error code.207 */ 208 VMMDECL(void) TRPMSetErrorCode(PVM pVM, RTGCUINT uErrorCode)205 * @param pVCpu VMCPU handle. 206 * @param uErrorCode The new error code. 207 */ 208 VMMDECL(void) TRPMSetErrorCode(PVMCPU pVCpu, RTGCUINT uErrorCode) 209 209 { 210 210 Log2(("TRPMSetErrorCode: uErrorCode=%RGv\n", uErrorCode)); /** @todo RTGCUINT mess! */ 211 AssertMsg(pV M->trpm.s.uActiveVector != ~0U, ("No active trap!\n"));212 pV M->trpm.s.uActiveErrorCode = uErrorCode;211 AssertMsg(pVCpu->trpm.s.uActiveVector != ~0U, ("No active trap!\n")); 212 pVCpu->trpm.s.uActiveErrorCode = uErrorCode; 213 213 #ifdef VBOX_STRICT 214 switch (pV M->trpm.s.uActiveVector)214 switch (pVCpu->trpm.s.uActiveVector) 215 215 { 216 216 case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: 217 AssertMsg(uErrorCode != ~(RTGCUINT)0, ("Invalid uErrorCode=%#x u8TrapNo=%d\n", uErrorCode, pV M->trpm.s.uActiveVector));217 AssertMsg(uErrorCode != ~(RTGCUINT)0, ("Invalid uErrorCode=%#x u8TrapNo=%d\n", uErrorCode, pVCpu->trpm.s.uActiveVector)); 218 218 break; 219 219 case 0x11: case 0x08: 220 AssertMsg(uErrorCode == 0, ("Invalid uErrorCode=%#x u8TrapNo=%d\n", uErrorCode, pV M->trpm.s.uActiveVector));220 AssertMsg(uErrorCode == 0, ("Invalid uErrorCode=%#x u8TrapNo=%d\n", uErrorCode, pVCpu->trpm.s.uActiveVector)); 221 221 break; 222 222 default: 223 AssertMsg(uErrorCode == ~(RTGCUINT)0, ("Invalid uErrorCode=%#x u8TrapNo=%d\n", uErrorCode, pV M->trpm.s.uActiveVector));223 AssertMsg(uErrorCode == ~(RTGCUINT)0, ("Invalid uErrorCode=%#x u8TrapNo=%d\n", uErrorCode, pVCpu->trpm.s.uActiveVector)); 224 224 break; 225 225 } … … 235 235 * when making this request. 236 236 * 237 * @param pV M The virtual machine.238 * @param uCR2 The new fault address (cr2 register).239 */ 240 VMMDECL(void) TRPMSetFaultAddress(PVM pVM, RTGCUINTPTR uCR2)237 * @param pVCpu VMCPU handle. 238 * @param uCR2 The new fault address (cr2 register). 239 */ 240 VMMDECL(void) TRPMSetFaultAddress(PVMCPU pVCpu, RTGCUINTPTR uCR2) 241 241 { 242 242 Log2(("TRPMSetFaultAddress: uCR2=%RGv\n", uCR2)); 243 AssertMsg(pV M->trpm.s.uActiveVector != ~0U, ("No active trap!\n"));244 AssertMsg(pV M->trpm.s.uActiveVector == 0xe, ("Not trap 0e!\n"));245 pV M->trpm.s.uActiveCR2 = uCR2;243 AssertMsg(pVCpu->trpm.s.uActiveVector != ~0U, ("No active trap!\n")); 244 AssertMsg(pVCpu->trpm.s.uActiveVector == 0xe, ("Not trap 0e!\n")); 245 pVCpu->trpm.s.uActiveCR2 = uCR2; 246 246 } 247 247 … … 256 256 * @returns true if software interrupt, false if not. 257 257 * 258 * @param pV M VMhandle.259 */ 260 VMMDECL(bool) TRPMIsSoftwareInterrupt(PVM pVM)261 { 262 AssertMsg(pV M->trpm.s.uActiveVector != ~0U, ("No active trap!\n"));263 return (pV M->trpm.s.enmActiveType == TRPM_SOFTWARE_INT);258 * @param pVCpu VMCPU handle. 259 */ 260 VMMDECL(bool) TRPMIsSoftwareInterrupt(PVMCPU pVCpu) 261 { 262 AssertMsg(pVCpu->trpm.s.uActiveVector != ~0U, ("No active trap!\n")); 263 return (pVCpu->trpm.s.enmActiveType == TRPM_SOFTWARE_INT); 264 264 } 265 265 … … 269 269 * 270 270 * @returns true if trap active, false if not. 271 * @param pV M The virtual machine.272 */ 273 VMMDECL(bool) TRPMHasTrap(PVM pVM)274 { 275 return pV M->trpm.s.uActiveVector != ~0U;271 * @param pVCpu VMCPU handle. 272 */ 273 VMMDECL(bool) TRPMHasTrap(PVMCPU pVCpu) 274 { 275 return pVCpu->trpm.s.uActiveVector != ~0U; 276 276 } 277 277 … … 282 282 * 283 283 * @returns VBox status code. 284 * @param pV M The virtual machine.284 * @param pVCpu VMCPU handle. 285 285 * @param pu8TrapNo Where to store the trap number. 286 286 * @param pEnmType Where to store the trap type … … 289 289 * @param puCR2 Where to store the CR2 associated with a trap 0E. 290 290 */ 291 VMMDECL(int) TRPMQueryTrapAll(PVM pVM, uint8_t *pu8TrapNo, TRPMEVENT *pEnmType, PRTGCUINT puErrorCode, PRTGCUINTPTR puCR2)291 VMMDECL(int) TRPMQueryTrapAll(PVMCPU pVCpu, uint8_t *pu8TrapNo, TRPMEVENT *pEnmType, PRTGCUINT puErrorCode, PRTGCUINTPTR puCR2) 292 292 { 293 293 /* 294 294 * Check if we have a trap at present. 295 295 */ 296 if (pV M->trpm.s.uActiveVector == ~0U)296 if (pVCpu->trpm.s.uActiveVector == ~0U) 297 297 return VERR_TRPM_NO_ACTIVE_TRAP; 298 298 299 299 if (pu8TrapNo) 300 *pu8TrapNo = (uint8_t)pV M->trpm.s.uActiveVector;300 *pu8TrapNo = (uint8_t)pVCpu->trpm.s.uActiveVector; 301 301 if (pEnmType) 302 *pEnmType = pV M->trpm.s.enmActiveType;302 *pEnmType = pVCpu->trpm.s.enmActiveType; 303 303 if (puErrorCode) 304 *puErrorCode = pV M->trpm.s.uActiveErrorCode;304 *puErrorCode = pVCpu->trpm.s.uActiveErrorCode; 305 305 if (puCR2) 306 *puCR2 = pV M->trpm.s.uActiveCR2;306 *puCR2 = pVCpu->trpm.s.uActiveCR2; 307 307 308 308 return VINF_SUCCESS; … … 319 319 * @param pVM VM handle. 320 320 */ 321 VMMDECL(void) TRPMSaveTrap(PVM pVM)322 { 323 pV M->trpm.s.uSavedVector = pVM->trpm.s.uActiveVector;324 pV M->trpm.s.enmSavedType = pVM->trpm.s.enmActiveType;325 pV M->trpm.s.uSavedErrorCode = pVM->trpm.s.uActiveErrorCode;326 pV M->trpm.s.uSavedCR2 = pVM->trpm.s.uActiveCR2;321 VMMDECL(void) TRPMSaveTrap(PVMCPU pVCpu) 322 { 323 pVCpu->trpm.s.uSavedVector = pVCpu->trpm.s.uActiveVector; 324 pVCpu->trpm.s.enmSavedType = pVCpu->trpm.s.enmActiveType; 325 pVCpu->trpm.s.uSavedErrorCode = pVCpu->trpm.s.uActiveErrorCode; 326 pVCpu->trpm.s.uSavedCR2 = pVCpu->trpm.s.uActiveCR2; 327 327 } 328 328 … … 335 335 * @param pVM VM handle. 336 336 */ 337 VMMDECL(void) TRPMRestoreTrap(PVM pVM)338 { 339 pV M->trpm.s.uActiveVector = pVM->trpm.s.uSavedVector;340 pV M->trpm.s.enmActiveType = pVM->trpm.s.enmSavedType;341 pV M->trpm.s.uActiveErrorCode = pVM->trpm.s.uSavedErrorCode;342 pV M->trpm.s.uActiveCR2 = pVM->trpm.s.uSavedCR2;337 VMMDECL(void) TRPMRestoreTrap(PVMCPU pVCpu) 338 { 339 pVCpu->trpm.s.uActiveVector = pVCpu->trpm.s.uSavedVector; 340 pVCpu->trpm.s.enmActiveType = pVCpu->trpm.s.enmSavedType; 341 pVCpu->trpm.s.uActiveErrorCode = pVCpu->trpm.s.uSavedErrorCode; 342 pVCpu->trpm.s.uActiveCR2 = pVCpu->trpm.s.uSavedCR2; 343 343 } 344 344 … … 361 361 * @internal 362 362 */ 363 VMMDECL(int) TRPMForwardTrap(PVM pVM, PCPUMCTXCORE pRegFrame, uint32_t iGate, uint32_t opsize, TRPMERRORCODE enmError, TRPMEVENT enmType, int32_t iOrgTrap)363 VMMDECL(int) TRPMForwardTrap(PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, uint32_t iGate, uint32_t opsize, TRPMERRORCODE enmError, TRPMEVENT enmType, int32_t iOrgTrap) 364 364 { 365 365 #ifdef TRPM_FORWARD_TRAPS_IN_GC 366 PVM pVM = pVCpu->CTX_SUFF(pVM); 366 367 X86EFLAGS eflags; 367 368 Assert(pVM->cCPUs == 1); 368 PVMCPU pVCpu = &pVM->aCpus[0];369 369 370 370 STAM_PROFILE_ADV_START(&pVM->trpm.s.CTX_SUFF_Z(StatForwardProf), a); … … 378 378 switch (iGate) { 379 379 case 14: 380 if (pRegFrame->eip == pV M->trpm.s.uActiveCR2)380 if (pRegFrame->eip == pVCpu->trpm.s.uActiveCR2) 381 381 { 382 382 int rc; … … 608 608 if (eflags.Bits.u1VM) 609 609 { 610 Log(("TRAP%02X: (VM) Handler %04X:%RGv Stack %04X:%08X RPL=%d CR2=%08X\n", iGate, GuestIdte.Gen.u16SegSel, pHandler, ss_r0, esp_r0, (pRegFrame->ss & X86_SEL_RPL), pV M->trpm.s.uActiveCR2));610 Log(("TRAP%02X: (VM) Handler %04X:%RGv Stack %04X:%08X RPL=%d CR2=%08X\n", iGate, GuestIdte.Gen.u16SegSel, pHandler, ss_r0, esp_r0, (pRegFrame->ss & X86_SEL_RPL), pVCpu->trpm.s.uActiveCR2)); 611 611 pTrapStack[--idx] = pRegFrame->gs; 612 612 pTrapStack[--idx] = pRegFrame->fs; … … 618 618 } 619 619 else 620 Log(("TRAP%02X: Handler %04X:%RGv Stack %04X:%08X RPL=%d CR2=%08X\n", iGate, GuestIdte.Gen.u16SegSel, pHandler, ss_r0, esp_r0, (pRegFrame->ss & X86_SEL_RPL), pV M->trpm.s.uActiveCR2));620 Log(("TRAP%02X: Handler %04X:%RGv Stack %04X:%08X RPL=%d CR2=%08X\n", iGate, GuestIdte.Gen.u16SegSel, pHandler, ss_r0, esp_r0, (pRegFrame->ss & X86_SEL_RPL), pVCpu->trpm.s.uActiveCR2)); 621 621 622 622 if (!fConforming && dpl < cpl) … … 649 649 if (enmError == TRPM_TRAP_HAS_ERRORCODE) 650 650 { 651 pTrapStack[--idx] = pV M->trpm.s.uActiveErrorCode;651 pTrapStack[--idx] = pVCpu->trpm.s.uActiveErrorCode; 652 652 } 653 653 … … 674 674 675 675 /* Make sure the internal guest context structure is up-to-date. */ 676 CPUMSetGuestCR2(pVCpu, pV M->trpm.s.uActiveCR2);676 CPUMSetGuestCR2(pVCpu, pVCpu->trpm.s.uActiveCR2); 677 677 678 678 #ifdef IN_RC 679 679 /* Note: shouldn't be necessary */ 680 ASMSetCR2(pV M->trpm.s.uActiveCR2);680 ASMSetCR2(pVCpu->trpm.s.uActiveCR2); 681 681 682 682 /* Turn off interrupts for interrupt gates. */ … … 757 757 * @param enmXcpt The exception. 758 758 */ 759 VMMDECL(int) TRPMRaiseXcpt(PVM pVM, PCPUMCTXCORE pCtxCore, X86XCPT enmXcpt)759 VMMDECL(int) TRPMRaiseXcpt(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, X86XCPT enmXcpt) 760 760 { 761 761 LogFlow(("TRPMRaiseXcptErr: cs:eip=%RTsel:%RX32 enmXcpt=%#x\n", pCtxCore->cs, pCtxCore->eip, enmXcpt)); 762 762 /** @todo dispatch the trap. */ 763 pV M->trpm.s.uActiveVector = enmXcpt;764 pV M->trpm.s.enmActiveType = TRPM_TRAP;765 pV M->trpm.s.uActiveErrorCode = 0xdeadbeef;766 pV M->trpm.s.uActiveCR2 = 0xdeadface;763 pVCpu->trpm.s.uActiveVector = enmXcpt; 764 pVCpu->trpm.s.enmActiveType = TRPM_TRAP; 765 pVCpu->trpm.s.uActiveErrorCode = 0xdeadbeef; 766 pVCpu->trpm.s.uActiveCR2 = 0xdeadface; 767 767 return VINF_EM_RAW_GUEST_TRAP; 768 768 } … … 784 784 * @param uErr The error code. 785 785 */ 786 VMMDECL(int) TRPMRaiseXcptErr(PVM pVM, PCPUMCTXCORE pCtxCore, X86XCPT enmXcpt, uint32_t uErr)786 VMMDECL(int) TRPMRaiseXcptErr(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, X86XCPT enmXcpt, uint32_t uErr) 787 787 { 788 788 LogFlow(("TRPMRaiseXcptErr: cs:eip=%RTsel:%RX32 enmXcpt=%#x uErr=%RX32\n", pCtxCore->cs, pCtxCore->eip, enmXcpt, uErr)); 789 789 /** @todo dispatch the trap. */ 790 pV M->trpm.s.uActiveVector = enmXcpt;791 pV M->trpm.s.enmActiveType = TRPM_TRAP;792 pV M->trpm.s.uActiveErrorCode = uErr;793 pV M->trpm.s.uActiveCR2 = 0xdeadface;790 pVCpu->trpm.s.uActiveVector = enmXcpt; 791 pVCpu->trpm.s.enmActiveType = TRPM_TRAP; 792 pVCpu->trpm.s.uActiveErrorCode = uErr; 793 pVCpu->trpm.s.uActiveCR2 = 0xdeadface; 794 794 return VINF_EM_RAW_GUEST_TRAP; 795 795 } … … 812 812 * @param uCR2 The CR2 value. 813 813 */ 814 VMMDECL(int) TRPMRaiseXcptErrCR2(PVM pVM, PCPUMCTXCORE pCtxCore, X86XCPT enmXcpt, uint32_t uErr, RTGCUINTPTR uCR2)814 VMMDECL(int) TRPMRaiseXcptErrCR2(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, X86XCPT enmXcpt, uint32_t uErr, RTGCUINTPTR uCR2) 815 815 { 816 816 LogFlow(("TRPMRaiseXcptErr: cs:eip=%RTsel:%RX32 enmXcpt=%#x uErr=%RX32 uCR2=%RGv\n", pCtxCore->cs, pCtxCore->eip, enmXcpt, uErr, uCR2)); 817 817 /** @todo dispatch the trap. */ 818 pV M->trpm.s.uActiveVector = enmXcpt;819 pV M->trpm.s.enmActiveType = TRPM_TRAP;820 pV M->trpm.s.uActiveErrorCode = uErr;821 pV M->trpm.s.uActiveCR2 = uCR2;818 pVCpu->trpm.s.uActiveVector = enmXcpt; 819 pVCpu->trpm.s.enmActiveType = TRPM_TRAP; 820 pVCpu->trpm.s.uActiveErrorCode = uErr; 821 pVCpu->trpm.s.uActiveCR2 = uCR2; 822 822 return VINF_EM_RAW_GUEST_TRAP; 823 823 } -
trunk/src/VBox/VMM/VMMGC/MMRamGC.cpp
r18988 r19015 103 103 VMMRCDECL(int) MMGCRamRead(PVM pVM, void *pDst, void *pSrc, size_t cb) 104 104 { 105 int rc; 106 107 TRPMSaveTrap(pVM); /* save the current trap info, because it will get trashed if our access failed. */ 105 int rc; 106 PVMCPU pVCpu = VMMGetCpu0(pVM); 107 108 TRPMSaveTrap(pVCpu); /* save the current trap info, because it will get trashed if our access failed. */ 108 109 109 110 MMGCRamRegisterTrapHandler(pVM); … … 111 112 MMGCRamDeregisterTrapHandler(pVM); 112 113 if (RT_FAILURE(rc)) 113 TRPMRestoreTrap(pV M);114 TRPMRestoreTrap(pVCpu); 114 115 115 116 return rc; … … 128 129 VMMRCDECL(int) MMGCRamWrite(PVM pVM, void *pDst, void *pSrc, size_t cb) 129 130 { 130 TRPMSaveTrap(pVM); /* save the current trap info, because it will get trashed if our access failed. */ 131 PVMCPU pVCpu = VMMGetCpu0(pVM); 132 TRPMSaveTrap(pVCpu); /* save the current trap info, because it will get trashed if our access failed. */ 131 133 132 134 MMGCRamRegisterTrapHandler(pVM); … … 134 136 MMGCRamDeregisterTrapHandler(pVM); 135 137 if (RT_FAILURE(rc)) 136 TRPMRestoreTrap(pV M);138 TRPMRestoreTrap(pVCpu); 137 139 138 140 /* … … 159 161 { 160 162 /* Must be a read violation. */ 161 AssertReturn(!(TRPMGetErrorCode( pVM) & X86_TRAP_PF_RW), VERR_INTERNAL_ERROR);163 AssertReturn(!(TRPMGetErrorCode(VMMGetCpu0(pVM)) & X86_TRAP_PF_RW), VERR_INTERNAL_ERROR); 162 164 pRegFrame->eip = (uintptr_t)&MMGCRamRead_Error; 163 165 return VINF_SUCCESS; … … 171 173 { 172 174 /* Must be a write violation. */ 173 AssertReturn(TRPMGetErrorCode( pVM) & X86_TRAP_PF_RW, VERR_INTERNAL_ERROR);175 AssertReturn(TRPMGetErrorCode(VMMGetCpu0(pVM)) & X86_TRAP_PF_RW, VERR_INTERNAL_ERROR); 174 176 pRegFrame->eip = (uintptr_t)&MMGCRamWrite_Error; 175 177 return VINF_SUCCESS; -
trunk/src/VBox/VMM/VMMGC/TRPMGC.cpp
r18927 r19015 88 88 89 89 LogFlow(("TRPMGCHyperReturnToHost: rc=%Rrc\n", rc)); 90 TRPMResetTrap(pV M);90 TRPMResetTrap(pVCpu); 91 91 CPUMHyperSetCtxCore(pVCpu, NULL); 92 92 VMMGCGuestToHost(pVM, rc); -
trunk/src/VBox/VMM/VMMGC/TRPMGCHandlers.cpp
r18992 r19015 136 136 { 137 137 PVMCPU pVCpu = VMMGetCpu0(pVM); 138 uint32_t uOldActiveVector = pV M->trpm.s.uActiveVector;138 uint32_t uOldActiveVector = pVCpu->trpm.s.uActiveVector; 139 139 NOREF(uOldActiveVector); 140 140 … … 142 142 if ( rc != VINF_EM_RAW_GUEST_TRAP 143 143 && rc != VINF_EM_RAW_RING_SWITCH_INT) 144 pV M->trpm.s.uActiveVector = ~0;144 pVCpu->trpm.s.uActiveVector = ~0; 145 145 146 146 #ifdef VBOX_HIGH_RES_TIMERS_HACK … … 210 210 Log(("trpmGCExitTrap: u8Interrupt=%d (%#x) rc=%Rrc\n", u8Interrupt, u8Interrupt, rc)); 211 211 AssertFatalMsgRC(rc, ("PDMGetInterrupt failed with %Rrc\n", rc)); 212 rc = TRPMForwardTrap(pV M, pRegFrame, (uint32_t)u8Interrupt, 0, TRPM_TRAP_NO_ERRORCODE, TRPM_HARDWARE_INT, uOldActiveVector);212 rc = TRPMForwardTrap(pVCpu, pRegFrame, (uint32_t)u8Interrupt, 0, TRPM_TRAP_NO_ERRORCODE, TRPM_HARDWARE_INT, uOldActiveVector); 213 213 /* can't return if successful */ 214 214 Assert(rc != VINF_SUCCESS); … … 219 219 220 220 /* Assert the trap and go to the recompiler to dispatch it. */ 221 TRPMAssertTrap(pV M, u8Interrupt, TRPM_HARDWARE_INT);221 TRPMAssertTrap(pVCpu, u8Interrupt, TRPM_HARDWARE_INT); 222 222 223 223 STAM_PROFILE_ADV_START(&pVM->trpm.s.aStatGCTraps[uOldActiveVector], a); … … 253 253 * other codes are passed execution to host context. 254 254 * 255 * @param pTrpm Pointer to TRPMdata (within VM).255 * @param pTrpmCpu Pointer to TRPMCPU data (within VM). 256 256 * @param pRegFrame Pointer to the register frame for the trap. 257 257 * @internal 258 258 */ 259 DECLASM(int) TRPMGCTrap01Handler(PTRPM pTrpm, PCPUMCTXCORE pRegFrame)259 DECLASM(int) TRPMGCTrap01Handler(PTRPMCPU pTrpmCpu, PCPUMCTXCORE pRegFrame) 260 260 { 261 261 RTGCUINTREG uDr6 = ASMGetAndClearDR6(); 262 PVM pVM = TRPM2VM(pTrpm );262 PVM pVM = TRPM2VM(pTrpmCpu); 263 263 PVMCPU pVCpu = VMMGetCpu0(pVM); 264 264 … … 298 298 * other codes are passed execution to host context. 299 299 * 300 * @param pTrpm Pointer to TRPMdata (within VM).300 * @param pTrpmCpu Pointer to TRPMCPU data (within VM). 301 301 * @param pRegFrame Pointer to the register frame for the trap. 302 302 * @internal 303 303 * @remark This is not hooked up unless you're building with VBOX_WITH_NMI defined. 304 304 */ 305 DECLASM(int) TRPMGCTrap02Handler(PTRPM pTrpm, PCPUMCTXCORE pRegFrame)305 DECLASM(int) TRPMGCTrap02Handler(PTRPMCPU pTrpmCpu, PCPUMCTXCORE pRegFrame) 306 306 { 307 307 LogFlow(("TRPMGCTrap02Handler: cs:eip=%04x:%08x\n", pRegFrame->cs, pRegFrame->eip)); … … 318 318 * other codes are passed execution to host context. 319 319 * 320 * @param pTrpm Pointer to TRPMdata (within VM).320 * @param pTrpmCpu Pointer to TRPMCPU data (within VM). 321 321 * @param pRegFrame Pointer to the register frame for the trap. 322 322 * @internal 323 323 */ 324 DECLASM(int) TRPMGCTrap03Handler(PTRPM pTrpm, PCPUMCTXCORE pRegFrame)324 DECLASM(int) TRPMGCTrap03Handler(PTRPMCPU pTrpmCpu, PCPUMCTXCORE pRegFrame) 325 325 { 326 326 LogFlow(("TRPMGC03: %04x:%08x\n", pRegFrame->cs, pRegFrame->eip)); 327 PVM pVM = TRPM2VM(pTrpm );327 PVM pVM = TRPM2VM(pTrpmCpu); 328 328 int rc; 329 329 … … 358 358 * other codes are passed execution to host context. 359 359 * 360 * @param pTrpm Pointer to TRPMdata (within VM).360 * @param pTrpmCpu Pointer to TRPMCPU data (within VM). 361 361 * @param pRegFrame Pointer to the register frame for the trap. 362 362 * @internal 363 363 */ 364 DECLASM(int) TRPMGCTrap06Handler(PTRPM pTrpm, PCPUMCTXCORE pRegFrame)364 DECLASM(int) TRPMGCTrap06Handler(PTRPMCPU pTrpmCpu, PCPUMCTXCORE pRegFrame) 365 365 { 366 366 LogFlow(("TRPMGC06: %04x:%08x efl=%x\n", pRegFrame->cs, pRegFrame->eip, pRegFrame->eflags.u32)); 367 PVM pVM = TRPM2VM(pTrpm );367 PVM pVM = TRPM2VM(pTrpmCpu); 368 368 PVMCPU pVCpu = VMMGetCpu0(pVM); 369 369 int rc; … … 422 422 #ifdef DTRACE_EXPERIMENT /** @todo fix/remove/permanent-enable this when DIS/PATM handles invalid lock sequences. */ 423 423 Assert(!PATMIsPatchGCAddr(pVM, (RTRCPTR)pRegFrame->eip)); 424 rc = TRPMForwardTrap(pV M, pRegFrame, 0x6, 0, TRPM_TRAP_NO_ERRORCODE, TRPM_TRAP, 0x6);424 rc = TRPMForwardTrap(pVCpu, pRegFrame, 0x6, 0, TRPM_TRAP_NO_ERRORCODE, TRPM_TRAP, 0x6); 425 425 Assert(rc == VINF_EM_RAW_GUEST_TRAP); 426 426 #else … … 444 444 else 445 445 { 446 rc = TRPMForwardTrap(pV M, pRegFrame, 0x6, 0, TRPM_TRAP_NO_ERRORCODE, TRPM_TRAP, 0x6);446 rc = TRPMForwardTrap(pVCpu, pRegFrame, 0x6, 0, TRPM_TRAP_NO_ERRORCODE, TRPM_TRAP, 0x6); 447 447 Assert(rc == VINF_EM_RAW_GUEST_TRAP); 448 448 } … … 463 463 * other codes are passed execution to host context. 464 464 * 465 * @param pTrpm Pointer to TRPMdata (within VM).465 * @param pTrpmCpu Pointer to TRPMCPU data (within VM). 466 466 * @param pRegFrame Pointer to the register frame for the trap. 467 467 * @internal 468 468 */ 469 DECLASM(int) TRPMGCTrap07Handler(PTRPM pTrpm, PCPUMCTXCORE pRegFrame)469 DECLASM(int) TRPMGCTrap07Handler(PTRPMCPU pTrpmCpu, PCPUMCTXCORE pRegFrame) 470 470 { 471 471 LogFlow(("TRPMGC07: %04x:%08x\n", pRegFrame->cs, pRegFrame->eip)); 472 PVM pVM = TRPM2VM(pTrpm );472 PVM pVM = TRPM2VM(pTrpmCpu); 473 473 PVMCPU pVCpu = VMMGetCpu0(pVM); 474 474 … … 487 487 * other codes are passed execution to host context. 488 488 * 489 * @param pTrpm Pointer to TRPMdata (within VM).489 * @param pTrpmCpu Pointer to TRPMCPU data (within VM). 490 490 * @param pRegFrame Pointer to the register frame for the trap. 491 491 * @internal 492 492 */ 493 DECLASM(int) TRPMGCTrap0bHandler(PTRPM pTrpm, PCPUMCTXCORE pRegFrame)493 DECLASM(int) TRPMGCTrap0bHandler(PTRPMCPU pTrpmCpu, PCPUMCTXCORE pRegFrame) 494 494 { 495 495 LogFlow(("TRPMGC0b: %04x:%08x\n", pRegFrame->cs, pRegFrame->eip)); 496 PVM pVM = TRPM2VM(pTrpm );496 PVM pVM = TRPM2VM(pTrpmCpu); 497 497 498 498 /* … … 564 564 * starting from the instruction which caused the trap. 565 565 */ 566 pTrpm ->uActiveVector = ~0;566 pTrpmCpu->uActiveVector = ~0; 567 567 Log6(("TRPMGC0b: %Rrc (%04x:%08x) (CG)\n", VINF_EM_RAW_RING_SWITCH, pRegFrame->cs, pRegFrame->eip)); 568 568 return VINF_EM_RAW_RING_SWITCH; … … 620 620 } 621 621 } 622 rc = TRPMForwardTrap(pV M, pRegFrame, (uint32_t)pCpu->param1.parval, pCpu->opsize, TRPM_TRAP_NO_ERRORCODE, TRPM_SOFTWARE_INT, 0xd);622 rc = TRPMForwardTrap(pVCpu, pRegFrame, (uint32_t)pCpu->param1.parval, pCpu->opsize, TRPM_TRAP_NO_ERRORCODE, TRPM_SOFTWARE_INT, 0xd); 623 623 if (RT_SUCCESS(rc) && rc != VINF_EM_RAW_GUEST_TRAP) 624 624 return trpmGCExitTrap(pVM, VINF_SUCCESS, pRegFrame); 625 625 626 pV M->trpm.s.uActiveVector = (pVM->trpm.s.uActiveErrorCode & X86_TRAP_ERR_SEL_MASK) >> X86_TRAP_ERR_SEL_SHIFT;627 pV M->trpm.s.enmActiveType = TRPM_SOFTWARE_INT;626 pVCpu->trpm.s.uActiveVector = (pVCpu->trpm.s.uActiveErrorCode & X86_TRAP_ERR_SEL_MASK) >> X86_TRAP_ERR_SEL_SHIFT; 627 pVCpu->trpm.s.enmActiveType = TRPM_SOFTWARE_INT; 628 628 return trpmGCExitTrap(pVM, VINF_EM_RAW_RING_SWITCH_INT, pRegFrame); 629 629 } … … 716 716 { 717 717 Assert(pCpu->param1.flags & USE_IMMEDIATE8); 718 rc = TRPMForwardTrap(pV M, pRegFrame, (uint32_t)pCpu->param1.parval, pCpu->opsize, TRPM_TRAP_NO_ERRORCODE, TRPM_SOFTWARE_INT, 0xd);718 rc = TRPMForwardTrap(pVCpu, pRegFrame, (uint32_t)pCpu->param1.parval, pCpu->opsize, TRPM_TRAP_NO_ERRORCODE, TRPM_SOFTWARE_INT, 0xd); 719 719 if (RT_SUCCESS(rc) && rc != VINF_EM_RAW_GUEST_TRAP) 720 720 return trpmGCExitTrap(pVM, VINF_SUCCESS, pRegFrame); 721 721 722 pV M->trpm.s.uActiveVector = (pVM->trpm.s.uActiveErrorCode & X86_TRAP_ERR_SEL_MASK) >> X86_TRAP_ERR_SEL_SHIFT;723 pV M->trpm.s.enmActiveType = TRPM_SOFTWARE_INT;722 pVCpu->trpm.s.uActiveVector = (pVCpu->trpm.s.uActiveErrorCode & X86_TRAP_ERR_SEL_MASK) >> X86_TRAP_ERR_SEL_SHIFT; 723 pVCpu->trpm.s.enmActiveType = TRPM_SOFTWARE_INT; 724 724 return trpmGCExitTrap(pVM, VINF_EM_RAW_RING_SWITCH_INT, pRegFrame); 725 725 } … … 738 738 case OP_BOUND: 739 739 case OP_INTO: 740 pV M->trpm.s.uActiveVector = ~0;740 pVCpu->trpm.s.uActiveVector = ~0; 741 741 return trpmGCExitTrap(pVM, VINF_EM_RAW_RING_SWITCH, pRegFrame); 742 742 … … 814 814 * 815 815 * @param pVM The VM handle. 816 * @param pTrpm Pointer to TRPMdata (within VM).817 * @param pRegFrame Pointer to the register frame for the trap. 818 */ 819 static int trpmGCTrap0dHandler(PVM pVM, PTRPM pTrpm, PCPUMCTXCORE pRegFrame)816 * @param pTrpmCpu Pointer to TRPMCPU data (within VM). 817 * @param pRegFrame Pointer to the register frame for the trap. 818 */ 819 static int trpmGCTrap0dHandler(PVM pVM, PTRPMCPU pTrpmCpu, PCPUMCTXCORE pRegFrame) 820 820 { 821 821 PVMCPU pVCpu = VMMGetCpu0(pVM); 822 822 823 LogFlow(("trpmGCTrap0dHandler: cs:eip=%RTsel:%08RX32 uErr=%RGv\n", pRegFrame->ss, pRegFrame->eip, pTrpm ->uActiveErrorCode));823 LogFlow(("trpmGCTrap0dHandler: cs:eip=%RTsel:%08RX32 uErr=%RGv\n", pRegFrame->ss, pRegFrame->eip, pTrpmCpu->uActiveErrorCode)); 824 824 825 825 /* … … 870 870 * Deal with I/O port access. 871 871 */ 872 if ( pV M->trpm.s.uActiveErrorCode == 0872 if ( pVCpu->trpm.s.uActiveErrorCode == 0 873 873 && (Cpu.pCurInstr->optype & OPTYPE_PORTIO)) 874 874 { … … 905 905 Assert(eflags.Bits.u2IOPL == 0); 906 906 907 int rc = TRPMForwardTrap(pV M, pRegFrame, 0xD, 0, TRPM_TRAP_HAS_ERRORCODE, TRPM_TRAP, 0xd);907 int rc = TRPMForwardTrap(pVCpu, pRegFrame, 0xD, 0, TRPM_TRAP_HAS_ERRORCODE, TRPM_TRAP, 0xd); 908 908 Assert(rc == VINF_EM_RAW_GUEST_TRAP); 909 909 return trpmGCExitTrap(pVM, rc, pRegFrame); … … 920 920 * other codes are passed execution to host context. 921 921 * 922 * @param pTrpm Pointer to TRPMdata (within VM).922 * @param pTrpmCpu Pointer to TRPMCPU data (within VM). 923 923 * @param pRegFrame Pointer to the register frame for the trap. 924 924 * @internal 925 925 */ 926 DECLASM(int) TRPMGCTrap0dHandler(PTRPM pTrpm, PCPUMCTXCORE pRegFrame) 927 { 928 LogFlow(("TRPMGC0d: %04x:%08x err=%x\n", pRegFrame->cs, pRegFrame->eip, (uint32_t)pTrpm->uActiveErrorCode)); 929 PVM pVM = TRPM2VM(pTrpm); 930 931 int rc = trpmGCTrap0dHandler(pVM, pTrpm, pRegFrame); 926 DECLASM(int) TRPMGCTrap0dHandler(PTRPMCPU pTrpmCpu, PCPUMCTXCORE pRegFrame) 927 { 928 PVM pVM = TRPM2VM(pTrpmCpu); 929 PVMCPU pVCpu = VMMGetCpu0(pVM); 930 931 LogFlow(("TRPMGC0d: %04x:%08x err=%x\n", pRegFrame->cs, pRegFrame->eip, (uint32_t)pVCpu->trpm.s.uActiveErrorCode)); 932 933 int rc = trpmGCTrap0dHandler(pVM, pTrpmCpu, pRegFrame); 932 934 switch (rc) 933 935 { … … 939 941 940 942 case VINF_EM_RAW_INTERRUPT_PENDING: 941 Assert(TRPMHasTrap(pV M));943 Assert(TRPMHasTrap(pVCpu)); 942 944 /* no break; */ 943 945 case VINF_PGM_SYNC_CR3: /** @todo Check this with Sander. */ … … 976 978 * other codes are passed execution to host context. 977 979 * 978 * @param pTrpm Pointer to TRPMdata (within VM).980 * @param pTrpmCpu Pointer to TRPMCPU data (within VM). 979 981 * @param pRegFrame Pointer to the register frame for the trap. 980 982 * @internal 981 983 */ 982 DECLASM(int) TRPMGCTrap0eHandler(PTRPM pTrpm, PCPUMCTXCORE pRegFrame) 983 { 984 LogFlow(("TRPMGC0e: %04x:%08x err=%x cr2=%08x\n", pRegFrame->cs, pRegFrame->eip, (uint32_t)pTrpm->uActiveErrorCode, (uint32_t)pTrpm->uActiveCR2)); 985 PVM pVM = TRPM2VM(pTrpm); 984 DECLASM(int) TRPMGCTrap0eHandler(PTRPMCPU pTrpmCpu, PCPUMCTXCORE pRegFrame) 985 { 986 PVM pVM = TRPM2VM(pTrpmCpu); 986 987 PVMCPU pVCpu = VMMGetCpu0(pVM); 987 988 989 LogFlow(("TRPMGC0e: %04x:%08x err=%x cr2=%08x\n", pRegFrame->cs, pRegFrame->eip, (uint32_t)pVCpu->trpm.s.uActiveErrorCode, (uint32_t)pVCpu->trpm.s.uActiveCR2)); 988 990 989 991 /* 990 992 * This is all PGM stuff. 991 993 */ 992 int rc = PGMTrap0eHandler(pVCpu, p Trpm->uActiveErrorCode, pRegFrame, (RTGCPTR)pTrpm->uActiveCR2);994 int rc = PGMTrap0eHandler(pVCpu, pVCpu->trpm.s.uActiveErrorCode, pRegFrame, (RTGCPTR)pVCpu->trpm.s.uActiveCR2); 993 995 switch (rc) 994 996 { … … 1007 1009 return VINF_PATM_PATCH_TRAP_PF; 1008 1010 1009 rc = TRPMForwardTrap(pV M, pRegFrame, 0xE, 0, TRPM_TRAP_HAS_ERRORCODE, TRPM_TRAP, 0xe);1011 rc = TRPMForwardTrap(pVCpu, pRegFrame, 0xE, 0, TRPM_TRAP_HAS_ERRORCODE, TRPM_TRAP, 0xe); 1010 1012 Assert(rc == VINF_EM_RAW_GUEST_TRAP); 1011 1013 break; 1012 1014 1013 1015 case VINF_EM_RAW_INTERRUPT_PENDING: 1014 Assert(TRPMHasTrap(pV M));1016 Assert(TRPMHasTrap(pVCpu)); 1015 1017 /* no break; */ 1016 1018 case VINF_IOM_HC_MMIO_READ: … … 1089 1091 * other codes are passed back to host context. 1090 1092 * 1091 * @param pTrpm Pointer to TRPMdata (within VM).1093 * @param pTrpmCpu Pointer to TRPMCPU data (within VM). 1092 1094 * @param pRegFrame Pointer to the register frame for the trap. 1093 1095 * @internal 1094 1096 */ 1095 DECLASM(int) TRPMGCHyperTrap0bHandler(PTRPM pTrpm, PCPUMCTXCORE pRegFrame)1096 { 1097 return trpmGCHyperGeneric(TRPM2VM(pTrpm ), pRegFrame, g_aTrap0bHandlers, g_aTrap0bHandlersEnd);1097 DECLASM(int) TRPMGCHyperTrap0bHandler(PTRPMCPU pTrpmCpu, PCPUMCTXCORE pRegFrame) 1098 { 1099 return trpmGCHyperGeneric(TRPM2VM(pTrpmCpu), pRegFrame, g_aTrap0bHandlers, g_aTrap0bHandlersEnd); 1098 1100 } 1099 1101 … … 1108 1110 * other codes are passed back to host context. 1109 1111 * 1110 * @param pTrpm Pointer to TRPMdata (within VM).1112 * @param pTrpmCpu Pointer to TRPMCPU data (within VM). 1111 1113 * @param pRegFrame Pointer to the register frame for the trap. 1112 1114 * @internal 1113 1115 */ 1114 DECLASM(int) TRPMGCHyperTrap0dHandler(PTRPM pTrpm, PCPUMCTXCORE pRegFrame)1115 { 1116 return trpmGCHyperGeneric(TRPM2VM(pTrpm ), pRegFrame, g_aTrap0dHandlers, g_aTrap0dHandlersEnd);1116 DECLASM(int) TRPMGCHyperTrap0dHandler(PTRPMCPU pTrpmCpu, PCPUMCTXCORE pRegFrame) 1117 { 1118 return trpmGCHyperGeneric(TRPM2VM(pTrpmCpu), pRegFrame, g_aTrap0dHandlers, g_aTrap0dHandlersEnd); 1117 1119 } 1118 1120 … … 1127 1129 * other codes are passed back to host context. 1128 1130 * 1129 * @param pTrpm Pointer to TRPMdata (within VM).1131 * @param pTrpmCpu Pointer to TRPMCPU data (within VM). 1130 1132 * @param pRegFrame Pointer to the register frame for the trap. 1131 1133 * @internal 1132 1134 */ 1133 DECLASM(int) TRPMGCHyperTrap0eHandler(PTRPM pTrpm, PCPUMCTXCORE pRegFrame)1134 { 1135 return trpmGCHyperGeneric(TRPM2VM(pTrpm ), pRegFrame, g_aTrap0dHandlers, g_aTrap0dHandlersEnd);1135 DECLASM(int) TRPMGCHyperTrap0eHandler(PTRPMCPU pTrpmCpu, PCPUMCTXCORE pRegFrame) 1136 { 1137 return trpmGCHyperGeneric(TRPM2VM(pTrpmCpu), pRegFrame, g_aTrap0dHandlers, g_aTrap0dHandlersEnd); 1136 1138 } 1137 1139 -
trunk/src/VBox/VMM/VMMGC/TRPMGCHandlersA.asm
r18927 r19015 37 37 extern IMPNAME(g_CPUM) ; These IMPNAME(g_*) symbols resolve to the import table 38 38 extern IMPNAME(g_TRPM) ; where there is a pointer to the real symbol. PE imports 39 extern IMPNAME(g_VM) ; are a bit confusing at first... :-) 39 extern IMPNAME(g_TRPMCPU) ; are a bit confusing at first... :-) 40 extern IMPNAME(g_VM) 40 41 extern NAME(CPUMGCRestoreInt) 41 42 extern NAME(cpumHandleLazyFPUAsm) … … 338 339 ; Store the information about the active trap/interrupt. 339 340 ; 340 mov eax, IMP(g_TRPM )341 mov eax, IMP(g_TRPMCPU) 341 342 movzx edx, byte [esp + 0h + ESPOFF] ; vector number 342 mov [eax + TRPM .uActiveVector], edx343 mov [eax + TRPMCPU.uActiveVector], edx 343 344 mov edx, [esp + 4h + ESPOFF] ; error code 344 mov [eax + TRPM .uActiveErrorCode], edx345 mov dword [eax + TRPM .enmActiveType], TRPM_TRAP345 mov [eax + TRPMCPU.uActiveErrorCode], edx 346 mov dword [eax + TRPMCPU.enmActiveType], TRPM_TRAP 346 347 mov edx, cr2 ;; @todo Check how expensive cr2 reads are! 347 mov dword [eax + TRPM .uActiveCR2], edx348 mov dword [eax + TRPMCPU.uActiveCR2], edx 348 349 349 350 %if GC_ARCH_BITS == 64 350 351 ; zero out the high dword 351 mov dword [eax + TRPM .uActiveErrorCode + 4], 0352 mov dword [eax + TRPM .uActiveCR2 + 4], 0352 mov dword [eax + TRPMCPU.uActiveErrorCode + 4], 0 353 mov dword [eax + TRPMCPU.uActiveCR2 + 4], 0 353 354 %endif 354 355 … … 389 390 gt_HaveHandler: 390 391 push esp ; Param 2 - CPUMCTXCORE pointer. 391 push dword IMP(g_TRPM ) ; Param 1 - Pointer to TRPM392 push dword IMP(g_TRPMCPU) ; Param 1 - Pointer to TRPMCPU 392 393 call eax 393 394 add esp, byte 8 ; cleanup stack (cdecl) … … 537 538 ; Trap in Hypervisor, try to handle it. 538 539 ; 539 ; (eax = pTRPM )540 ; (eax = pTRPMCPU) 540 541 ; 541 542 ALIGNCODE(16) … … 557 558 558 559 ; check for temporary handler. 559 movzx ebx, byte [eax + TRPM.uActiveVector] 560 movzx ebx, byte [eax + TRPMCPU.uActiveVector] 561 mov eax, IMP(g_TRPM) 560 562 xor ecx, ecx 561 563 xchg ecx, [eax + TRPM.aTmpTrapHandlers + ebx * 4] ; ecx = Temp handler pointer or 0 … … 826 828 ; Store the information about the active trap/interrupt. 827 829 ; 828 mov eax, IMP(g_TRPM )830 mov eax, IMP(g_TRPMCPU) 829 831 movzx edx, byte [esp + 0h + ESPOFF] ; vector number 830 mov [eax + TRPM .uActiveVector], edx832 mov [eax + TRPMCPU.uActiveVector], edx 831 833 xor edx, edx 832 mov dword [eax + TRPM .enmActiveType], TRPM_HARDWARE_INT834 mov dword [eax + TRPMCPU.enmActiveType], TRPM_HARDWARE_INT 833 835 dec edx 834 mov [eax + TRPM .uActiveErrorCode], edx835 mov [eax + TRPM .uActiveCR2], edx836 mov [eax + TRPMCPU.uActiveErrorCode], edx 837 mov [eax + TRPMCPU.uActiveCR2], edx 836 838 %if GC_ARCH_BITS == 64 837 839 ; zero out the high dword 838 mov dword [eax + TRPM .uActiveErrorCode + 4], 0839 mov dword [eax + TRPM .uActiveCR2 + 4], 0840 mov dword [eax + TRPMCPU.uActiveErrorCode + 4], 0 841 mov dword [eax + TRPMCPU.uActiveCR2 + 4], 0 840 842 %endif 841 843 … … 873 875 ; 874 876 ; Reset TRPM state 875 mov eax, IMP(g_TRPM )877 mov eax, IMP(g_TRPMCPU) 876 878 xor edx, edx 877 879 dec edx ; edx = 0ffffffffh 878 xchg [eax + TRPM .uActiveVector], edx879 mov [eax + TRPM .uPrevVector], edx880 xchg [eax + TRPMCPU.uActiveVector], edx 881 mov [eax + TRPMCPU.uPrevVector], edx 880 882 881 883 ; Enable WP … … 925 927 ; 926 928 ; Reset TRPM state - don't record this. 927 mov eax, IMP(g_TRPM )928 mov dword [eax + TRPM .uActiveVector], 0ffffffffh929 mov eax, IMP(g_TRPMCPU) 930 mov dword [eax + TRPMCPU.uActiveVector], 0ffffffffh 929 931 930 932 ; -
trunk/src/VBox/VMM/VMMGC/VMMGCBuiltin.def
r13813 r19015 25 25 g_CPUM DATA 26 26 g_TRPM DATA 27 g_TRPMCPU DATA 27 28 g_Logger DATA 28 29 g_RelLogger DATA -
trunk/src/VBox/VMM/VMMGuruMeditation.cpp
r18927 r19015 265 265 RTGCUINT uErrorCode = 0xdeadface; 266 266 RTGCUINTPTR uCR2 = 0xdeadface; 267 int rc2 = TRPMQueryTrapAll(pV M, &u8TrapNo, &enmType, &uErrorCode, &uCR2);267 int rc2 = TRPMQueryTrapAll(pVCpu, &u8TrapNo, &enmType, &uErrorCode, &uCR2); 268 268 if (!HWACCMR3IsActive(pVM)) 269 269 { -
trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp
r18992 r19015 427 427 428 428 /* When external interrupts are pending, we should exit the VM when IF is set. */ 429 if ( !TRPMHasTrap(pV M)429 if ( !TRPMHasTrap(pVCpu) 430 430 && VM_FF_ISPENDING(pVM, (VM_FF_INTERRUPT_APIC|VM_FF_INTERRUPT_PIC))) 431 431 { … … 454 454 if (RT_SUCCESS(rc)) 455 455 { 456 rc = TRPMAssertTrap(pV M, u8Interrupt, TRPM_HARDWARE_INT);456 rc = TRPMAssertTrap(pVCpu, u8Interrupt, TRPM_HARDWARE_INT); 457 457 AssertRC(rc); 458 458 } … … 468 468 469 469 #ifdef VBOX_STRICT 470 if (TRPMHasTrap(pV M))470 if (TRPMHasTrap(pVCpu)) 471 471 { 472 472 uint8_t u8Vector; 473 rc = TRPMQueryTrapAll(pV M, &u8Vector, 0, 0, 0);473 rc = TRPMQueryTrapAll(pVCpu, &u8Vector, 0, 0, 0); 474 474 AssertRC(rc); 475 475 } … … 478 478 if ( pCtx->eflags.u32 & X86_EFL_IF 479 479 && (!VM_FF_ISSET(pVM, VM_FF_INHIBIT_INTERRUPTS)) 480 && TRPMHasTrap(pV M)480 && TRPMHasTrap(pVCpu) 481 481 ) 482 482 { … … 490 490 491 491 /* If a new event is pending, then dispatch it now. */ 492 rc = TRPMQueryTrapAll(pV M, &u8Vector, &enmType, &u32ErrorCode, 0);492 rc = TRPMQueryTrapAll(pVCpu, &u8Vector, &enmType, &u32ErrorCode, 0); 493 493 AssertRC(rc); 494 494 Assert(pCtx->eflags.Bits.u1IF == 1 || enmType == TRPM_TRAP); … … 496 496 497 497 /* Clear the pending trap. */ 498 rc = TRPMResetTrap(pV M);498 rc = TRPMResetTrap(pVCpu); 499 499 AssertRC(rc); 500 500 … … 1408 1408 Log2(("Page fault at %RGv cr2=%RGv error code %x\n", (RTGCPTR)pCtx->rip, uFaultAddress, errCode)); 1409 1409 /* Exit qualification contains the linear address of the page fault. */ 1410 TRPMAssertTrap(pV M, X86_XCPT_PF, TRPM_TRAP);1411 TRPMSetErrorCode(pV M, errCode);1412 TRPMSetFaultAddress(pV M, uFaultAddress);1410 TRPMAssertTrap(pVCpu, X86_XCPT_PF, TRPM_TRAP); 1411 TRPMSetErrorCode(pVCpu, errCode); 1412 TRPMSetFaultAddress(pVCpu, uFaultAddress); 1413 1413 1414 1414 /* Forward it to our trap handler first, in case our shadow pages are out of sync. */ … … 1420 1420 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitShadowPF); 1421 1421 1422 TRPMResetTrap(pV M);1422 TRPMResetTrap(pVCpu); 1423 1423 1424 1424 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit1, x); … … 1433 1433 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitGuestPF); 1434 1434 /* The error code might have been changed. */ 1435 errCode = TRPMGetErrorCode(pV M);1436 1437 TRPMResetTrap(pV M);1435 errCode = TRPMGetErrorCode(pVCpu); 1436 1437 TRPMResetTrap(pVCpu); 1438 1438 1439 1439 /* Now we must update CR2. */ … … 1457 1457 #endif 1458 1458 /* Need to go back to the recompiler to emulate the instruction. */ 1459 TRPMResetTrap(pV M);1459 TRPMResetTrap(pVCpu); 1460 1460 break; 1461 1461 } … … 1546 1546 Log(("Nested page fault at %RGv cr2=%RGp error code %x\n", (RTGCPTR)pCtx->rip, uFaultAddress, errCode)); 1547 1547 /* Exit qualification contains the linear address of the page fault. */ 1548 TRPMAssertTrap(pV M, X86_XCPT_PF, TRPM_TRAP);1549 TRPMSetErrorCode(pV M, errCode);1550 TRPMSetFaultAddress(pV M, uFaultAddress);1548 TRPMAssertTrap(pVCpu, X86_XCPT_PF, TRPM_TRAP); 1549 TRPMSetErrorCode(pVCpu, errCode); 1550 TRPMSetFaultAddress(pVCpu, uFaultAddress); 1551 1551 1552 1552 /* Handle the pagefault trap for the nested shadow table. */ … … 1565 1565 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitShadowPF); 1566 1566 1567 TRPMResetTrap(pV M);1567 TRPMResetTrap(pVCpu); 1568 1568 1569 1569 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit1, x); … … 1576 1576 #endif 1577 1577 /* Need to go back to the recompiler to emulate the instruction. */ 1578 TRPMResetTrap(pV M);1578 TRPMResetTrap(pVCpu); 1579 1579 break; 1580 1580 } -
trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp
r18992 r19015 736 736 737 737 /* When external interrupts are pending, we should exit the VM when IF is set. */ 738 if ( !TRPMHasTrap(pV M)738 if ( !TRPMHasTrap(pVCpu) 739 739 && VM_FF_ISPENDING(pVM, (VM_FF_INTERRUPT_APIC|VM_FF_INTERRUPT_PIC))) 740 740 { … … 759 759 if (RT_SUCCESS(rc)) 760 760 { 761 rc = TRPMAssertTrap(pV M, u8Interrupt, TRPM_HARDWARE_INT);761 rc = TRPMAssertTrap(pVCpu, u8Interrupt, TRPM_HARDWARE_INT); 762 762 AssertRC(rc); 763 763 } … … 775 775 776 776 #ifdef VBOX_STRICT 777 if (TRPMHasTrap(pV M))777 if (TRPMHasTrap(pVCpu)) 778 778 { 779 779 uint8_t u8Vector; 780 rc = TRPMQueryTrapAll(pV M, &u8Vector, 0, 0, 0);780 rc = TRPMQueryTrapAll(pVCpu, &u8Vector, 0, 0, 0); 781 781 AssertRC(rc); 782 782 } … … 785 785 if ( pCtx->eflags.u32 & X86_EFL_IF 786 786 && (!VM_FF_ISSET(pVM, VM_FF_INHIBIT_INTERRUPTS)) 787 && TRPMHasTrap(pV M)787 && TRPMHasTrap(pVCpu) 788 788 ) 789 789 { … … 795 795 796 796 /* If a new event is pending, then dispatch it now. */ 797 rc = TRPMQueryTrapAll(pV M, &u8Vector, &enmType, &errCode, 0);797 rc = TRPMQueryTrapAll(pVCpu, &u8Vector, &enmType, &errCode, 0); 798 798 AssertRC(rc); 799 799 Assert(pCtx->eflags.Bits.u1IF == 1 || enmType == TRPM_TRAP); … … 801 801 802 802 /* Clear the pending trap. */ 803 rc = TRPMResetTrap(pV M);803 rc = TRPMResetTrap(pVCpu); 804 804 AssertRC(rc); 805 805 … … 2384 2384 Log2(("Page fault at %RGv error code %x\n", exitQualification, errCode)); 2385 2385 /* Exit qualification contains the linear address of the page fault. */ 2386 TRPMAssertTrap(pV M, X86_XCPT_PF, TRPM_TRAP);2387 TRPMSetErrorCode(pV M, errCode);2388 TRPMSetFaultAddress(pV M, exitQualification);2386 TRPMAssertTrap(pVCpu, X86_XCPT_PF, TRPM_TRAP); 2387 TRPMSetErrorCode(pVCpu, errCode); 2388 TRPMSetFaultAddress(pVCpu, exitQualification); 2389 2389 2390 2390 /* Forward it to our trap handler first, in case our shadow pages are out of sync. */ … … 2396 2396 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitShadowPF); 2397 2397 2398 TRPMResetTrap(pV M);2398 TRPMResetTrap(pVCpu); 2399 2399 2400 2400 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit2Sub3, y3); … … 2410 2410 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitGuestPF); 2411 2411 /* The error code might have been changed. */ 2412 errCode = TRPMGetErrorCode(pV M);2413 2414 TRPMResetTrap(pV M);2412 errCode = TRPMGetErrorCode(pVCpu); 2413 2414 TRPMResetTrap(pVCpu); 2415 2415 2416 2416 /* Now we must update CR2. */ … … 2427 2427 #endif 2428 2428 /* Need to go back to the recompiler to emulate the instruction. */ 2429 TRPMResetTrap(pV M);2429 TRPMResetTrap(pVCpu); 2430 2430 break; 2431 2431 } … … 2849 2849 2850 2850 /* GCPhys contains the guest physical address of the page fault. */ 2851 TRPMAssertTrap(pV M, X86_XCPT_PF, TRPM_TRAP);2852 TRPMSetErrorCode(pV M, errCode);2853 TRPMSetFaultAddress(pV M, GCPhys);2851 TRPMAssertTrap(pVCpu, X86_XCPT_PF, TRPM_TRAP); 2852 TRPMSetErrorCode(pVCpu, errCode); 2853 TRPMSetFaultAddress(pVCpu, GCPhys); 2854 2854 2855 2855 /* Handle the pagefault trap for the nested shadow table. */ … … 2861 2861 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitReasonNPF); 2862 2862 2863 TRPMResetTrap(pV M);2863 TRPMResetTrap(pVCpu); 2864 2864 2865 2865 goto ResumeExecution; … … 2871 2871 #endif 2872 2872 /* Need to go back to the recompiler to emulate the instruction. */ 2873 TRPMResetTrap(pV M);2873 TRPMResetTrap(pVCpu); 2874 2874 break; 2875 2875 } -
trunk/src/VBox/VMM/VMMR0/TRPMR0.cpp
r15414 r19015 28 28 #include "TRPMInternal.h" 29 29 #include <VBox/vm.h> 30 #include <VBox/vmm.h> 30 31 #include <VBox/err.h> 31 32 #include <VBox/log.h> … … 42 43 VMMR0DECL(void) TRPMR0DispatchHostInterrupt(PVM pVM) 43 44 { 44 RTUINT uActiveVector = pVM->trpm.s.uActiveVector; 45 pVM->trpm.s.uActiveVector = ~0; 45 PVMCPU pVCpu = VMMGetCpu0(pVM); 46 RTUINT uActiveVector = pVCpu->trpm.s.uActiveVector; 47 48 pVCpu->trpm.s.uActiveVector = ~0; 46 49 AssertMsgReturnVoid(uActiveVector < 256, ("uActiveVector=%#x is invalid! (More assertions to come, please enjoy!)\n", uActiveVector)); 47 50 -
trunk/src/VBox/VMM/VMMTests.cpp
r18992 r19015 127 127 && u8Trap != 3 /* guest only, we're not in guest. */ 128 128 && u8Trap != 1 /* guest only, we're not in guest. */ 129 && u8Trap != TRPMGetTrapNo(pV M))130 { 131 RTPrintf("VMM: FAILURE - Trap %#x expected %#x\n", TRPMGetTrapNo(pV M), u8Trap);129 && u8Trap != TRPMGetTrapNo(pVCpu)) 130 { 131 RTPrintf("VMM: FAILURE - Trap %#x expected %#x\n", TRPMGetTrapNo(pVCpu), u8Trap); 132 132 fDump = true; 133 133 } -
trunk/src/VBox/VMM/testcase/tstVMStructGC.cpp
r18984 r19015 853 853 854 854 GEN_CHECK_SIZE(TRPM); // has .mac 855 GEN_CHECK_SIZE(TRPMCPU); // has .mac 855 856 GEN_CHECK_SIZE(VM); // has .mac 856 857 GEN_CHECK_SIZE(VMM); -
trunk/src/VBox/VMM/testcase/tstVMStructSize.cpp
r18927 r19015 160 160 CHECK_PADDING_VMCPU(em); 161 161 CHECK_PADDING_VMCPU(hwaccm); 162 CHECK_PADDING_VMCPU(trpm); 162 163 CHECK_PADDING_VMCPU(tm); 163 164 CHECK_PADDING_VMCPU(vmm); -
trunk/src/recompiler_new/VBoxREMWrapper.cpp
r18992 r19015 910 910 static const REMPARMDESC g_aArgsTRPMAssertTrap[] = 911 911 { 912 { REMPARMDESC_FLAGS_INT, sizeof(PVM ), NULL },912 { REMPARMDESC_FLAGS_INT, sizeof(PVMCPU), NULL }, 913 913 { REMPARMDESC_FLAGS_INT, sizeof(uint8_t), NULL }, 914 914 { REMPARMDESC_FLAGS_INT, sizeof(TRPMEVENT), NULL } … … 916 916 static const REMPARMDESC g_aArgsTRPMQueryTrap[] = 917 917 { 918 { REMPARMDESC_FLAGS_INT, sizeof(PVM ), NULL },918 { REMPARMDESC_FLAGS_INT, sizeof(PVMCPU), NULL }, 919 919 { REMPARMDESC_FLAGS_INT, sizeof(uint8_t *), NULL }, 920 920 { REMPARMDESC_FLAGS_INT, sizeof(TRPMEVENT *), NULL } … … 922 922 static const REMPARMDESC g_aArgsTRPMSetErrorCode[] = 923 923 { 924 { REMPARMDESC_FLAGS_INT, sizeof(PVM ), NULL },924 { REMPARMDESC_FLAGS_INT, sizeof(PVMCPU), NULL }, 925 925 { REMPARMDESC_FLAGS_GCPTR, sizeof(RTGCUINT), NULL } 926 926 }; 927 927 static const REMPARMDESC g_aArgsTRPMSetFaultAddress[] = 928 928 { 929 { REMPARMDESC_FLAGS_INT, sizeof(PVM ), NULL },929 { REMPARMDESC_FLAGS_INT, sizeof(PVMCPU), NULL }, 930 930 { REMPARMDESC_FLAGS_GCPTR, sizeof(RTGCUINT), NULL } 931 931 }; -
trunk/src/recompiler_new/VBoxRecompiler.c
r18992 r19015 2115 2115 */ 2116 2116 pVM->rem.s.Env.exception_index = -1; /** @todo this won't work :/ */ 2117 rc = TRPMQueryTrap(pV M, &u8TrapNo, &enmType);2117 rc = TRPMQueryTrap(pVCpu, &u8TrapNo, &enmType); 2118 2118 if (RT_SUCCESS(rc)) 2119 2119 { … … 2159 2159 { 2160 2160 case 0x0e: 2161 pVM->rem.s.Env.cr[2] = TRPMGetFaultAddress(pV M);2161 pVM->rem.s.Env.cr[2] = TRPMGetFaultAddress(pVCpu); 2162 2162 /* fallthru */ 2163 2163 case 0x0a: case 0x0b: case 0x0c: case 0x0d: 2164 pVM->rem.s.Env.error_code = TRPMGetErrorCode(pV M);2164 pVM->rem.s.Env.error_code = TRPMGetErrorCode(pVCpu); 2165 2165 break; 2166 2166 … … 2174 2174 * We can now reset the active trap since the recompiler is gonna have a go at it. 2175 2175 */ 2176 rc = TRPMResetTrap(pV M);2176 rc = TRPMResetTrap(pVCpu); 2177 2177 AssertRC(rc); 2178 2178 Log2(("REMR3State: trap=%02x errcd=%RGv cr2=%RGv nexteip=%RGv%s\n", pVM->rem.s.Env.exception_index, (RTGCPTR)pVM->rem.s.Env.error_code, … … 2425 2425 2426 2426 Log(("REMR3StateBack: Pending trap %x %d\n", pVM->rem.s.Env.exception_index, pVM->rem.s.Env.exception_is_int)); 2427 rc = TRPMAssertTrap(pV M, pVM->rem.s.Env.exception_index, (pVM->rem.s.Env.exception_is_int) ? TRPM_SOFTWARE_INT : TRPM_HARDWARE_INT);2427 rc = TRPMAssertTrap(pVCpu, pVM->rem.s.Env.exception_index, (pVM->rem.s.Env.exception_is_int) ? TRPM_SOFTWARE_INT : TRPM_HARDWARE_INT); 2428 2428 AssertRC(rc); 2429 2429 switch (pVM->rem.s.Env.exception_index) 2430 2430 { 2431 2431 case 0x0e: 2432 TRPMSetFaultAddress(pV M, pCtx->cr2);2432 TRPMSetFaultAddress(pVCpu, pCtx->cr2); 2433 2433 /* fallthru */ 2434 2434 case 0x0a: case 0x0b: case 0x0c: case 0x0d: 2435 2435 case 0x11: case 0x08: /* 0 */ 2436 TRPMSetErrorCode(pV M, pVM->rem.s.Env.error_code);2436 TRPMSetErrorCode(pVCpu, pVM->rem.s.Env.error_code); 2437 2437 break; 2438 2438 }
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器