Changeset 19575 in vbox
- Timestamp:
- May 11, 2009 12:42:46 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/dbgf.h
r19572 r19575 89 89 /** A physical address. */ 90 90 #define DBGFADDRESS_FLAGS_PHYS 4 91 /** A physical address. */ 92 #define DBGFADDRESS_FLAGS_RING0 5 91 93 /** The address type mask. */ 92 94 #define DBGFADDRESS_FLAGS_TYPE_MASK 7 -
trunk/include/VBox/vmm.h
r19528 r19575 175 175 VMMR3DECL(void) VMMR3SendInitIpi(PVM pVM, VMCPUID idCpu); 176 176 VMMR3DECL(int) VMMR3AtomicExecuteHandler(PVM pVM, PFNATOMICHANDLER pfnHandler, void *pvUser); 177 VMMR3DECL(int) VMMR3ReadR0Stack(PVM pVM, VMCPUID idCpu, RTHCUINTPTR pAddress, void *pvBuf, size_t cbRead); 177 178 /** @} */ 178 179 #endif /* IN_RING3 */ -
trunk/src/VBox/VMM/DBGFMem.cpp
r19463 r19575 205 205 { 206 206 AssertReturn(idCpu < pVM->cCPUs, VERR_INVALID_PARAMETER); 207 208 PVMREQ pReq; 209 int rc = VMR3ReqCallU(pVM->pUVM, idCpu, &pReq, RT_INDEFINITE_WAIT, 0, 210 (PFNRT)dbgfR3MemRead, 5, pVM, idCpu, pAddress, pvBuf, cbRead); 211 if (RT_SUCCESS(rc)) 212 rc = pReq->iStatus; 213 VMR3ReqFree(pReq); 214 215 return rc; 207 if ((pAddress->fFlags & DBGFADDRESS_FLAGS_TYPE_MASK) == DBGFADDRESS_FLAGS_RING0) 208 { 209 AssertCompile(sizeof(RTHCUINTPTR) == sizeof(pAddress->FlatPtr)); 210 return VMMR3ReadR0Stack(pVM, idCpu, (RTHCUINTPTR)pAddress->FlatPtr, pvBuf, cbRead); 211 } 212 else 213 { 214 PVMREQ pReq; 215 int rc = VMR3ReqCallU(pVM->pUVM, idCpu, &pReq, RT_INDEFINITE_WAIT, 0, 216 (PFNRT)dbgfR3MemRead, 5, pVM, idCpu, pAddress, pvBuf, cbRead); 217 if (RT_SUCCESS(rc)) 218 rc = pReq->iStatus; 219 VMR3ReqFree(pReq); 220 return rc; 221 } 216 222 } 217 223 -
trunk/src/VBox/VMM/DBGFStack.cpp
r19572 r19575 100 100 case DBGFADDRESS_FLAGS_FAR32: cbStackItem = 4; break; 101 101 case DBGFADDRESS_FLAGS_FAR64: cbStackItem = 8; break; 102 case DBGFADDRESS_FLAGS_RING0: cbStackItem = sizeof(RTHCUINTPTR); break; 102 103 default: cbStackItem = 4; break; /// @todo 64-bit guests. 103 104 } … … 281 282 case DBGFADDRESS_FLAGS_FAR32: pCur->enmReturnType = DBGFRETURNTYPE_NEAR32; break; 282 283 case DBGFADDRESS_FLAGS_FAR64: pCur->enmReturnType = DBGFRETURNTYPE_NEAR64; break; 284 case DBGFADDRESS_FLAGS_RING0: pCur->enmReturnType = (HC_ARCH_BITS == 64) ? DBGFRETURNTYPE_NEAR64 : DBGFRETURNTYPE_NEAR32; break; 283 285 default: pCur->enmReturnType = DBGFRETURNTYPE_NEAR32; break; /// @todo 64-bit guests 284 286 } … … 405 407 * Get the CPUM context pointer and pass it on the specified EMT. 406 408 */ 407 PCCPUMCTXCORE pCtxCore = (enmCodeType == DBGFCODETYPE_GUEST) 408 ? CPUMGetGuestCtxCore(VMMGetCpuById(pVM, idCpu)) 409 : CPUMGetHyperCtxCore(VMMGetCpuById(pVM, idCpu)); 410 PVMREQ pReq; 409 PCCPUMCTXCORE pCtxCore; 410 switch (enmCodeType) 411 { 412 case DBGFCODETYPE_GUEST: 413 pCtxCore = CPUMGetGuestCtxCore(VMMGetCpuById(pVM, idCpu)); 414 break; 415 case DBGFCODETYPE_HYPER: 416 pCtxCore = CPUMGetHyperCtxCore(VMMGetCpuById(pVM, idCpu)); 417 break; 418 case DBGFCODETYPE_RING0: 419 pCtxCore = NULL; /* No valid context present. */ 420 break; 421 } 422 PVMREQ pReq; 411 423 int rc = VMR3ReqCall(pVM, idCpu, &pReq, RT_INDEFINITE_WAIT, 412 424 (PFNRT)dbgfR3StackWalkCtxFull, 9, … … 441 453 * @param ppFirstFrame Where to return the pointer to the first info frame. 442 454 */ 443 VMMR3DECL(int) DBGFR3StackWalkBegin tEx(PVM pVM,444 445 446 447 448 449 450 455 VMMR3DECL(int) DBGFR3StackWalkBeginEx(PVM pVM, 456 VMCPUID idCpu, 457 DBGFCODETYPE enmCodeType, 458 PCDBGFADDRESS pAddrFrame, 459 PCDBGFADDRESS pAddrStack, 460 PCDBGFADDRESS pAddrPC, 461 DBGFRETURNTYPE enmReturnType, 462 PCDBGFSTACKFRAME *ppFirstFrame) 451 463 { 452 464 return dbgfR3StackWalkBeginCommon(pVM, idCpu, enmCodeType, pAddrFrame, pAddrStack, pAddrPC, enmReturnType, ppFirstFrame); -
trunk/src/VBox/VMM/VMM.cpp
r19539 r19575 1282 1282 1283 1283 /** 1284 * Read from the ring 0 jump buffer stack 1285 * 1286 * @returns VBox status code. 1287 * 1288 * @param pVM Pointer to the shared VM structure. 1289 * @param idCpu The ID of the source CPU context (for the address). 1290 * @param pAddress Where to start reading. 1291 * @param pvBuf Where to store the data we've read. 1292 * @param cbRead The number of bytes to read. 1293 */ 1294 VMMR3DECL(int) VMMR3ReadR0Stack(PVM pVM, VMCPUID idCpu, RTHCUINTPTR pAddress, void *pvBuf, size_t cbRead) 1295 { 1296 PVMCPU pVCpu = VMMGetCpuById(pVM, idCpu); 1297 AssertReturn(pVCpu, VERR_INVALID_PARAMETER); 1298 1299 RTHCUINTPTR offset = pAddress - pVCpu->vmm.s.CallHostR0JmpBuf.SpCheck; 1300 if (offset >= pVCpu->vmm.s.CallHostR0JmpBuf.cbSavedStack) 1301 return VERR_INVALID_POINTER; 1302 1303 memcpy(pvBuf, pVCpu->vmm.s.pbEMTStackR3 + offset, cbRead); 1304 return VINF_SUCCESS; 1305 } 1306 1307 1308 /** 1284 1309 * Calls a RC function. 1285 1310 * -
trunk/src/VBox/VMM/VMMGuruMeditation.cpp
r19572 r19575 291 291 /* Callstack. */ 292 292 PCDBGFSTACKFRAME pFirstFrame; 293 rc2 = DBGFR3StackWalkBegin(pVM, pVCpu->idCpu, DBGFCODETYPE_RING0, &pFirstFrame); 293 DBGFADDRESS eip, ebp, esp; 294 295 eip.fFlags = DBGFADDRESS_FLAGS_RING0; 296 #if HC_ARCH_BITS == 64 297 eip.FlatPtr = pVCpu->vmm.s.CallHostR0JmpBuf.rip; 298 #else 299 eip.FlatPtr = pVCpu->vmm.s.CallHostR0JmpBuf.eip; 300 #endif 301 ebp.fFlags = DBGFADDRESS_FLAGS_RING0; 302 ebp.FlatPtr = pVCpu->vmm.s.CallHostR0JmpBuf.SavedEbp; 303 esp.fFlags = DBGFADDRESS_FLAGS_RING0; 304 esp.FlatPtr = pVCpu->vmm.s.CallHostR0JmpBuf.SavedEsp; 305 306 rc2 = DBGFR3StackWalkBeginEx(pVM, pVCpu->idCpu, DBGFCODETYPE_RING0, &ebp, &esp, &eip, 307 DBGFRETURNTYPE_INVALID, &pFirstFrame); 294 308 if (RT_SUCCESS(rc2)) 295 309 { -
trunk/src/VBox/VMM/VMMInternal.h
r19529 r19575 157 157 /** The esp we should resume execution with after the restore. */ 158 158 RTHCUINTREG SpResume; 159 /** ESP/RSP at the time of the jump to ring 3. */ 160 RTHCUINTREG SavedEsp; 161 /** EBP/RBP at the time of the jump to ring 3. */ 162 RTHCUINTREG SavedEbp; 159 163 } VMMR0JMPBUF; 160 164 /** Pointer to a ring-0 jump buffer. */ -
trunk/src/VBox/VMM/VMMInternal.mac
r8155 r19575 61 61 .SpCheck resq 1 62 62 .SpResume resq 1 63 .SavedEsp resq 1 64 .SavedEbp resq 1 63 65 %endif 64 66 endstruc -
trunk/src/VBox/VMM/VMMR0/VMMR0A.asm
r18849 r19575 408 408 %endif ; !VMM_R0_SWITCH_STACK 409 409 410 ; Save ESP & EBP to enable stack dumps 411 mov ecx, ebp 412 mov [edx + VMMR0JMPBUF.SavedEbp], ecx 413 sub ecx, 4 414 mov [edx + VMMR0JMPBUF.SavedEsp], ecx 415 410 416 ; store the last pieces of info. 411 417 mov ecx, [edx + VMMR0JMPBUF.esp] … … 506 512 %endif ; !VMM_R0_SWITCH_STACK 507 513 514 ; Save RSP & RBP to enable stack dumps 515 mov rcx, rbp 516 mov [rdx + VMMR0JMPBUF.SavedEbp], rcx 517 sub rcx, 8 518 mov [rdx + VMMR0JMPBUF.SavedEsp], rcx 519 508 520 ; store the last pieces of info. 509 521 mov rcx, [rdx + VMMR0JMPBUF.rsp]
Note:
See TracChangeset
for help on using the changeset viewer.