Changeset 55421 in vbox for trunk/include
- Timestamp:
- Apr 24, 2015 12:00:21 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 99763
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/HGSMI/HGSMI.h
r55342 r55421 72 72 */ 73 73 74 /* Heap types. */75 #define HGSMI_HEAP_TYPE_NULL 0 /* Heap not initialized. */76 #define HGSMI_HEAP_TYPE_POINTER 1 /* Deprecated. RTHEAPSIMPLE. */77 #define HGSMI_HEAP_TYPE_OFFSET 2 /* Deprecated. RTHEAPOFFSET. */78 #define HGSMI_HEAP_TYPE_MA 3 /* Memory allocator. */79 80 74 #pragma pack(1) 81 75 typedef struct HGSMIHEAP 82 76 { 83 union 84 { 85 HGSMIMADATA ma; /* Memory Allocator */ 86 RTHEAPSIMPLE hPtr; /* Pointer based heap. */ 87 RTHEAPOFFSET hOff; /* Offset based heap. */ 88 } u; 89 HGSMIAREA area; /* Description. */ 90 int cRefs; /* Number of heap allocations. */ 91 uint32_t u32HeapType; /* HGSMI_HEAP_TYPE_* */ 77 HGSMIAREA area; /* Description. */ 78 HGSMIMADATA ma; /* Memory allocator */ 92 79 } HGSMIHEAP; 93 80 #pragma pack() … … 180 167 } 181 168 182 DECLINLINE(uint8_t *) HGSMIBufferDataFromOffset (const HGSMIAREA *pArea, HGSMIOFFSET offBuffer) 183 { 184 HGSMIBUFFERHEADER *pHeader = (HGSMIBUFFERHEADER *)HGSMIOffsetToPointer(pArea, offBuffer); 185 Assert(pHeader); 186 if(pHeader) 187 return HGSMIBufferData(pHeader); 188 return NULL; 169 DECLINLINE(uint8_t *) HGSMIBufferDataFromOffset(const HGSMIAREA *pArea, 170 HGSMIOFFSET offBuffer) 171 { 172 void *pvBuffer = HGSMIOffsetToPointer(pArea, offBuffer); 173 return HGSMIBufferDataFromPtr(pvBuffer); 174 } 175 176 DECLINLINE(HGSMIOFFSET) HGSMIBufferOffsetFromData(const HGSMIAREA *pArea, 177 void *pvData) 178 { 179 HGSMIBUFFERHEADER *pHeader = HGSMIBufferHeaderFromData(pvData); 180 return HGSMIPointerToOffset(pArea, pHeader); 189 181 } 190 182 … … 228 220 uint16_t u16ChannelInfo); 229 221 222 DECLINLINE(const HGSMIAREA *) HGSMIHeapArea(HGSMIHEAP *pHeap) 223 { 224 return &pHeap->area; 225 } 226 230 227 int HGSMIHeapSetup (HGSMIHEAP *pHeap, 231 uint32_t u32HeapType,232 228 void *pvBase, 233 229 HGSMISIZE cbArea, … … 235 231 const HGSMIENV *pEnv); 236 232 237 int HGSMIHeapRelocate (HGSMIHEAP *pHeap,238 uint32_t u32HeapType,239 void *pvBase,240 uint32_t offHeapHandle,241 uintptr_t offDelta,242 HGSMISIZE cbArea,243 HGSMIOFFSET offBase);244 245 int HGSMIHeapRestoreMA(HGSMIHEAP *pHeap,246 void *pvBase,247 HGSMISIZE cbArea,248 HGSMIOFFSET offBase,249 uint32_t cBlocks,250 HGSMIOFFSET *paDescriptors,251 HGSMISIZE cbMaxBlock,252 HGSMIENV *pEnv);253 254 void HGSMIHeapSetupUninitialized (HGSMIHEAP *pHeap);255 256 233 void HGSMIHeapDestroy (HGSMIHEAP *pHeap); 257 234 … … 267 244 uint16_t u16ChannelInfo); 268 245 269 HGSMIOFFSET HGSMIHeapBufferOffset (HGSMIHEAP *pHeap, 270 void *pvData); 246 DECLINLINE(HGSMIOFFSET) HGSMIHeapBufferOffset(HGSMIHEAP *pHeap, void *pvData) 247 { 248 return HGSMIBufferOffsetFromData(HGSMIHeapArea(pHeap), pvData); 249 } 271 250 272 251 void HGSMIHeapFree (HGSMIHEAP *pHeap, … … 275 254 DECLINLINE(HGSMIOFFSET) HGSMIHeapOffset(HGSMIHEAP *pHeap) 276 255 { 277 return pHeap->area.offBase; 278 } 279 280 #ifdef IN_RING3 281 /* Needed for heap relocation: offset of the heap handle relative to the start of heap area. */ 282 DECLINLINE(HGSMIOFFSET) HGSMIHeapHandleLocationOffset(HGSMIHEAP *pHeap) 283 { 284 HGSMIOFFSET offHeapHandle; 285 if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_POINTER) 286 { 287 offHeapHandle = (HGSMIOFFSET)((uintptr_t)pHeap->u.hPtr - (uintptr_t)pHeap->area.pu8Base); 288 } 289 else if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_OFFSET) 290 { 291 offHeapHandle = (HGSMIOFFSET)((uintptr_t)pHeap->u.hOff - (uintptr_t)pHeap->area.pu8Base); 292 } 293 else 294 { 295 offHeapHandle = HGSMIOFFSET_VOID; 296 } 297 return offHeapHandle; 298 } 299 #endif /* IN_RING3 */ 256 return HGSMIHeapArea(pHeap)->offBase; 257 } 300 258 301 259 DECLINLINE(HGSMISIZE) HGSMIHeapSize(HGSMIHEAP *pHeap) 302 260 { 303 return pHeap->area.cbArea;261 return HGSMIHeapArea(pHeap)->cbArea; 304 262 } 305 263
Note:
See TracChangeset
for help on using the changeset viewer.