VirtualBox

Changeset 50518 in vbox for trunk/include


Ignore:
Timestamp:
Feb 20, 2014 8:32:15 AM (11 years ago)
Author:
vboxsync
Message:

HGSMI memory allocator: saved state

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/HGSMI/HGSMI.h

    r50482 r50518  
    228228                       uintptr_t offDelta,
    229229                       HGSMISIZE cbArea,
     230                       HGSMIOFFSET offBase);
     231
     232int HGSMIHeapRestoreMA(HGSMIHEAP *pHeap,
     233                       void *pvBase,
     234                       HGSMISIZE cbArea,
    230235                       HGSMIOFFSET offBase,
    231                        const HGSMIENV *pEnv);
     236                       uint32_t cBlocks,
     237                       HGSMIOFFSET *paDescriptors,
     238                       HGSMISIZE cbMaxBlock,
     239                       HGSMIENV *pEnv);
    232240
    233241void HGSMIHeapSetupUninitialized (HGSMIHEAP *pHeap);
     
    258266
    259267#ifdef IN_RING3
    260 /* needed for heap relocation */
     268/* Needed for heap relocation: offset of the heap handle relative to the start of heap area. */
    261269DECLINLINE(HGSMIOFFSET) HGSMIHeapHandleLocationOffset(HGSMIHEAP *pHeap)
    262270{
    263 #if (__GNUC__ * 100 + __GNUC_MINOR__) < 405
    264     /* does not work with gcc-4.5 */
    265     AssertCompile((uintptr_t)NIL_RTHEAPSIMPLE == (uintptr_t)NIL_RTHEAPOFFSET);
    266 #endif
    267     return pHeap->u.hPtr != NIL_RTHEAPSIMPLE
    268         ? (HGSMIOFFSET)(pHeap->area.pu8Base - (uint8_t*)pHeap->u.hPtr)
    269         : HGSMIOFFSET_VOID;
     271    HGSMIOFFSET offHeapHandle;
     272    if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_POINTER)
     273    {
     274        offHeapHandle = (HGSMIOFFSET)((uintptr_t)pHeap->u.hPtr - (uintptr_t)pHeap->area.pu8Base);
     275    }
     276    else if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_OFFSET)
     277    {
     278        offHeapHandle = (HGSMIOFFSET)((uintptr_t)pHeap->u.hOff - (uintptr_t)pHeap->area.pu8Base);
     279    }
     280    else
     281    {
     282        offHeapHandle = HGSMIOFFSET_VOID;
     283    }
     284    return offHeapHandle;
    270285}
    271286#endif /* IN_RING3 */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette