Changeset 50482 in vbox
- Timestamp:
- Feb 17, 2014 3:23:05 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 12 edited
-
include/VBox/HGSMI/HGSMI.h (modified) (7 diffs)
-
include/VBox/HGSMI/HGSMIDefs.h (modified) (1 diff)
-
include/VBox/VBoxVideoGuest.h (modified) (1 diff)
-
src/VBox/Additions/WINNT/Graphics/Video/disp/xpdm/VBoxDispVBVA.cpp (modified) (2 diffs)
-
src/VBox/Additions/WINNT/Graphics/Video/mp/common/VBoxMPHGSMI.cpp (modified) (2 diffs)
-
src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPShgsmi.cpp (modified) (1 diff)
-
src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPShgsmi.h (modified) (1 diff)
-
src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVdma.cpp (modified) (2 diffs)
-
src/VBox/Additions/common/VBoxVideo/HGSMIBase.cpp (modified) (1 diff)
-
src/VBox/Devices/Graphics/HGSMI/HGSMIHost.cpp (modified) (6 diffs)
-
src/VBox/GuestHost/HGSMI/HGSMICommon.cpp (modified) (11 diffs)
-
src/VBox/GuestHost/HGSMI/Makefile.kmk (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/HGSMI/HGSMI.h
r50420 r50482 35 35 #include <VBox/HGSMI/HGSMIDefs.h> 36 36 #include <VBox/HGSMI/HGSMIChannels.h> 37 #include <VBox/HGSMI/HGSMIMemAlloc.h> 37 38 38 39 /* … … 71 72 */ 72 73 74 /* Heap types. */ 75 #define HGSMI_HEAP_TYPE_NULL 0 /* Heap not initialized. */ 76 #define HGSMI_HEAP_TYPE_POINTER 1 /* RTHEAPSIMPLE. Obsolete. */ 77 #define HGSMI_HEAP_TYPE_OFFSET 2 /* RTHEAPOFFSET. Obsolete. */ 78 #define HGSMI_HEAP_TYPE_MA 3 /* Memory allocator. */ 79 73 80 #pragma pack(1) 74 typedef struct _HGSMIHEAP81 typedef struct HGSMIHEAP 75 82 { 76 83 union 77 84 { 78 RTHEAPSIMPLE hPtr; /**< Pointer based heap. */ 79 RTHEAPOFFSET hOff; /**< Offset based heap. */ 85 HGSMIMADATA ma; /* Memory Allocator */ 86 RTHEAPSIMPLE hPtr; /* Pointer based heap. */ 87 RTHEAPOFFSET hOff; /* Offset based heap. */ 80 88 } u; 81 HGSMIAREA area; /* *<Description. */82 int cRefs; /* *<Number of heap allocations. */83 bool fOffsetBased; /**< Set if offset based.*/89 HGSMIAREA area; /* Description. */ 90 int cRefs; /* Number of heap allocations. */ 91 uint32_t u32HeapType; /* HGSMI_HEAP_TYPE_* */ 84 92 } HGSMIHEAP; 85 93 #pragma pack() … … 145 153 } 146 154 147 DECLINLINE(HGSMIOFFSET) HGSMIPointerToOffset (const HGSMIAREA *pArea,148 const HGSMIBUFFERHEADER *pHeader)149 { 150 return pArea->offBase + (HGSMIOFFSET)((uint8_t *)p Header- pArea->pu8Base);151 } 152 153 DECLINLINE( HGSMIBUFFERHEADER *) HGSMIOffsetToPointer(const HGSMIAREA *pArea,154 HGSMIOFFSET offBuffer)155 { 156 return (HGSMIBUFFERHEADER *)(pArea->pu8Base + (offBuffer - pArea->offBase));155 DECLINLINE(HGSMIOFFSET) HGSMIPointerToOffset(const HGSMIAREA *pArea, 156 const void *pv) 157 { 158 return pArea->offBase + (HGSMIOFFSET)((uint8_t *)pv - pArea->pu8Base); 159 } 160 161 DECLINLINE(void *) HGSMIOffsetToPointer(const HGSMIAREA *pArea, 162 HGSMIOFFSET offBuffer) 163 { 164 return pArea->pu8Base + (offBuffer - pArea->offBase); 157 165 } 158 166 159 167 DECLINLINE(uint8_t *) HGSMIBufferDataFromOffset (const HGSMIAREA *pArea, HGSMIOFFSET offBuffer) 160 168 { 161 HGSMIBUFFERHEADER *pHeader = HGSMIOffsetToPointer(pArea, offBuffer);169 HGSMIBUFFERHEADER *pHeader = (HGSMIBUFFERHEADER *)HGSMIOffsetToPointer(pArea, offBuffer); 162 170 Assert(pHeader); 163 171 if(pHeader) … … 168 176 DECLINLINE(uint8_t *) HGSMIBufferDataAndChInfoFromOffset (const HGSMIAREA *pArea, HGSMIOFFSET offBuffer, uint16_t * pChInfo) 169 177 { 170 HGSMIBUFFERHEADER *pHeader = HGSMIOffsetToPointer (pArea, offBuffer);178 HGSMIBUFFERHEADER *pHeader = (HGSMIBUFFERHEADER *)HGSMIOffsetToPointer (pArea, offBuffer); 171 179 Assert(pHeader); 172 180 if(pHeader) … … 191 199 void HGSMIAreaClear (HGSMIAREA *pArea); 192 200 193 DECLINLINE(bool) HGSMIAreaContainsOffset(HGSMIAREA *pArea, HGSMIOFFSET offSet) 194 { 195 return pArea->offBase <= offSet && pArea->offBase + pArea->cbArea > offSet; 201 DECLINLINE(bool) HGSMIAreaContainsOffset(const HGSMIAREA *pArea, HGSMIOFFSET off) 202 { 203 return off >= pArea->offBase && off - pArea->offBase < pArea->cbArea; 204 } 205 206 DECLINLINE(bool) HGSMIAreaContainsPointer(const HGSMIAREA *pArea, const void *pv) 207 { 208 return (uintptr_t)pv >= (uintptr_t)pArea->pu8Base && (uintptr_t)pv - (uintptr_t)pArea->pu8Base < pArea->cbArea; 196 209 } 197 210 … … 203 216 204 217 int HGSMIHeapSetup (HGSMIHEAP *pHeap, 218 uint32_t u32HeapType, 205 219 void *pvBase, 206 220 HGSMISIZE cbArea, 207 221 HGSMIOFFSET offBase, 208 bool fOffsetBased);222 const HGSMIENV *pEnv); 209 223 210 224 int HGSMIHeapRelocate (HGSMIHEAP *pHeap, 225 uint32_t u32HeapType, 211 226 void *pvBase, 212 227 uint32_t offHeapHandle, … … 214 229 HGSMISIZE cbArea, 215 230 HGSMIOFFSET offBase, 216 bool fOffsetBased); 217 218 void HGSMIHeapSetupUnitialized (HGSMIHEAP *pHeap); 219 bool HGSMIHeapIsItialized (HGSMIHEAP *pHeap); 231 const HGSMIENV *pEnv); 232 233 void HGSMIHeapSetupUninitialized (HGSMIHEAP *pHeap); 220 234 221 235 void HGSMIHeapDestroy (HGSMIHEAP *pHeap); -
trunk/include/VBox/HGSMI/HGSMIDefs.h
r50420 r50482 109 109 #define HGSMI_NUMBER_OF_CHANNELS 0x100 110 110 111 typedef struct HGSMIENV 112 { 113 /* Environment context pointer. */ 114 void *pvEnv; 115 116 /* Allocate system memory. */ 117 DECLCALLBACKMEMBER(void *, pfnAlloc)(void *pvEnv, HGSMISIZE cb); 118 119 /* Free system memory. */ 120 DECLCALLBACKMEMBER(void, pfnFree)(void *pvEnv, void *pv); 121 } HGSMIENV; 122 111 123 #endif /* !___VBox_HGSMI_HGSMIDefs_h */ -
trunk/include/VBox/VBoxVideoGuest.h
r45003 r50482 226 226 void *pvGuestHeapMemory, 227 227 uint32_t cbGuestHeapMemory, 228 uint32_t offVRAMGuestHeapMemory); 228 uint32_t offVRAMGuestHeapMemory, 229 const HGSMIENV *pEnv); 229 230 RTDECL(void) VBoxHGSMIGetHostAreaMapping(PHGSMIGUESTCOMMANDCONTEXT pCtx, 230 231 uint32_t cbVRAM, -
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/xpdm/VBoxDispVBVA.cpp
r37423 r50482 300 300 #endif /* VBOX_VBVA_ADJUST_RECT */ 301 301 302 static DECLCALLBACK(void *) hgsmiEnvAlloc(void *pvEnv, HGSMISIZE cb) 303 { 304 NOREF(pvEnv); 305 return EngAllocMem(0, cb, 0); 306 } 307 308 static DECLCALLBACK(void) hgsmiEnvFree(void *pvEnv, void *pv) 309 { 310 NOREF(pvEnv); 311 EngFreeMem(pv); 312 } 313 314 static HGSMIENV g_hgsmiEnvDisp = 315 { 316 NULL, 317 hgsmiEnvAlloc, 318 hgsmiEnvFree 319 }; 320 302 321 int VBoxDispVBVAInit(PVBOXDISPDEV pDev) 303 322 { … … 406 425 407 426 rc = HGSMIHeapSetup(&pDev->hgsmi.ctx.heapCtx, 427 HGSMI_HEAP_TYPE_POINTER, 408 428 (uint8_t *)pDev->memInfo.VideoRamBase+pDev->layout.offDisplayInfo+sizeof(HGSMIHOSTFLAGS), 409 429 pDev->layout.cbDisplayInfo-sizeof(HGSMIHOSTFLAGS), 410 430 info.areaDisplay.offBase+pDev->layout.offDisplayInfo+sizeof(HGSMIHOSTFLAGS), 411 false /*fOffsetBased*/);431 &g_hgsmiEnvDisp); 412 432 413 433 if (RT_SUCCESS(rc)) -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/common/VBoxMPHGSMI.cpp
r44529 r50482 20 20 #include "VBoxMPCommon.h" 21 21 #include <VBox/VMMDev.h> 22 #include <iprt/alloc.h> 23 24 static DECLCALLBACK(void *) hgsmiEnvAlloc(void *pvEnv, HGSMISIZE cb) 25 { 26 NOREF(pvEnv); 27 return RTMemAlloc(cb); 28 } 29 30 static DECLCALLBACK(void) hgsmiEnvFree(void *pvEnv, void *pv) 31 { 32 NOREF(pvEnv); 33 RTMemFree(pv); 34 } 35 36 static HGSMIENV g_hgsmiEnvMP = 37 { 38 NULL, 39 hgsmiEnvAlloc, 40 hgsmiEnvFree 41 }; 22 42 23 43 /** … … 68 88 cbGuestHeapMemory, 69 89 offVRAMBaseMapping 70 + offGuestHeapMemory); 90 + offGuestHeapMemory, 91 &g_hgsmiEnvMP); 71 92 72 93 if (RT_FAILURE(rc)) -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPShgsmi.cpp
r44529 r50482 186 186 } 187 187 188 int VBoxSHGSMIInit(PVBOXSHGSMI pHeap, void *pvBase, HGSMISIZE cbArea, HGSMIOFFSET offBase, bool fOffsetBased) 188 int VBoxSHGSMIInit(PVBOXSHGSMI pHeap, uint32_t u32HeapType, void *pvBase, HGSMISIZE cbArea, HGSMIOFFSET offBase, 189 const HGSMIENV *pEnv) 189 190 { 190 191 KeInitializeSpinLock(&pHeap->HeapLock); 191 return HGSMIHeapSetup(&pHeap->Heap, pvBase, cbArea, offBase, fOffsetBased);192 return HGSMIHeapSetup(&pHeap->Heap, u32HeapType, pvBase, cbArea, offBase, pEnv); 192 193 } 193 194 -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPShgsmi.h
r46757 r50482 61 61 } 62 62 63 int VBoxSHGSMIInit(PVBOXSHGSMI pHeap, void *pvBase, HGSMISIZE cbArea, HGSMIOFFSET offBase, bool fOffsetBased);63 int VBoxSHGSMIInit(PVBOXSHGSMI pHeap, uint32_t u32HeapType, void *pvBase, HGSMISIZE cbArea, HGSMIOFFSET offBase, const HGSMIENV *pEnv); 64 64 void VBoxSHGSMITerm(PVBOXSHGSMI pHeap); 65 65 void* VBoxSHGSMIHeapAlloc(PVBOXSHGSMI pHeap, HGSMISIZE cbData, uint8_t u8Channel, uint16_t u16ChannelInfo); -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVdma.cpp
r49244 r50482 1451 1451 #endif 1452 1452 1453 static DECLCALLBACK(void *) hgsmiEnvAlloc(void *pvEnv, HGSMISIZE cb) 1454 { 1455 NOREF(pvEnv); 1456 return RTMemAlloc(cb); 1457 } 1458 1459 static DECLCALLBACK(void) hgsmiEnvFree(void *pvEnv, void *pv) 1460 { 1461 NOREF(pvEnv); 1462 RTMemFree(pv); 1463 } 1464 1465 static HGSMIENV g_hgsmiEnvVdma = 1466 { 1467 NULL, 1468 hgsmiEnvAlloc, 1469 hgsmiEnvFree 1470 }; 1471 1453 1472 /* create a DMACommand buffer */ 1454 1473 int vboxVdmaCreate(PVBOXMP_DEVEXT pDevExt, VBOXVDMAINFO *pInfo … … 1486 1505 /* Setup a HGSMI heap within the adapter information area. */ 1487 1506 rc = VBoxSHGSMIInit(&pInfo->CmdHeap, 1507 HGSMI_HEAP_TYPE_POINTER, 1488 1508 pvBuffer, 1489 1509 cbBuffer, 1490 1510 offBuffer, 1491 false /*fOffsetBased*/);1511 &g_hgsmiEnvVdma); 1492 1512 Assert(RT_SUCCESS(rc)); 1493 1513 if(RT_SUCCESS(rc)) -
trunk/src/VBox/Additions/common/VBoxVideo/HGSMIBase.cpp
r44528 r50482 320 320 void *pvGuestHeapMemory, 321 321 uint32_t cbGuestHeapMemory, 322 uint32_t offVRAMGuestHeapMemory) 322 uint32_t offVRAMGuestHeapMemory, 323 const HGSMIENV *pEnv) 323 324 { 324 325 /** @todo should we be using a fixed ISA port value here? */ 325 326 pCtx->port = (RTIOPORT)VGA_PORT_HGSMI_GUEST; 326 327 #ifdef VBOX_WDDM_MINIPORT 327 return VBoxSHGSMIInit(&pCtx->heapCtx, pvGuestHeapMemory, 328 cbGuestHeapMemory, offVRAMGuestHeapMemory, 329 false /*fOffsetBased*/); 328 return VBoxSHGSMIInit(&pCtx->heapCtx, HGSMI_HEAP_TYPE_POINTER, pvGuestHeapMemory, 329 cbGuestHeapMemory, offVRAMGuestHeapMemory, pEnv); 330 330 #else 331 return HGSMIHeapSetup(&pCtx->heapCtx, pvGuestHeapMemory, 332 cbGuestHeapMemory, offVRAMGuestHeapMemory, 333 false /*fOffsetBased*/); 331 return HGSMIHeapSetup(&pCtx->heapCtx, HGSMI_HEAP_TYPE_POINTER, pvGuestHeapMemory, 332 cbGuestHeapMemory, offVRAMGuestHeapMemory, pEnv); 334 333 #endif 335 334 } -
trunk/src/VBox/Devices/Graphics/HGSMI/HGSMIHost.cpp
r50078 r50482 1113 1113 } 1114 1114 1115 static DECLCALLBACK(void *) hgsmiEnvAlloc(void *pvEnv, HGSMISIZE cb) 1116 { 1117 NOREF(pvEnv); 1118 return RTMemAlloc(cb); 1119 } 1120 1121 static DECLCALLBACK(void) hgsmiEnvFree(void *pvEnv, void *pv) 1122 { 1123 NOREF(pvEnv); 1124 RTMemFree(pv); 1125 } 1126 1127 static HGSMIENV g_hgsmiEnv = 1128 { 1129 NULL, 1130 hgsmiEnvAlloc, 1131 hgsmiEnvFree 1132 }; 1133 1115 1134 int HGSMISetupHostHeap (PHGSMIINSTANCE pIns, 1116 1135 HGSMIOFFSET offHeap, … … 1144 1163 { 1145 1164 rc = HGSMIHeapSetup (&pIns->hostHeap, 1165 HGSMI_HEAP_TYPE_OFFSET, 1146 1166 pIns->area.pu8Base+offHeap, 1147 1167 cbHeap, 1148 1168 offHeap, 1149 true /*fOffsetBased*/);1169 &g_hgsmiEnv); 1150 1170 } 1151 1171 … … 1376 1396 1377 1397 rc = HGSMIHeapRelocate(&pIns->hostHeap, 1398 u32Version > VGA_SAVEDSTATE_VERSION_HOST_HEAP? 1399 HGSMI_HEAP_TYPE_OFFSET: 1400 HGSMI_HEAP_TYPE_POINTER, 1378 1401 pIns->area.pu8Base+offHeap, 1379 1402 off, … … 1381 1404 cbHeap, 1382 1405 offHeap, 1383 u32Version > VGA_SAVEDSTATE_VERSION_HOST_HEAP);1406 &g_hgsmiEnv); 1384 1407 1385 1408 hgsmiHostHeapUnlock (pIns); … … 1681 1704 pIns->pszName = VALID_PTR(pszName)? pszName: ""; 1682 1705 1683 HGSMIHeapSetupUni tialized(&pIns->hostHeap);1706 HGSMIHeapSetupUninitialized(&pIns->hostHeap); 1684 1707 1685 1708 pIns->pfnNotifyGuest = pfnNotifyGuest; … … 1725 1748 #endif 1726 1749 1727 HGSMIHeapSetupUni tialized(&pIns->hostHeap);1750 HGSMIHeapSetupUninitialized(&pIns->hostHeap); 1728 1751 1729 1752 return flags; -
trunk/src/VBox/GuestHost/HGSMI/HGSMICommon.cpp
r44528 r50482 5 5 6 6 /* 7 * Copyright (C) 2006-201 2Oracle Corporation7 * Copyright (C) 2006-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 189 189 } 190 190 191 void HGSMIHeapSetupUnitialized (HGSMIHEAP *pHeap) 192 { 193 pHeap->u.hPtr = NIL_RTHEAPSIMPLE; 194 pHeap->cRefs = 0; 195 pHeap->area.cbArea = 0; 196 pHeap->area.offBase = HGSMIOFFSET_VOID; 197 pHeap->area.offLast = HGSMIOFFSET_VOID; 198 pHeap->area.pu8Base = 0; 199 pHeap->fOffsetBased = false; 200 } 201 202 bool HGSMIHeapIsItialized (HGSMIHEAP *pHeap) 203 { 204 return pHeap->u.hPtr != NIL_RTHEAPSIMPLE; 191 void HGSMIHeapSetupUninitialized(HGSMIHEAP *pHeap) 192 { 193 RT_ZERO(*pHeap); 194 pHeap->u32HeapType = HGSMI_HEAP_TYPE_NULL; 205 195 } 206 196 207 197 int HGSMIHeapRelocate (HGSMIHEAP *pHeap, 198 uint32_t u32HeapType, 208 199 void *pvBase, 209 200 uint32_t offHeapHandle, … … 211 202 HGSMISIZE cbArea, 212 203 HGSMIOFFSET offBase, 213 bool fOffsetBased 214 ) 204 const HGSMIENV *pEnv) 215 205 { 216 206 if ( !pHeap … … 224 214 if (RT_SUCCESS (rc)) 225 215 { 226 if (fOffsetBased) 216 if (u32HeapType == HGSMI_HEAP_TYPE_MA) 217 { 218 /* @todo rc = HGSMIMAInit(&pHeap->u.ma, &pHeap->area, NULL, 0, 0, pEnv); */ 219 rc = VERR_NOT_IMPLEMENTED; 220 } 221 else if (u32HeapType == HGSMI_HEAP_TYPE_OFFSET) 222 { 227 223 pHeap->u.hOff = (RTHEAPOFFSET)((uint8_t *)pvBase + offHeapHandle); 228 else 224 } 225 else if (u32HeapType == HGSMI_HEAP_TYPE_POINTER) 229 226 { 230 227 pHeap->u.hPtr = (RTHEAPSIMPLE)((uint8_t *)pvBase + offHeapHandle); 231 228 rc = RTHeapSimpleRelocate (pHeap->u.hPtr, offDelta); AssertRC(rc); 232 229 } 233 if (RT_SUCCESS (rc)) 230 else 231 { 232 rc = VERR_NOT_SUPPORTED; 233 } 234 235 if (RT_SUCCESS(rc)) 234 236 { 235 237 pHeap->cRefs = 0; 236 pHeap-> fOffsetBased = fOffsetBased;238 pHeap->u32HeapType = u32HeapType; 237 239 } 238 240 else … … 246 248 247 249 int HGSMIHeapSetup (HGSMIHEAP *pHeap, 250 uint32_t u32HeapType, 248 251 void *pvBase, 249 252 HGSMISIZE cbArea, 250 253 HGSMIOFFSET offBase, 251 bool fOffsetBased)254 const HGSMIENV *pEnv) 252 255 { 253 256 if ( !pHeap … … 261 264 if (RT_SUCCESS (rc)) 262 265 { 263 if (!fOffsetBased) 266 if (u32HeapType == HGSMI_HEAP_TYPE_MA) 267 { 268 rc = HGSMIMAInit(&pHeap->u.ma, &pHeap->area, NULL, 0, 0, pEnv); 269 } 270 else if (u32HeapType == HGSMI_HEAP_TYPE_POINTER) 271 { 264 272 rc = RTHeapSimpleInit (&pHeap->u.hPtr, pvBase, cbArea); 273 } 274 else if (u32HeapType == HGSMI_HEAP_TYPE_OFFSET) 275 { 276 rc = RTHeapOffsetInit (&pHeap->u.hOff, pvBase, cbArea); 277 } 265 278 else 266 rc = RTHeapOffsetInit (&pHeap->u.hOff, pvBase, cbArea); 279 { 280 rc = VERR_NOT_SUPPORTED; 281 } 267 282 268 283 if (RT_SUCCESS (rc)) 269 284 { 270 285 pHeap->cRefs = 0; 271 pHeap-> fOffsetBased = fOffsetBased;286 pHeap->u32HeapType = u32HeapType; 272 287 } 273 288 else … … 284 299 if (pHeap) 285 300 { 301 if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_MA) 302 { 303 HGSMIMAUninit(&pHeap->u.ma); 304 } 286 305 Assert(!pHeap->cRefs); 287 pHeap->u.hPtr = NIL_RTHEAPSIMPLE; 288 HGSMIAreaClear (&pHeap->area); 289 pHeap->cRefs = 0; 306 HGSMIHeapSetupUninitialized(pHeap); 290 307 } 291 308 } … … 296 313 uint16_t u16ChannelInfo) 297 314 { 298 if (pHeap->u.hPtr == NIL_RTHEAPSIMPLE) 299 { 300 return NULL; 301 } 302 303 size_t cbAlloc = HGSMIBufferRequiredSize (cbData); 315 HGSMISIZE cbAlloc = HGSMIBufferRequiredSize (cbData); 304 316 305 317 HGSMIBUFFERHEADER *pHeader = (HGSMIBUFFERHEADER *)HGSMIHeapBufferAlloc (pHeap, cbAlloc); … … 326 338 { 327 339 if ( pvData 328 && pHeap->u .hPtr != NIL_RTHEAPSIMPLE)340 && pHeap->u32HeapType != HGSMI_HEAP_TYPE_NULL) 329 341 { 330 342 HGSMIBUFFERHEADER *pHeader = HGSMIBufferHeaderFromData (pvData); … … 336 348 void* HGSMIHeapBufferAlloc (HGSMIHEAP *pHeap, HGSMISIZE cbBuffer) 337 349 { 338 void* pvBuf; 339 if (!pHeap->fOffsetBased) 350 void* pvBuf = NULL; 351 if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_MA) 352 { 353 pvBuf = HGSMIMAAlloc(&pHeap->u.ma, cbBuffer); 354 } 355 else if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_POINTER) 356 { 340 357 pvBuf = RTHeapSimpleAlloc (pHeap->u.hPtr, cbBuffer, 0); 341 else 358 } 359 else if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_OFFSET) 360 { 342 361 pvBuf = RTHeapOffsetAlloc (pHeap->u.hOff, cbBuffer, 0); 343 344 if (!pvBuf) 345 return NULL; 346 347 ++pHeap->cRefs; 362 } 363 364 if (pvBuf) 365 { 366 ++pHeap->cRefs; 367 } 368 348 369 return pvBuf; 349 370 } 350 371 351 372 void HGSMIHeapBufferFree(HGSMIHEAP *pHeap, 352 void *pvBuf) 353 { 354 if (!pHeap->fOffsetBased) 373 void *pvBuf) 374 { 375 if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_MA) 376 { 377 HGSMIMAFree(&pHeap->u.ma, pvBuf); 378 } 379 else if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_POINTER) 380 { 355 381 RTHeapSimpleFree (pHeap->u.hPtr, pvBuf); 356 else 382 } 383 else if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_OFFSET) 384 { 357 385 RTHeapOffsetFree (pHeap->u.hOff, pvBuf); 386 } 358 387 359 388 --pHeap->cRefs; … … 377 406 } 378 407 379 const HGSMIBUFFERHEADER *pHeader = HGSMIOffsetToPointer (pArea, offBuffer);408 const HGSMIBUFFERHEADER *pHeader = (HGSMIBUFFERHEADER *)HGSMIOffsetToPointer (pArea, offBuffer); 380 409 381 410 /* Quick check of the data size, it should be less than the maximum -
trunk/src/VBox/GuestHost/HGSMI/Makefile.kmk
r41477 r50482 30 30 HGSMIGuestR0Lib_DEFS = 31 31 HGSMIGuestR0Lib_SOURCES = \ 32 HGSMICommon.cpp 32 HGSMICommon.cpp \ 33 HGSMIMemAlloc.cpp 33 34 endif 34 35 … … 40 41 HGSMIHostR3Lib_DEFS = 41 42 HGSMIHostR3Lib_SOURCES = \ 42 HGSMICommon.cpp 43 HGSMICommon.cpp \ 44 HGSMIMemAlloc.cpp 43 45 44 46 include $(FILE_KBUILD_SUB_FOOTER)
Note:
See TracChangeset
for help on using the changeset viewer.

