Changeset 4776 in vbox for trunk/src/VBox
- Timestamp:
- Sep 13, 2007 3:29:33 PM (17 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/Makefile.kmk
r4738 r4776 354 354 VMMAll/TMAllReal.cpp \ 355 355 VMMAll/TMAllVirtual.cpp \ 356 VMMAll/VMAll.cpp \ 357 PATM/VMMAll/PATMAll.cpp 356 VMMAll/VMAll.cpp 358 357 359 358 ifeq ($(VBOX_LDR_FMT),pe) -
trunk/src/VBox/VMM/PATM/CSAM.cpp
r4071 r4776 548 548 * 549 549 */ 550 static HCPTRTYPE(void *) CSAMGCVirtToHCVirt(PVM pVM, PCSAMP2GLOOKUPREC pCacheRec, GCPTRTYPE(uint8_t *) pGCPtr)550 static R3PTRTYPE(void *) CSAMGCVirtToHCVirt(PVM pVM, PCSAMP2GLOOKUPREC pCacheRec, GCPTRTYPE(uint8_t *) pGCPtr) 551 551 { 552 552 int rc; 553 HCPTRTYPE(void *) pHCPtr;553 R3PTRTYPE(void *) pHCPtr; 554 554 555 555 STAM_PROFILE_START(&pVM->csam.s.StatTimeAddrConv, a); … … 575 575 return NULL; 576 576 } 577 ////invalid? Assert(sizeof( HCPTRTYPE(uint8_t*)) == sizeof(uint32_t));578 579 pCacheRec->pPageLocStartHC = ( HCPTRTYPE(uint8_t*))((RTHCUINTPTR)pHCPtr & PAGE_BASE_HC_MASK);577 ////invalid? Assert(sizeof(R3PTRTYPE(uint8_t*)) == sizeof(uint32_t)); 578 579 pCacheRec->pPageLocStartHC = (R3PTRTYPE(uint8_t*))((RTHCUINTPTR)pHCPtr & PAGE_BASE_HC_MASK); 580 580 pCacheRec->pGuestLoc = pGCPtr & PAGE_BASE_GC_MASK; 581 581 STAM_PROFILE_STOP(&pVM->csam.s.StatTimeAddrConv, a); … … 1072 1072 int rc = VWRN_CONTINUE_ANALYSIS; 1073 1073 uint32_t opsize; 1074 HCPTRTYPE(uint8_t *) pCurInstrHC = 0;1074 R3PTRTYPE(uint8_t *) pCurInstrHC = 0; 1075 1075 bool disret; 1076 1076 -
trunk/src/VBox/VMM/PATM/CSAMInternal.h
r4071 r4776 70 70 typedef struct 71 71 { 72 HCPTRTYPE(uint8_t *) pPageLocStartHC;73 HCPTRTYPE(uint8_t *) pPageLocEndHC;72 R3PTRTYPE(uint8_t *) pPageLocStartHC; 73 R3PTRTYPE(uint8_t *) pPageLocEndHC; 74 74 GCPTRTYPE(uint8_t *) pGuestLoc; 75 75 uint32_t depth; //call/jump depth … … 146 146 #endif 147 147 148 HCPTRTYPE(PAVLPVNODECORE) pPageTree;148 R3PTRTYPE(PAVLPVNODECORE) pPageTree; 149 149 150 150 /* Array to store previously scanned dangerous instructions, so we don't need to … … 157 157 GCPTRTYPE(RTGCPTR *) pPDBitmapGC; 158 158 GCPTRTYPE(RTHCPTR *) pPDHCBitmapGC; 159 HCPTRTYPE(uint8_t **) pPDBitmapHC;160 HCPTRTYPE(RTGCPTR *) pPDGCBitmapHC;159 R3PTRTYPE(uint8_t **) pPDBitmapHC; 160 R3PTRTYPE(RTGCPTR *) pPDGCBitmapHC; 161 161 162 162 /* Temporary storage during load/save state */ 163 163 struct 164 164 { 165 HCPTRTYPE(PSSMHANDLE) pSSM;165 R3PTRTYPE(PSSMHANDLE) pSSM; 166 166 uint32_t cPageRecords; 167 167 uint32_t cPatchPageRecords; … … 238 238 239 239 /** 240 * Check if the current instruction is the start of a known guest block that requires our attention241 *242 * @param pVM The VM to operate on.243 * @param pInstrGC Guest context pointer of instruction to check244 * @param pInstrHC Host context pointer of instruction to check245 * @param opcode Opcode of instruction at pInstrGC246 *247 * @returns true if patched248 *249 */250 bool csamCheckGuestSpecificPatch(PVM pVM, RTGCPTR pInstrGC, HCPTRTYPE(uint8_t *) pInstrHC, uint32_t opcode);251 252 /**253 240 * Calculate the branch destination 254 241 * -
trunk/src/VBox/VMM/PATM/PATM.cpp
r4772 r4776 915 915 * @param pAddrGC Guest context address 916 916 */ 917 PATMR3DECL(bool) PATMR3IsPatchHCAddr(PVM pVM, HCPTRTYPE(uint8_t *) pAddrHC)917 PATMR3DECL(bool) PATMR3IsPatchHCAddr(PVM pVM, R3PTRTYPE(uint8_t *) pAddrHC) 918 918 { 919 919 return (pAddrHC >= pVM->patm.s.pPatchMemHC && pAddrHC < pVM->patm.s.pPatchMemHC + pVM->patm.s.cbPatchMem) ? true : false; … … 941 941 * @param pAddrGC GC pointer 942 942 */ 943 PATMR3DECL( HCPTRTYPE(void *)) PATMR3GCPtrToHCPtr(PVM pVM, RTGCPTR pAddrGC)943 PATMR3DECL(R3PTRTYPE(void *)) PATMR3GCPtrToHCPtr(PVM pVM, RTGCPTR pAddrGC) 944 944 { 945 945 if (pVM->patm.s.pPatchMemGC <= pAddrGC && pVM->patm.s.pPatchMemGC + pVM->patm.s.cbPatchMem > pAddrGC) … … 973 973 * 974 974 */ 975 HCPTRTYPE(uint8_t *) PATMGCVirtToHCVirt(PVM pVM, PPATCHINFO pPatch, GCPTRTYPE(uint8_t *) pGCPtr)975 R3PTRTYPE(uint8_t *) PATMGCVirtToHCVirt(PVM pVM, PPATCHINFO pPatch, GCPTRTYPE(uint8_t *) pGCPtr) 976 976 { 977 977 int rc; 978 HCPTRTYPE(uint8_t *) pHCPtr;978 R3PTRTYPE(uint8_t *) pHCPtr; 979 979 uint32_t offset; 980 980 … … 996 996 return NULL; 997 997 } 998 ////invalid? Assert(sizeof( HCPTRTYPE(uint8_t*)) == sizeof(uint32_t));999 1000 pPatch->cacheRec.pPatchLocStartHC = ( HCPTRTYPE(uint8_t*))((RTHCUINTPTR)pHCPtr & PAGE_BASE_HC_MASK);998 ////invalid? Assert(sizeof(R3PTRTYPE(uint8_t*)) == sizeof(uint32_t)); 999 1000 pPatch->cacheRec.pPatchLocStartHC = (R3PTRTYPE(uint8_t*))((RTHCUINTPTR)pHCPtr & PAGE_BASE_HC_MASK); 1001 1001 pPatch->cacheRec.pGuestLoc = pGCPtr & PAGE_BASE_GC_MASK; 1002 1002 return pHCPtr; … … 1704 1704 int disret; 1705 1705 GCPTRTYPE(uint8_t *) pNextInstrGC, pReturnInstrGC; 1706 HCPTRTYPE(uint8_t *) pNextInstrHC;1706 R3PTRTYPE(uint8_t *) pNextInstrHC; 1707 1707 1708 1708 pPatch->flags |= PATMFL_FOUND_PATCHEND; … … 2082 2082 int rc = VWRN_CONTINUE_ANALYSIS; 2083 2083 uint32_t opsize, delta; 2084 HCPTRTYPE(uint8_t *) pCurInstrHC = 0;2084 R3PTRTYPE(uint8_t *) pCurInstrHC = 0; 2085 2085 bool disret; 2086 2086 char szOutput[256]; … … 2253 2253 int rc = VWRN_CONTINUE_ANALYSIS; 2254 2254 uint32_t opsize; 2255 HCPTRTYPE(uint8_t *) pCurInstrHC = 0;2255 R3PTRTYPE(uint8_t *) pCurInstrHC = 0; 2256 2256 bool disret; 2257 2257 #ifdef LOG_ENABLED … … 2635 2635 * 2636 2636 */ 2637 PATMR3DECL(int) PATMR3PatchBlock(PVM pVM, RTGCPTR pInstrGC, HCPTRTYPE(uint8_t *) pInstrHC,2637 PATMR3DECL(int) PATMR3PatchBlock(PVM pVM, RTGCPTR pInstrGC, R3PTRTYPE(uint8_t *) pInstrHC, 2638 2638 uint32_t uOpcode, uint32_t uOpSize, PPATMPATCHREC pPatchRec) 2639 2639 { … … 2862 2862 * 2863 2863 */ 2864 static int patmIdtHandler(PVM pVM, RTGCPTR pInstrGC, HCPTRTYPE(uint8_t *) pInstrHC,2864 static int patmIdtHandler(PVM pVM, RTGCPTR pInstrGC, R3PTRTYPE(uint8_t *) pInstrHC, 2865 2865 uint32_t uOpSize, PPATMPATCHREC pPatchRec) 2866 2866 { … … 3743 3743 * 3744 3744 */ 3745 PATMR3DECL(int) PATMR3PatchInstrInt3(PVM pVM, RTGCPTR pInstrGC, HCPTRTYPE(uint8_t *) pInstrHC, DISCPUSTATE *pCpu, PPATCHINFO pPatch)3745 PATMR3DECL(int) PATMR3PatchInstrInt3(PVM pVM, RTGCPTR pInstrGC, R3PTRTYPE(uint8_t *) pInstrHC, DISCPUSTATE *pCpu, PPATCHINFO pPatch) 3746 3746 { 3747 3747 uint8_t ASMInt3 = 0xCC; … … 3798 3798 * 3799 3799 */ 3800 int patmPatchJump(PVM pVM, RTGCPTR pInstrGC, HCPTRTYPE(uint8_t *) pInstrHC, DISCPUSTATE *pCpu, PPATMPATCHREC pPatchRec)3800 int patmPatchJump(PVM pVM, RTGCPTR pInstrGC, R3PTRTYPE(uint8_t *) pInstrHC, DISCPUSTATE *pCpu, PPATMPATCHREC pPatchRec) 3801 3801 { 3802 3802 PPATCHINFO pPatch = &pPatchRec->patch; … … 3941 3941 { 3942 3942 DISCPUSTATE cpu; 3943 HCPTRTYPE(uint8_t *) pInstrHC;3943 R3PTRTYPE(uint8_t *) pInstrHC; 3944 3944 uint32_t opsize; 3945 3945 PPATMPATCHREC pPatchRec; … … 5060 5060 PATCHINFO patch = {0}; 5061 5061 DISCPUSTATE cpu; 5062 HCPTRTYPE(uint8_t *) pInstrHC;5062 R3PTRTYPE(uint8_t *) pInstrHC; 5063 5063 uint32_t opsize; 5064 5064 bool disret; -
trunk/src/VBox/VMM/PATM/PATMInternal.h
r4071 r4776 131 131 132 132 uint32_t uType; 133 HCPTRTYPE(uint8_t *) pRelocPos;133 R3PTRTYPE(uint8_t *) pRelocPos; 134 134 RTGCPTR pSource; 135 135 RTGCPTR pDest; … … 138 138 typedef struct 139 139 { 140 HCPTRTYPE(uint8_t *) pPatchLocStartHC;141 HCPTRTYPE(uint8_t *) pPatchLocEndHC;140 R3PTRTYPE(uint8_t *) pPatchLocStartHC; 141 R3PTRTYPE(uint8_t *) pPatchLocEndHC; 142 142 GCPTRTYPE(uint8_t *) pGuestLoc; 143 143 uint32_t opsize; … … 149 149 AVLPVNODECORE Core; 150 150 151 HCPTRTYPE(uint8_t *) pJumpHC;151 R3PTRTYPE(uint8_t *) pJumpHC; 152 152 GCPTRTYPE(uint8_t *) pTargetGC; 153 153 uint32_t offDispl; … … 197 197 { 198 198 /* Temporary tree for storing the addresses of illegal instructions. */ 199 HCPTRTYPE(PAVLPVNODECORE) IllegalInstrTree;199 R3PTRTYPE(PAVLPVNODECORE) IllegalInstrTree; 200 200 uint32_t nrIllegalInstr; 201 201 … … 204 204 205 205 /* Temporary tree of encountered jumps. (debug only) */ 206 HCPTRTYPE(PAVLPVNODECORE) DisasmJumpTree;206 R3PTRTYPE(PAVLPVNODECORE) DisasmJumpTree; 207 207 208 208 int32_t nrCalls; … … 223 223 224 224 GCPTRTYPE(uint8_t *) pPrivInstrGC; //GC pointer of privileged instruction 225 HCPTRTYPE(uint8_t *) pPrivInstrHC; //HC pointer of privileged instruction225 R3PTRTYPE(uint8_t *) pPrivInstrHC; //HC pointer of privileged instruction 226 226 uint8_t aPrivInstr[MAX_INSTR_SIZE]; 227 227 uint32_t cbPrivInstr; … … 248 248 249 249 /* Tree of fixup records for the patch. */ 250 HCPTRTYPE(PAVLPVNODECORE) FixupTree;250 R3PTRTYPE(PAVLPVNODECORE) FixupTree; 251 251 int32_t nrFixups; 252 252 253 253 /* Tree of jumps inside the generated patch code. */ 254 254 int32_t nrJumpRecs; 255 HCPTRTYPE(PAVLPVNODECORE) JumpTree;255 R3PTRTYPE(PAVLPVNODECORE) JumpTree; 256 256 257 257 /** … … 259 259 * instruction in the patch block. 260 260 */ 261 HCPTRTYPE(PAVLU32NODECORE) Patch2GuestAddrTree;262 HCPTRTYPE(PAVLGCPTRNODECORE) Guest2PatchAddrTree;261 R3PTRTYPE(PAVLU32NODECORE) Patch2GuestAddrTree; 262 R3PTRTYPE(PAVLGCPTRNODECORE) Guest2PatchAddrTree; 263 263 uint32_t nrPatch2GuestRecs; 264 264 #if HC_ARCH_BITS == 64 … … 270 270 271 271 /* Temporary information during patch creation. Don't waste hypervisor memory for this. */ 272 HCPTRTYPE(PPATCHINFOTEMP) pTempInfo;272 R3PTRTYPE(PPATCHINFOTEMP) pTempInfo; 273 273 274 274 /* Count the number of writes to the corresponding guest code. */ … … 323 323 uint32_t cMaxPatches; 324 324 /** Array of patch pointers for this page. */ 325 HCPTRTYPE(PPATCHINFO *) aPatch;325 R3PTRTYPE(PPATCHINFO *) aPatch; 326 326 } PATMPATCHPAGE, *PPATMPATCHPAGE; 327 327 … … 360 360 361 361 GCPTRTYPE(uint8_t *) pPatchMemGC; 362 HCPTRTYPE(uint8_t *) pPatchMemHC;362 R3PTRTYPE(uint8_t *) pPatchMemHC; 363 363 uint32_t cbPatchMem; 364 364 uint32_t offPatchMem; … … 368 368 369 369 /* GC PATM state pointers */ 370 HCPTRTYPE(PPATMGCSTATE) pGCStateHC;370 R3PTRTYPE(PPATMGCSTATE) pGCStateHC; 371 371 GCPTRTYPE(PPATMGCSTATE) pGCStateGC; 372 372 373 373 /** PATM stack page for call instruction execution. (2 parts: one for our private stack and one to store the original return address */ 374 374 GCPTRTYPE(RTGCPTR *) pGCStackGC; 375 HCPTRTYPE(RTGCPTR *) pGCStackHC;375 R3PTRTYPE(RTGCPTR *) pGCStackHC; 376 376 377 377 /** GC pointer to CPUMCTX structure. */ … … 380 380 /* GC statistics pointers */ 381 381 GCPTRTYPE(PSTAMRATIOU32) pStatsGC; 382 HCPTRTYPE(PSTAMRATIOU32) pStatsHC;382 R3PTRTYPE(PSTAMRATIOU32) pStatsHC; 383 383 384 384 /* Current free index value (uPatchRun/uPatchTrap arrays). */ … … 399 399 /** Pointer to the patch tree for instructions replaced by 'int 3'. */ 400 400 GCPTRTYPE(PPATMTREES) PatchLookupTreeGC; 401 HCPTRTYPE(PPATMTREES) PatchLookupTreeHC;401 R3PTRTYPE(PPATMTREES) PatchLookupTreeHC; 402 402 403 403 /** Global PATM lookup and call function (used by call patches). */ … … 411 411 412 412 /** Fake patch record for global functions. */ 413 HCPTRTYPE(PPATMPATCHREC) pGlobalPatchRec;413 R3PTRTYPE(PPATMPATCHREC) pGlobalPatchRec; 414 414 415 415 /** Pointer to original sysenter handler */ … … 433 433 struct 434 434 { 435 HCPTRTYPE(PSSMHANDLE) pSSM;435 R3PTRTYPE(PSSMHANDLE) pSSM; 436 436 uint32_t cPatches; 437 437 #if HC_ARCH_BITS == 64 … … 612 612 * 613 613 */ 614 HCPTRTYPE(uint8_t *) PATMGCVirtToHCVirt(PVM pVM, PPATCHINFO pPatch, GCPTRTYPE(uint8_t *) pGCPtr);614 R3PTRTYPE(uint8_t *) PATMGCVirtToHCVirt(PVM pVM, PPATCHINFO pPatch, GCPTRTYPE(uint8_t *) pGCPtr); 615 615 616 616 … … 681 681 PVM pVM; 682 682 PPATCHINFO pPatchInfo; 683 HCPTRTYPE(uint8_t *) pInstrHC;683 R3PTRTYPE(uint8_t *) pInstrHC; 684 684 RTGCPTR pInstrGC; 685 685 uint32_t fReadFlags; … … 742 742 * 743 743 */ 744 PATMR3DECL(int) PATMR3PatchBlock(PVM pVM, RTGCPTR pInstrGC, HCPTRTYPE(uint8_t *) pInstrHC,744 PATMR3DECL(int) PATMR3PatchBlock(PVM pVM, RTGCPTR pInstrGC, R3PTRTYPE(uint8_t *) pInstrHC, 745 745 uint32_t uOpcode, uint32_t uOpSize, PPATMPATCHREC pPatchRec); 746 746 … … 759 759 * 760 760 */ 761 PATMR3DECL(int) PATMR3PatchInstrInt3(PVM pVM, RTGCPTR pInstrGC, HCPTRTYPE(uint8_t *) pInstrHC, DISCPUSTATE *pCpu, PPATCHINFO pPatch);761 PATMR3DECL(int) PATMR3PatchInstrInt3(PVM pVM, RTGCPTR pInstrGC, R3PTRTYPE(uint8_t *) pInstrHC, DISCPUSTATE *pCpu, PPATCHINFO pPatch); 762 762 763 763 /** -
trunk/src/VBox/VMM/PDMInternal.h
r4767 r4776 79 79 /** Pointer to the next instance (HC Ptr). 80 80 * (Head is pointed to by PDM::pDevInstances.) */ 81 HCPTRTYPE(PPDMDEVINS) pNextHC;81 R3PTRTYPE(PPDMDEVINS) pNextHC; 82 82 /** Pointer to the next per device instance (HC Ptr). 83 83 * (Head is pointed to by PDMDEV::pInstances.) */ 84 HCPTRTYPE(PPDMDEVINS) pPerDeviceNextHC;84 R3PTRTYPE(PPDMDEVINS) pPerDeviceNextHC; 85 85 86 86 /** Pointer to device structure - HC Ptr. */ … … 90 90 HCPTRTYPE(PVM) pVMHC; 91 91 /** Pointer to the list of logical units associated with the device. (FIFO) */ 92 HCPTRTYPE(PPDMLUN) pLunsHC;92 R3PTRTYPE(PPDMLUN) pLunsHC; 93 93 /** Configuration handle to the instance node. */ 94 HCPTRTYPE(PCFGMNODE) pCfgHandle;94 R3PTRTYPE(PCFGMNODE) pCfgHandle; 95 95 /** HC pointer to associated PCI device structure. */ 96 HCPTRTYPE(struct PCIDevice *)pPciDeviceHC;96 R3R0PTRTYPE(struct PCIDevice *) pPciDeviceHC; 97 97 /** HC pointer to associated PCI bus structure. */ 98 HCPTRTYPE(PPDMPCIBUS)pPciBusHC;98 R3R0PTRTYPE(PPDMPCIBUS) pPciBusHC; 99 99 100 100 /** GC pointer to associated PCI device structure. */ -
trunk/src/VBox/VMM/SELMInternal.h
r4071 r4776 85 85 /** Pointer to the GCs - HC Ptr. 86 86 * This size is governed by SELM_GDT_ELEMENTS. */ 87 HCPTRTYPE(PVBOXDESC)paGdtHC;87 R3R0PTRTYPE(PVBOXDESC) paGdtHC; 88 88 /** Pointer to the GCs - GC Ptr. 89 89 * This is not initialized until the first relocation because it's used to … … 96 96 97 97 /** HC Pointer to the LDT shadow area placed in Hypervisor memory arena. */ 98 HCPTRTYPE(void *) HCPtrLdt;98 R3PTRTYPE(void *) HCPtrLdt; 99 99 /** GC Pointer to the LDT shadow area placed in Hypervisor memory arena. */ 100 100 GCPTRTYPE(void *) GCPtrLdt; -
trunk/src/VBox/VMM/SSMInternal.h
r4071 r4776 175 175 176 176 /** FIFO of data entity descriptors. */ 177 HCPTRTYPE(PSSMUNIT) pHead;177 R3PTRTYPE(PSSMUNIT) pHead; 178 178 179 179 } SSM; -
trunk/src/VBox/VMM/STAMInternal.h
r4071 r4776 112 112 RTUINT uPadding; 113 113 /** Pointer to the first sample. */ 114 HCPTRTYPE(PSTAMDESC) pHead;114 R3PTRTYPE(PSTAMDESC) pHead; 115 115 /** RW Lock for the list. */ 116 116 RTSEMRW RWSem; -
trunk/src/VBox/VMM/TMInternal.h
r4071 r4776 172 172 PTMTIMERR3 pBigPrev; 173 173 /** Pointer to the timer description. */ 174 HCPTRTYPE(const char *) pszDesc;174 R3PTRTYPE(const char *) pszDesc; 175 175 /** Pointer to the VM the timer belongs to - R3 Ptr. */ 176 176 PVMR3 pVMR3; -
trunk/src/VBox/VMM/VMMAll/SELMAll.cpp
r4211 r4776 694 694 } 695 695 696 696 #ifndef IN_RING0 697 697 /** 698 698 * Gets the hypervisor code selector (CS). … … 748 748 return pVM->selm.s.aHyperSel[SELM_HYPER_SEL_TSS_TRAP08]; 749 749 } 750 751 750 752 751 /** … … 767 766 return MMHyperHC2GC(pVM, pVM->selm.s.paGdtHC); 768 767 } 769 768 #endif /* IN_RING0 */ 770 769 771 770 /** -
trunk/src/VBox/VMM/VMMAll/TRPMAll.cpp
r4693 r4776 338 338 } 339 339 340 340 #ifndef IN_RING0 341 341 /** 342 342 * Forward trap or interrupt to the guest's handler … … 739 739 return VINF_EM_RAW_GUEST_TRAP; 740 740 } 741 741 #endif /* !IN_RING0 */ 742 742 743 743 /** -
trunk/src/VBox/VMM/VMMR0/PDMR0Device.cpp
r4071 r4776 358 358 LogFlow(("pdmR0DevHlp_PATMSetMMIOPatchInfo: caller=%p/%d:\n", pDevIns, pDevIns->iInstance)); 359 359 360 return PATMSetMMIOPatchInfo(pDevIns->Internal.s.pVMHC, GCPhys, pCachedData); 360 AssertFailed(); 361 362 /* return PATMSetMMIOPatchInfo(pDevIns->Internal.s.pVMHC, GCPhys, pCachedData); */ 363 return VINF_SUCCESS; 361 364 } 362 365
Note:
See TracChangeset
for help on using the changeset viewer.