VirtualBox

Changeset 11153

Show
Ignore:
Timestamp:
08/06/08 00:47:48 (4 months ago)
Author:
vboxsync
Message:

VMM: raw-mode context (RC) changes for the MHyperXXToYY APIs.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/include/VBox/mm.h

    r11150 r11153  
    246246} 
    247247#endif 
    248 #define MMHyperGCToCC(pVM, RCPtr) MMHyperRCToCC(pVM, RCPtr) 
     248#define MMHyperGCToCC(pVM, RCPtr) MMHyperRCToCC(pVM, RCPtr) /**< @deprecated */ 
    249249 
    250250#ifndef IN_RING3 
     
    269269 
    270270#ifndef IN_GC 
    271 MMDECL(RCPTRTYPE(void *))     MMHyperCCToGC(PVM pVM, void *pv); 
    272 #else 
    273 DECLINLINE(RCPTRTYPE(void *)) MMHyperCCToGC(PVM pVM, void *pv) 
    274 
    275     NOREF(pVM); 
    276     return (RCPTRTYPE(void *))pv; 
    277 
    278 #endif 
     271MMDECL(RTRCPTR)     MMHyperCCToRC(PVM pVM, void *pv); 
     272#else 
     273DECLINLINE(RTRCPTR) MMHyperCCToRC(PVM pVM, void *pv) 
     274
     275    NOREF(pVM); 
     276    return (RTRCPTR)pv; 
     277
     278#endif 
     279#define MMHyperCCToGC(pVM, pv)  MMHyperCCToRC(pVM, pv) /** @deprecated */ 
    279280 
    280281 
     
    289290#endif 
    290291 
    291  
    292 MMDECL(RCPTRTYPE(void *))     MMHyperHC2GC(PVM pVM, RTHCPTR HCPtr); 
    293 MMDECL(RTHCPTR)     MMHyperGC2HC(PVM pVM, RCPTRTYPE(void *) GCPtr); 
     292#define MMHyperHC2GC(pVM, R3Ptr) MMHyperR3ToRC((pVM), (R3Ptr)) /**< @deprecated */ 
     293#define MMHyperGC2HC(pVM, RCPtr) MMHyperRCToR3((pVM), (RCPtr)) /**< @deprecated */ 
     294 
     295 
    294296MMDECL(int)         MMHyperAlloc(PVM pVM, size_t cb, uint32_t uAlignment, MMTAG enmTag, void **ppv); 
    295297MMDECL(int)         MMHyperFree(PVM pVM, void *pv); 
  • trunk/src/VBox/VMM/VMMAll/MMAll.cpp

    r11150 r11153  
    504504#endif 
    505505 
    506  
    507  
    508 /** 
    509  * Converts a HC address in the Hypervisor memory region to a GC address. 
    510  * The memory must have been allocated with MMGCHyperAlloc() or MMR3HyperAlloc(). 
    511  * 
    512  * @returns GC address. 
    513  * @param   pVM         The VM to operate on. 
    514  * @param   HCPtr       The host context address. 
    515  *                      You'll be damed if this is not in the hypervisor region! :-) 
    516  * @deprecated 
    517  */ 
    518 MMDECL(RTRCPTR) MMHyperHC2GC(PVM pVM, RTHCPTR HCPtr) 
    519 { 
    520     PMMLOOKUPHYPER  pLookup = (PMMLOOKUPHYPER)((char*)CTXSUFF(pVM->mm.s.pHyperHeap) + pVM->mm.s.offLookupHyper); 
    521     for (;;) 
    522     { 
    523         switch (pLookup->enmType) 
    524         { 
    525             case MMLOOKUPHYPERTYPE_LOCKED: 
    526             { 
    527                 unsigned    off = (RTHCUINTPTR)HCPtr - (RTHCUINTPTR)pLookup->u.Locked.pvHC; 
    528                 if (off < pLookup->cb) 
    529                     return (RTRCPTR)((RTGCUINTPTR)pVM->mm.s.pvHyperAreaGC + pLookup->off + off); 
    530                 break; 
    531             } 
    532  
    533             case MMLOOKUPHYPERTYPE_HCPHYS: 
    534             { 
    535                 unsigned    off = (RTHCUINTPTR)HCPtr - (RTHCUINTPTR)pLookup->u.HCPhys.pvHC; 
    536                 if (off < pLookup->cb) 
    537                     return (RTRCPTR)((RTGCUINTPTR)pVM->mm.s.pvHyperAreaGC + pLookup->off + off); 
    538                 break; 
    539             } 
    540  
    541             case MMLOOKUPHYPERTYPE_GCPHYS:  /* (for now we'll not allow these kind of conversions) */ 
    542             case MMLOOKUPHYPERTYPE_MMIO2: 
    543             case MMLOOKUPHYPERTYPE_DYNAMIC: 
    544                 break; 
    545  
    546             default: 
    547                 AssertMsgFailed(("enmType=%d\n", pLookup->enmType)); 
    548                 break; 
    549         } 
    550  
    551         /* next */ 
    552         if ((unsigned)pLookup->offNext == NIL_OFFSET) 
    553             break; 
    554         pLookup = (PMMLOOKUPHYPER)((char *)pLookup + pLookup->offNext); 
    555     } 
    556  
    557     AssertMsgFailed(("HCPtr=%p is not inside the hypervisor memory area!\n", HCPtr)); 
    558     return NIL_RTRCPTR; 
    559 } 
    560  
    561  
    562 /** 
    563  * Converts a RC address in the Hypervisor memory region to a HC address. 
    564  * The memory must have been allocated with MMHyperAlloc(). 
    565  * 
    566  * @returns HC address. 
    567  * @param   pVM         The VM to operate on. 
    568  * @param   RCPtr       The raw-mode context address. 
    569  *                      You'll be damed if this is not in the hypervisor region! :-) 
    570  * @deprecated 
    571  */ 
    572 MMDECL(RTHCPTR) MMHyperRC2HC(PVM pVM, RTRCPTR RCPtr) 
    573 { 
    574     unsigned        offRC = (RTRCUINTPTR)RCPtr - (RTGCUINTPTR)pVM->mm.s.pvHyperAreaGC; 
    575     PMMLOOKUPHYPER  pLookup = (PMMLOOKUPHYPER)((char*)CTXSUFF(pVM->mm.s.pHyperHeap) + pVM->mm.s.offLookupHyper); 
    576     for (;;) 
    577     { 
    578         unsigned off = offRC - pLookup->off; 
    579         if (off < pLookup->cb) 
    580         { 
    581             switch (pLookup->enmType) 
    582             { 
    583                 case MMLOOKUPHYPERTYPE_LOCKED: 
    584                     return (RTHCPTR)((RTHCUINTPTR)pLookup->u.Locked.pvHC + off); 
    585                 case MMLOOKUPHYPERTYPE_HCPHYS: 
    586                     return (RTHCPTR)((RTHCUINTPTR)pLookup->u.HCPhys.pvHC + off); 
    587                 default: 
    588                     break; 
    589             } 
    590             AssertMsgFailed(("enmType=%d\n", pLookup->enmType)); 
    591             return (RTHCPTR)0; 
    592         } 
    593  
    594         /* next */ 
    595         if ((unsigned)pLookup->offNext == NIL_OFFSET) 
    596             break; 
    597         pLookup = (PMMLOOKUPHYPER)((char *)pLookup + pLookup->offNext); 
    598     } 
    599  
    600     AssertMsgFailed(("RCPtr=%p is not inside the hypervisor memory area!\n", RCPtr)); 
    601     return (RTHCPTR)0; 
    602 } 
    603  

© 2008 Sun Microsystems, Inc.
ContactPrivacy policy