Changeset 46135 in vbox for trunk/src/VBox/VMM
- Timestamp:
- May 16, 2013 11:32:47 PM (12 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/Makefile.kmk
r46111 r46135 178 178 VMMR3/PATMA.asm \ 179 179 VMMR3/PATMSSM.cpp \ 180 VMMR3/PATMR3Dbg.cpp \ 180 181 ,) \ 181 182 VMMAll/CPUMAllRegs.cpp \ -
trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp
r46103 r46135 70 70 #define HMVMX_FLUSH_TAGGED_TLB_NONE 3 71 71 72 /** Updated-guest-state flags. */ 72 /** @name Updated-guest-state flags. 73 * @{ */ 73 74 #define HMVMX_UPDATED_GUEST_RIP RT_BIT(0) 74 75 #define HMVMX_UPDATED_GUEST_RSP RT_BIT(1) … … 111 112 | HMVMX_UPDATED_GUEST_ACTIVITY_STATE \ 112 113 | HMVMX_UPDATED_GUEST_APIC_STATE) 114 /** @} */ 113 115 114 116 /** -
trunk/src/VBox/VMM/VMMR3/DBGFAddrSpace.cpp
r46110 r46135 39 39 #define LOG_GROUP LOG_GROUP_DBGF 40 40 #include <VBox/vmm/dbgf.h> 41 #include <VBox/vmm/hm.h> 41 42 #include <VBox/vmm/pdmapi.h> 42 43 #include <VBox/vmm/mm.h> 44 #ifdef VBOX_WITH_RAW_MODE 45 # include <VBox/vmm/patm.h> 46 #endif 43 47 #include "DBGFInternal.h" 44 48 #include <VBox/vmm/uvm.h> … … 51 55 #include <iprt/ctype.h> 52 56 #include <iprt/env.h> 57 #include <iprt/mem.h> 53 58 #include <iprt/path.h> 54 59 #include <iprt/param.h> … … 289 294 void dbgfR3AsRelocate(PUVM pUVM, RTGCUINTPTR offDelta) 290 295 { 291 /** @todo */ 292 NOREF(pUVM); NOREF(offDelta); 296 /* 297 * We will relocate the raw-mode context modules by offDelta if they have 298 * been injected into the the DBGF_AS_RC map. 299 */ 300 if ( pUVM->dbgf.s.afAsAliasPopuplated[DBGF_AS_ALIAS_2_INDEX(DBGF_AS_RC)] 301 && offDelta != 0) 302 { 303 RTDBGAS hAs = pUVM->dbgf.s.ahAsAliases[DBGF_AS_ALIAS_2_INDEX(DBGF_AS_RC)]; 304 305 /* Take a snapshot of the modules as we might have overlapping 306 addresses between the previous and new mapping. */ 307 RTDbgAsLockExcl(hAs); 308 uint32_t cModules = RTDbgAsModuleCount(hAs); 309 if (cModules > 0 && cModules < _4K) 310 { 311 struct DBGFASRELOCENTRY 312 { 313 RTDBGMOD hDbgMod; 314 RTRCPTR uOldAddr; 315 } *paEntries = (struct DBGFASRELOCENTRY *)RTMemTmpAllocZ(sizeof(paEntries[0]) * cModules); 316 if (paEntries) 317 { 318 /* Snapshot. */ 319 for (uint32_t i = 0; i < cModules; i++) 320 { 321 paEntries[i].hDbgMod = RTDbgAsModuleByIndex(hAs, i); 322 AssertLogRelMsg(paEntries[i].hDbgMod != NIL_RTDBGMOD, ("iModule=%#x\n", i)); 323 324 RTDBGASMAPINFO aMappings[1] = { { 0, 0 } }; 325 uint32_t cMappings = 1; 326 int rc = RTDbgAsModuleQueryMapByIndex(hAs, i, &aMappings[0], &cMappings, 0 /*fFlags*/); 327 if (RT_SUCCESS(rc) && cMappings == 1 && aMappings[0].iSeg == NIL_RTDBGSEGIDX) 328 paEntries[i].uOldAddr = (RTRCPTR)aMappings[0].Address; 329 else 330 AssertLogRelMsgFailed(("iModule=%#x rc=%Rrc cMappings=%#x.\n", i, rc, cMappings)); 331 } 332 333 /* Unlink them. */ 334 for (uint32_t i = 0; i < cModules; i++) 335 { 336 int rc = RTDbgAsModuleUnlink(hAs, paEntries[i].hDbgMod); 337 AssertLogRelMsg(RT_SUCCESS(rc), ("iModule=%#x rc=%Rrc hDbgMod=%p\n", i, rc, paEntries[i].hDbgMod)); 338 } 339 340 /* Link them at the new locations. */ 341 for (uint32_t i = 0; i < cModules; i++) 342 { 343 RTRCPTR uNewAddr = paEntries[i].uOldAddr + offDelta; 344 int rc = RTDbgAsModuleLink(hAs, paEntries[i].hDbgMod, uNewAddr, 345 RTDBGASLINK_FLAGS_REPLACE); 346 AssertLogRelMsg(RT_SUCCESS(rc), 347 ("iModule=%#x rc=%Rrc hDbgMod=%p %RRv -> %RRv\n", i, rc, paEntries[i].hDbgMod, 348 paEntries[i].uOldAddr, uNewAddr)); 349 RTDbgModRelease(paEntries[i].hDbgMod); 350 } 351 352 RTMemTmpFree(paEntries); 353 } 354 else 355 AssertLogRelMsgFailed(("No memory for %#x modules.\n", cModules)); 356 } 357 else 358 AssertLogRelMsgFailed(("cModules=%#x\n", cModules)); 359 RTDbgAsUnlockExcl(hAs); 360 } 293 361 } 294 362 … … 499 567 500 568 /** 569 * @callback_method_impl{FNPDMR3ENUM} 570 */ 571 static DECLCALLBACK(int) dbgfR3AsLazyPopulateRCCallback(PVM pVM, const char *pszFilename, const char *pszName, 572 RTUINTPTR ImageBase, size_t cbImage, bool fRC, void *pvArg) 573 { 574 NOREF(pVM); NOREF(cbImage); 575 576 /* Only raw-mode modules. */ 577 if (fRC) 578 { 579 RTDBGMOD hDbgMod; 580 int rc = RTDbgModCreateFromImage(&hDbgMod, pszFilename, pszName, pVM->pUVM->dbgf.s.hDbgCfg); 581 if (RT_SUCCESS(rc)) 582 { 583 rc = RTDbgAsModuleLink((RTDBGAS)pvArg, hDbgMod, ImageBase, 0 /*fFlags*/); 584 if (RT_FAILURE(rc)) 585 LogRel(("DBGF: Failed to link module \"%s\" into DBGF_AS_RC at %RTptr: %Rrc\n", 586 pszName, ImageBase, rc)); 587 } 588 else 589 LogRel(("DBGF: RTDbgModCreateFromImage failed with rc=%Rrc for module \"%s\" (%s)\n", 590 rc, pszName, pszFilename)); 591 } 592 return VINF_SUCCESS; 593 } 594 595 596 /** 501 597 * Lazily populates the specified address space. 502 598 * … … 510 606 if (!pUVM->dbgf.s.afAsAliasPopuplated[iAlias]) 511 607 { 512 RTDBGAS h As = pUVM->dbgf.s.ahAsAliases[iAlias];608 RTDBGAS hDbgAs = pUVM->dbgf.s.ahAsAliases[iAlias]; 513 609 if (hAlias == DBGF_AS_R0 && pUVM->pVM) 514 PDMR3LdrEnumModules(pUVM->pVM, dbgfR3AsLazyPopulateR0Callback, hAs); 515 /** @todo what do we do about DBGF_AS_RC? */ 610 PDMR3LdrEnumModules(pUVM->pVM, dbgfR3AsLazyPopulateR0Callback, hDbgAs); 611 else if (hAlias == DBGF_AS_RC && pUVM->pVM && !HMIsEnabled(pUVM->pVM)) 612 { 613 LogRel(("DBGF: Lazy init of RC address space\n")); 614 PDMR3LdrEnumModules(pUVM->pVM, dbgfR3AsLazyPopulateRCCallback, hDbgAs); 615 #ifdef VBOX_WITH_RAW_MODE 616 PATMR3DbgPopulateAddrSpace(pUVM->pVM, hDbgAs); 617 #endif 618 } 516 619 517 620 pUVM->dbgf.s.afAsAliasPopuplated[iAlias] = true; -
trunk/src/VBox/VMM/VMMR3/PATM.cpp
r45984 r46135 427 427 428 428 pVM->patm.s.pfnHelperCallGC = 0; 429 patmR3DbgReset(pVM); 429 430 430 431 /* Generate all global functions to be used by future patches. */ … … 447 448 /* Round to next 8 byte boundary. */ 448 449 pVM->patm.s.offPatchMem = RT_ALIGN_32(pVM->patm.s.offPatchMem, 8); 450 451 449 452 return rc; 450 453 } … … 522 525 if (HMIsEnabled(pVM)) 523 526 return VINF_SUCCESS; 527 528 patmR3DbgTerm(pVM); 524 529 525 530 /* Memory was all allocated from the two MM heaps and requires no freeing. */ -
trunk/src/VBox/VMM/include/PATMInternal.h
r45620 r46135 427 427 * Used only during PATMR3Relocate(). */ 428 428 int32_t deltaReloc; 429 /* GC PATM state pointer - HC pointer. */429 /** GC PATM state pointer - HC pointer. */ 430 430 R3PTRTYPE(PPATMGCSTATE) pGCStateHC; 431 /* GC PATM state pointer - GC pointer. */431 /** GC PATM state pointer - RC pointer. */ 432 432 RCPTRTYPE(PPATMGCSTATE) pGCStateGC; 433 /** PATM stack page for call instruction execution. (2 parts: one for our private stack and one to store the original return address */ 433 /** PATM stack page for call instruction execution. 434 * 2 parts: one for our private stack and one to store the original return 435 * address. */ 434 436 RCPTRTYPE(RTRCPTR *) pGCStackGC; 435 437 /** HC pointer of the PATM stack page. */ … … 488 490 } savedstate; 489 491 492 /** Debug module for the patch memory. */ 493 RTDBGMOD hDbgModPatchMem; 494 490 495 STAMCOUNTER StatNrOpcodeRead; 491 496 STAMCOUNTER StatDisabled; … … 648 653 #endif 649 654 650 #endif 655 656 void patmR3DbgInit(PVM pVM); 657 void patmR3DbgTerm(PVM pVM); 658 void patmR3DbgReset(PVM pVM); 659 //void patmR3DbgNewPatch(PVM pVM, ); 660 661 #endif
Note:
See TracChangeset
for help on using the changeset viewer.