vbox的更動 11150 路徑 trunk/src/VBox/VMM/VMMAll/MMAll.cpp
- 時間撮記:
- 2008-8-5 下午10:32:11 (16 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/VMM/VMMAll/MMAll.cpp
r9212 r11150 120 120 121 121 /** 122 * Lookup a guestcontext address.122 * Lookup a raw-mode context address. 123 123 * 124 124 * @returns Pointer to the corresponding lookup record. 125 125 * @returns NULL on failure. 126 126 * @param pVM The VM handle. 127 * @param GCPtr The guestcontext address to lookup.127 * @param RCPtr The raw-mode context address to lookup. 128 128 * @param poff Where to store the offset into the HMA memory chunk. 129 129 */ 130 DECLINLINE(PMMLOOKUPHYPER) mmHyperLookup GC(PVM pVM, RTGCPTR GCPtr, uint32_t *poff)130 DECLINLINE(PMMLOOKUPHYPER) mmHyperLookupRC(PVM pVM, RTRCPTR RCPtr, uint32_t *poff) 131 131 { 132 132 /** @todo cache last lookup this stuff ain't cheap! */ 133 unsigned off GC = (RTGCUINTPTR)GCPtr - (RTGCUINTPTR)pVM->mm.s.pvHyperAreaGC;133 unsigned offRC = (RTRCUINTPTR)RCPtr - (RTGCUINTPTR)pVM->mm.s.pvHyperAreaGC; 134 134 PMMLOOKUPHYPER pLookup = (PMMLOOKUPHYPER)((char*)CTXSUFF(pVM->mm.s.pHyperHeap) + pVM->mm.s.offLookupHyper); 135 135 for (;;) 136 136 { 137 const uint32_t off = off GC - pLookup->off;137 const uint32_t off = offRC - pLookup->off; 138 138 if (off < pLookup->cb) 139 139 { … … 157 157 } 158 158 159 AssertMsgFailed(("GCPtr=%p is not inside the hypervisor memory area!\n", GCPtr));159 AssertMsgFailed(("GCPtr=%p is not inside the hypervisor memory area!\n", RCPtr)); 160 160 return NULL; 161 161 } … … 174 174 { 175 175 #ifdef IN_GC 176 return mmHyperLookup GC(pVM, (RTGCPTR)pv, poff);176 return mmHyperLookupRC(pVM, (RTRCPTR)pv, poff); 177 177 #elif defined(IN_RING0) 178 178 return mmHyperLookupR0(pVM, pv, poff); … … 230 230 231 231 /** 232 * Calculate the raw-mode context address of an offset into the HMA memory chunk. 233 * 234 * @returns the raw-mode context base address. 235 * @param pVM The the VM handle. 236 * @param pLookup The HMA lookup record. 237 * @param off The offset into the HMA memory chunk. 238 */ 239 DECLINLINE(RTRCPTR) mmHyperLookupCalcRC(PVM pVM, PMMLOOKUPHYPER pLookup, uint32_t off) 240 { 241 return (RTRCPTR)((RTGCUINTPTR)pVM->mm.s.pvHyperAreaGC + pLookup->off + off); 242 } 243 244 245 /** 232 246 * Calculate the guest context address of an offset into the HMA memory chunk. 233 247 * … … 237 251 * @param off The offset into the HMA memory chunk. 238 252 */ 239 DECLINLINE(RTGCPTR) mmHyperLookupCalcGC(PVM pVM, PMMLOOKUPHYPER pLookup, uint32_t off)240 {241 return (RTGCPTR)((RTGCUINTPTR)pVM->mm.s.pvHyperAreaGC + pLookup->off + off);242 }243 244 245 /**246 * Calculate the guest context address of an offset into the HMA memory chunk.247 *248 * @returns the guest context base address.249 * @param pVM The the VM handle.250 * @param pLookup The HMA lookup record.251 * @param off The offset into the HMA memory chunk.252 */253 253 DECLINLINE(void *) mmHyperLookupCalcCC(PVM pVM, PMMLOOKUPHYPER pLookup, uint32_t off) 254 254 { 255 255 #ifdef IN_GC 256 return (void *)mmHyperLookupCalc GC(pVM, pLookup, off);256 return (void *)mmHyperLookupCalcRC(pVM, pLookup, off); 257 257 #elif defined(IN_RING0) 258 258 return mmHyperLookupCalcR0(pLookup, off); … … 283 283 284 284 /** 285 * Converts a ring-0 host context address in the Hypervisor memory region to a guestcontext address.286 * 287 * @returns guestcontext address.285 * Converts a ring-0 host context address in the Hypervisor memory region to a raw-mode context address. 286 * 287 * @returns raw-mode context address. 288 288 * @param pVM The VM to operate on. 289 289 * @param R0Ptr The ring-0 host context address. … … 291 291 * @thread The Emulation Thread. 292 292 */ 293 MMDECL(RT GCPTR) MMHyperR0ToGC(PVM pVM, RTR0PTR R0Ptr)293 MMDECL(RTRCPTR) MMHyperR0ToRC(PVM pVM, RTR0PTR R0Ptr) 294 294 { 295 295 uint32_t off; 296 296 PMMLOOKUPHYPER pLookup = mmHyperLookupR0(pVM, R0Ptr, &off); 297 297 if (pLookup) 298 return mmHyperLookupCalc GC(pVM, pLookup, off);299 return NIL_RT GCPTR;298 return mmHyperLookupCalcRC(pVM, pLookup, off); 299 return NIL_RTRCPTR; 300 300 } 301 301 … … 351 351 * @thread The Emulation Thread. 352 352 */ 353 MMDECL(RT GCPTR) MMHyperR3ToGC(PVM pVM, RTR3PTR R3Ptr)353 MMDECL(RTRCPTR) MMHyperR3ToRC(PVM pVM, RTR3PTR R3Ptr) 354 354 { 355 355 uint32_t off; 356 356 PMMLOOKUPHYPER pLookup = mmHyperLookupR3(pVM, R3Ptr, &off); 357 357 if (pLookup) 358 return mmHyperLookupCalc GC(pVM, pLookup, off);358 return mmHyperLookupCalcRC(pVM, pLookup, off); 359 359 AssertMsgFailed(("R3Ptr=%p is not inside the hypervisor memory area!\n", R3Ptr)); 360 return NIL_RT GCPTR;360 return NIL_RTRCPTR; 361 361 } 362 362 … … 384 384 385 385 /** 386 * Converts a guestcontext address in the Hypervisor memory region to a ring-3 context address.386 * Converts a raw-mode context address in the Hypervisor memory region to a ring-3 context address. 387 387 * 388 388 * @returns ring-3 host context address. 389 389 * @param pVM The VM to operate on. 390 * @param GCPtr The guestcontext address.391 * You'll be damned if this is not in the HMA! :-) 392 * @thread The Emulation Thread. 393 */ 394 MMDECL(RTR3PTR) MMHyper GCToR3(PVM pVM, RTGCPTR GCPtr)395 { 396 uint32_t off; 397 PMMLOOKUPHYPER pLookup = mmHyperLookup GC(pVM, GCPtr, &off);390 * @param GCPtr The raw-mode context address. 391 * You'll be damned if this is not in the HMA! :-) 392 * @thread The Emulation Thread. 393 */ 394 MMDECL(RTR3PTR) MMHyperRCToR3(PVM pVM, RTRCPTR RCPtr) 395 { 396 uint32_t off; 397 PMMLOOKUPHYPER pLookup = mmHyperLookupRC(pVM, RCPtr, &off); 398 398 if (pLookup) 399 399 return mmHyperLookupCalcR3(pLookup, off); … … 403 403 404 404 /** 405 * Converts a guestcontext address in the Hypervisor memory region to a ring-0 host context address.405 * Converts a raw-mode context address in the Hypervisor memory region to a ring-0 host context address. 406 406 * 407 407 * @returns ring-0 host context address. 408 408 * @param pVM The VM to operate on. 409 * @param GCPtr The guestcontext address.410 * You'll be damned if this is not in the HMA! :-) 411 * @thread The Emulation Thread. 412 */ 413 MMDECL(RTR0PTR) MMHyper GCToR0(PVM pVM, RTGCPTR GCPtr)414 { 415 uint32_t off; 416 PMMLOOKUPHYPER pLookup = mmHyperLookup GC(pVM, GCPtr, &off);409 * @param RCPtr The raw-mode context address. 410 * You'll be damned if this is not in the HMA! :-) 411 * @thread The Emulation Thread. 412 */ 413 MMDECL(RTR0PTR) MMHyperRCToR0(PVM pVM, RTRCPTR RCPtr) 414 { 415 uint32_t off; 416 PMMLOOKUPHYPER pLookup = mmHyperLookupRC(pVM, RCPtr, &off); 417 417 if (pLookup) 418 418 return mmHyperLookupCalcR0(pLookup, off); … … 422 422 423 423 /** 424 * Converts a guestcontext address in the Hypervisor memory region to a current context address.424 * Converts a raw-mode context address in the Hypervisor memory region to a current context address. 425 425 * 426 426 * @returns current context address. 427 427 * @param pVM The VM to operate on. 428 * @param GCPtr The guesthost context address.428 * @param RCPtr The raw-mode host context address. 429 429 * You'll be damned if this is not in the HMA! :-) 430 430 * @thread The Emulation Thread. 431 431 */ 432 432 #ifndef IN_GC 433 MMDECL(void *) MMHyper GCToCC(PVM pVM, RTGCPTR GCPtr)434 { 435 uint32_t off; 436 PMMLOOKUPHYPER pLookup = mmHyperLookup GC(pVM, GCPtr, &off);433 MMDECL(void *) MMHyperRCToCC(PVM pVM, RTRCPTR RCPtr) 434 { 435 uint32_t off; 436 PMMLOOKUPHYPER pLookup = mmHyperLookupRC(pVM, RCPtr, &off); 437 437 if (pLookup) 438 438 return mmHyperLookupCalcCC(pVM, pLookup, off); … … 485 485 486 486 /** 487 * Converts a current context address in the Hypervisor memory region to a guestcontext address.487 * Converts a current context address in the Hypervisor memory region to a raw-mode context address. 488 488 * 489 489 * @returns guest context address. … … 494 494 */ 495 495 #ifndef IN_GC 496 MMDECL(R CPTRTYPE(void *)) MMHyperCCToGC(PVM pVM, void *pv)496 MMDECL(RTRCPTR) MMHyperCCToRC(PVM pVM, void *pv) 497 497 { 498 498 uint32_t off; 499 499 PMMLOOKUPHYPER pLookup = mmHyperLookupCC(pVM, pv, &off); 500 500 if (pLookup) 501 return mmHyperLookupCalc GC(pVM, pLookup, off);502 return NIL_RT GCPTR;501 return mmHyperLookupCalcRC(pVM, pLookup, off); 502 return NIL_RTRCPTR; 503 503 } 504 504 #endif … … 516 516 * @deprecated 517 517 */ 518 MMDECL(R CPTRTYPE(void *)) MMHyperHC2GC(PVM pVM, RTHCPTR HCPtr)518 MMDECL(RTRCPTR) MMHyperHC2GC(PVM pVM, RTHCPTR HCPtr) 519 519 { 520 520 PMMLOOKUPHYPER pLookup = (PMMLOOKUPHYPER)((char*)CTXSUFF(pVM->mm.s.pHyperHeap) + pVM->mm.s.offLookupHyper); … … 527 527 unsigned off = (RTHCUINTPTR)HCPtr - (RTHCUINTPTR)pLookup->u.Locked.pvHC; 528 528 if (off < pLookup->cb) 529 return (R CPTRTYPE(void *))((RTGCUINTPTR)pVM->mm.s.pvHyperAreaGC + pLookup->off + off);529 return (RTRCPTR)((RTGCUINTPTR)pVM->mm.s.pvHyperAreaGC + pLookup->off + off); 530 530 break; 531 531 } … … 535 535 unsigned off = (RTHCUINTPTR)HCPtr - (RTHCUINTPTR)pLookup->u.HCPhys.pvHC; 536 536 if (off < pLookup->cb) 537 return (R CPTRTYPE(void *))((RTGCUINTPTR)pVM->mm.s.pvHyperAreaGC + pLookup->off + off);537 return (RTRCPTR)((RTGCUINTPTR)pVM->mm.s.pvHyperAreaGC + pLookup->off + off); 538 538 break; 539 539 } … … 556 556 557 557 AssertMsgFailed(("HCPtr=%p is not inside the hypervisor memory area!\n", HCPtr)); 558 return (RCPTRTYPE(void *))0;559 } 560 561 562 /** 563 * Converts a GC address in the Hypervisor memory region to a HC address.558 return NIL_RTRCPTR; 559 } 560 561 562 /** 563 * Converts a RC address in the Hypervisor memory region to a HC address. 564 564 * The memory must have been allocated with MMHyperAlloc(). 565 565 * 566 566 * @returns HC address. 567 567 * @param pVM The VM to operate on. 568 * @param GCPtr The guestcontext address.568 * @param RCPtr The raw-mode context address. 569 569 * You'll be damed if this is not in the hypervisor region! :-) 570 570 * @deprecated 571 571 */ 572 MMDECL(RTHCPTR) MMHyper GC2HC(PVM pVM, RCPTRTYPE(void *) GCPtr)573 { 574 unsigned off GC = (RTGCUINTPTR)GCPtr - (RTGCUINTPTR)pVM->mm.s.pvHyperAreaGC;572 MMDECL(RTHCPTR) MMHyperRC2HC(PVM pVM, RTRCPTR RCPtr) 573 { 574 unsigned offRC = (RTRCUINTPTR)RCPtr - (RTGCUINTPTR)pVM->mm.s.pvHyperAreaGC; 575 575 PMMLOOKUPHYPER pLookup = (PMMLOOKUPHYPER)((char*)CTXSUFF(pVM->mm.s.pHyperHeap) + pVM->mm.s.offLookupHyper); 576 576 for (;;) 577 577 { 578 unsigned off = off GC - pLookup->off;578 unsigned off = offRC - pLookup->off; 579 579 if (off < pLookup->cb) 580 580 { … … 598 598 } 599 599 600 AssertMsgFailed((" GCPtr=%p is not inside the hypervisor memory area!\n", GCPtr));600 AssertMsgFailed(("RCPtr=%p is not inside the hypervisor memory area!\n", RCPtr)); 601 601 return (RTHCPTR)0; 602 602 } 603 603 604 605 #ifdef IN_GC606 /**607 * Converts a current context address in the Hypervisor memory region to a HC address.608 * The memory must have been allocated with MMGCHyperAlloc() or MMR3HyperAlloc().609 *610 * @returns HC address.611 * @param pVM The VM to operate on.612 * @param Ptr The current context address.613 * @deprecated614 */615 MMDECL(RTHCPTR) MMHyper2HC(PVM pVM, uintptr_t Ptr)616 {617 return MMHyperGC2HC(pVM, (RCPTRTYPE(void *))Ptr);618 }619 620 #else /* !IN_GC */621 622 /**623 * Converts a current context address in the Hypervisor memory region to a GC address.624 * The memory must have been allocated with MMHyperAlloc().625 *626 * @returns HC address.627 * @param pVM The VM to operate on.628 * @param Ptr The current context address.629 * @thread The Emulation Thread.630 * @deprecated631 */632 MMDECL(RCPTRTYPE(void *)) MMHyper2GC(PVM pVM, uintptr_t Ptr)633 {634 return MMHyperHC2GC(pVM, (RTHCPTR)Ptr);635 }636 637 #endif /* !IN_GC */
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器