Changeset 25062 in vbox
- Timestamp:
- Nov 27, 2009 7:24:14 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 8 edited
-
include/VBox/HGSMI/HGSMI.h (modified) (3 diffs)
-
src/VBox/Additions/WINNT/Graphics/Display/screen.c (modified) (1 diff)
-
src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideoHGSMI.cpp (modified) (1 diff)
-
src/VBox/Devices/Graphics/DevVGA.cpp (modified) (1 diff)
-
src/VBox/Devices/Graphics/DevVGA.h (modified) (1 diff)
-
src/VBox/Devices/Graphics/DevVGASavedState.h (added)
-
src/VBox/Devices/Graphics/HGSMI/HGSMIHost.cpp (modified) (7 diffs)
-
src/VBox/Devices/Graphics/HGSMI/HGSMIHost.h (modified) (2 diffs)
-
src/VBox/GuestHost/HGSMI/HGSMICommon.cpp (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/HGSMI/HGSMI.h
r22652 r25062 153 153 typedef struct _HGSMIHEAP 154 154 { 155 RTHEAPSIMPLE heap; /* Heap instance. */ 156 HGSMIAREA area; /* Description. */ 157 int cRefs; /* Number of heap allocations. */ 155 union 156 { 157 RTHEAPSIMPLE hPtr; /**< Pointer based heap. */ 158 RTHEAPOFFSET hOff; /**< Offset based heap. */ 159 } u; 160 HGSMIAREA area; /**< Description. */ 161 int cRefs; /**< Number of heap allocations. */ 162 bool fOffsetBased; /**< Set if offset based. */ 158 163 } HGSMIHEAP; 159 164 #pragma pack() … … 262 267 void *pvBase, 263 268 HGSMISIZE cbArea, 264 HGSMIOFFSET offBase); 269 HGSMIOFFSET offBase, 270 bool fOffsetBased); 265 271 266 272 int HGSMIHeapRelocate (HGSMIHEAP *pHeap, 267 void *pvBase,268 uint32_t offHeapHandle,269 uintptr_t offDelta,270 HGSMISIZE cbArea,271 HGSMIOFFSET offBase272 );273 void *pvBase, 274 uint32_t offHeapHandle, 275 uintptr_t offDelta, 276 HGSMISIZE cbArea, 277 HGSMIOFFSET offBase, 278 bool fOffsetBased); 273 279 274 280 void HGSMIHeapSetupUnitialized (HGSMIHEAP *pHeap); … … 296 302 DECLINLINE(HGSMIOFFSET) HGSMIHeapHandleLocationOffset(HGSMIHEAP *pHeap) 297 303 { 298 return pHeap->heap != NIL_RTHEAPSIMPLE ? (uint32_t)(pHeap->area.pu8Base - (uint8_t*)pHeap->heap) : HGSMIOFFSET_VOID; 304 AssertCompile((uintptr_t)NIL_RTHEAPSIMPLE == (uintptr_t)NIL_RTHEAPOFFSET); 305 return pHeap->u.hPtr != NIL_RTHEAPSIMPLE 306 ? (HGSMIOFFSET)(pHeap->area.pu8Base - (uint8_t*)pHeap->u.hPtr) 307 : HGSMIOFFSET_VOID; 299 308 } 300 309 -
trunk/src/VBox/Additions/WINNT/Graphics/Display/screen.c
r22848 r25062 265 265 (uint8_t *)ppdev->pjScreen + ppdev->layout.offDisplayInformation + sizeof (HGSMIHOSTFLAGS), 266 266 ppdev->layout.cbDisplayInformation - sizeof (HGSMIHOSTFLAGS), 267 info.areaDisplay.offBase + ppdev->layout.offDisplayInformation + sizeof (HGSMIHOSTFLAGS)); 267 info.areaDisplay.offBase + ppdev->layout.offDisplayInformation + sizeof (HGSMIHOSTFLAGS), 268 false /*fOffsetBased*/); 268 269 269 270 DISPDBG((0, "VBoxDISP::vboxInitVBoxVideo: offBase 0x%x\n", -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideoHGSMI.cpp
r24709 r25062 692 692 PrimaryExtension->u.primary.pvAdapterInformation, 693 693 VBVA_ADAPTER_INFORMATION_SIZE - sizeof(HGSMIHOSTFLAGS), 694 PrimaryExtension->u.primary.cbVRAM - VBVA_ADAPTER_INFORMATION_SIZE); 694 PrimaryExtension->u.primary.cbVRAM - VBVA_ADAPTER_INFORMATION_SIZE, 695 false /*fOffsetBased*/); 695 696 696 697 if (RT_FAILURE (rc)) -
trunk/src/VBox/Devices/Graphics/DevVGA.cpp
r24714 r25062 5453 5453 5454 5454 if ( uVersion != VGA_SAVEDSTATE_VERSION 5455 && uVersion != VGA_SAVEDSTATE_VERSION_HOST_HEAP 5455 5456 && uVersion != VGA_SAVEDSTATE_VERSION_WITH_CONFIG 5456 5457 && uVersion != VGA_SAVEDSTATE_VERSION_HGSMI -
trunk/src/VBox/Devices/Graphics/DevVGA.h
r24926 r25062 46 46 47 47 #ifdef VBOX_WITH_HGSMI 48 # include "HGSMI/HGSMIHost.h"48 # include "HGSMI/HGSMIHost.h" 49 49 #endif /* VBOX_WITH_HGSMI */ 50 51 #define VGA_SAVEDSTATE_VERSION 5 52 #define VGA_SAVEDSTATE_VERSION_WITH_CONFIG 4 53 #define VGA_SAVEDSTATE_VERSION_HGSMI 3 54 #define VGA_SAVEDSTATE_VERSION_PRE_HGSMI 2 55 #define VGA_SAVEDSTATE_VERSION_ANCIENT 1 50 #include "DevVGASavedState.h" 56 51 57 52 #define MSR_COLOR_EMULATION 0x01 -
trunk/src/VBox/Devices/Graphics/HGSMI/HGSMIHost.cpp
r25050 r25062 74 74 75 75 #include "HGSMIHost.h" 76 #include "VBox/HGSMI/HGSMIChannels.h"77 #include "VBox/HGSMI/HGSMIChSetup.h"76 #include <VBox/HGSMI/HGSMIChannels.h> 77 #include <VBox/HGSMI/HGSMIChSetup.h> 78 78 79 79 #include "HGSMIHostHlp.h" 80 #include "../DevVGASavedState.h" 80 81 81 82 #ifdef DEBUG_sunlover … … 371 372 /* guest usually completes commands in the order it receives it 372 373 * if we're here this would typically means there is some cmd loss */ 373 Assert (0);374 AssertFailed(); 374 375 #endif 375 376 … … 1063 1064 if (pIns->hostHeap.cRefs) 1064 1065 { 1065 Assert (0);1066 AssertFailed(); 1066 1067 /* It is possible to change the heap only if there is no pending allocations. */ 1067 1068 rc = VERR_ACCESS_DENIED; … … 1070 1071 { 1071 1072 rc = HGSMIHeapSetup (&pIns->hostHeap, 1072 pIns->area.pu8Base+offHeap, 1073 cbHeap, 1074 offHeap); 1073 pIns->area.pu8Base+offHeap, 1074 cbHeap, 1075 offHeap, 1076 true /*fOffsetBased*/); 1075 1077 } 1076 1078 … … 1189 1191 int HGSMIHostLoadStateExec (PHGSMIINSTANCE pIns, PSSMHANDLE pSSM, uint32_t u32Version) 1190 1192 { 1191 if(u32Version < 3)1193 if(u32Version < VGA_SAVEDSTATE_VERSION_HGSMI) 1192 1194 return VINF_SUCCESS; 1193 1195 … … 1218 1220 Assert(!pIns->hostHeap.cRefs); 1219 1221 pIns->hostHeap.cRefs = 0; 1222 1220 1223 rc = HGSMIHeapRelocate(&pIns->hostHeap, 1221 pIns->area.pu8Base+offHeap, 1222 off, 1223 uintptr_t(pIns->area.pu8Base) - uintptr_t(oldMem), 1224 cbHeap, 1225 offHeap); 1224 pIns->area.pu8Base+offHeap, 1225 off, 1226 uintptr_t(pIns->area.pu8Base) - uintptr_t(oldMem), 1227 cbHeap, 1228 offHeap, 1229 u32Version > VGA_SAVEDSTATE_VERSION_HOST_HEAP); 1226 1230 1227 1231 hgsmiHostHeapUnlock (pIns); … … 1526 1530 1527 1531 rc = HGSMIHostChannelRegister (pIns, 1528 HGSMI_CH_HGSMI,1529 hgsmiChannelHandler,1530 pIns,1531 &sOldChannelHandler);1532 HGSMI_CH_HGSMI, 1533 hgsmiChannelHandler, 1534 pIns, 1535 &sOldChannelHandler); 1532 1536 1533 1537 if (RT_SUCCESS (rc)) -
trunk/src/VBox/Devices/Graphics/HGSMI/HGSMIHost.h
r22652 r25062 22 22 23 23 24 #ifndef __ HGSMIHost_h__25 #define __ HGSMIHost_h__24 #ifndef ___HGSMIHost_h 25 #define ___HGSMIHost_h 26 26 27 27 #include <VBox/vm.h> … … 143 143 #endif 144 144 145 #endif /* __HGSMIHost_h__*/ 145 #endif /* !___HGSMIHost_h*/ 146 -
trunk/src/VBox/GuestHost/HGSMI/HGSMICommon.cpp
r22652 r25062 155 155 uint8_t *pu8Base = (uint8_t *)pvBase; 156 156 157 if ( !pArea /* Check that the area: */158 || cbArea < HGSMIBufferMinimumSize () /* Large enough. */159 || pu8Base + cbArea < pu8Base /* No address space wrap. */160 || offBase > 0xFFFFFFFFU - cbArea/* Area within the 32 bit space: offBase + cbMem <= 0xFFFFFFFF */157 if ( !pArea /* Check that the area: */ 158 || cbArea < HGSMIBufferMinimumSize () /* Large enough. */ 159 || pu8Base + cbArea < pu8Base /* No address space wrap. */ 160 || offBase > UINT32_C(0xFFFFFFFF) - cbArea /* Area within the 32 bit space: offBase + cbMem <= 0xFFFFFFFF */ 161 161 ) 162 162 { … … 199 199 void HGSMIHeapSetupUnitialized (HGSMIHEAP *pHeap) 200 200 { 201 pHeap-> heap= NIL_RTHEAPSIMPLE;201 pHeap->u.hPtr = NIL_RTHEAPSIMPLE; 202 202 pHeap->cRefs = 0; 203 203 pHeap->area.cbArea = 0; … … 205 205 pHeap->area.offLast = HGSMIOFFSET_VOID; 206 206 pHeap->area.pu8Base = 0; 207 pHeap->fOffsetBased = false; 207 208 } 208 209 209 210 bool HGSMIHeapIsItialized (HGSMIHEAP *pHeap) 210 211 { 211 return pHeap-> heap!= NIL_RTHEAPSIMPLE;212 return pHeap->u.hPtr != NIL_RTHEAPSIMPLE; 212 213 } 213 214 214 215 int HGSMIHeapRelocate (HGSMIHEAP *pHeap, 215 void *pvBase, 216 uint32_t offHeapHandle, 217 uintptr_t offDelta, 218 HGSMISIZE cbArea, 219 HGSMIOFFSET offBase 220 ) 216 void *pvBase, 217 uint32_t offHeapHandle, 218 uintptr_t offDelta, 219 HGSMISIZE cbArea, 220 HGSMIOFFSET offBase, 221 bool fOffsetBased 222 ) 221 223 { 222 224 if ( !pHeap … … 230 232 if (RT_SUCCESS (rc)) 231 233 { 232 pHeap->heap = (RTHEAPSIMPLE)(((uint8_t*)pvBase) + offHeapHandle); 233 rc = RTHeapSimpleRelocate (pHeap->heap, offDelta); AssertRC(rc); 234 if (fOffsetBased) 235 pHeap->u.hOff = (RTHEAPOFFSET)((uint8_t *)pvBase + offHeapHandle); 236 else 237 { 238 pHeap->u.hPtr = (RTHEAPSIMPLE)((uint8_t *)pvBase + offHeapHandle); 239 rc = RTHeapSimpleRelocate (pHeap->u.hPtr, offDelta); AssertRC(rc); 240 } 234 241 if (RT_SUCCESS (rc)) 235 242 { 236 243 pHeap->cRefs = 0; 244 pHeap->fOffsetBased = fOffsetBased; 237 245 } 238 246 else … … 248 256 void *pvBase, 249 257 HGSMISIZE cbArea, 250 HGSMIOFFSET offBase) 258 HGSMIOFFSET offBase, 259 bool fOffsetBased) 251 260 { 252 261 if ( !pHeap … … 260 269 if (RT_SUCCESS (rc)) 261 270 { 262 rc = RTHeapSimpleInit (&pHeap->heap, pvBase, cbArea); 271 if (!fOffsetBased) 272 rc = RTHeapSimpleInit (&pHeap->u.hPtr, pvBase, cbArea); 273 else 274 rc = RTHeapOffsetInit (&pHeap->u.hOff, pvBase, cbArea); 263 275 264 276 if (RT_SUCCESS (rc)) 265 277 { 266 278 pHeap->cRefs = 0; 279 pHeap->fOffsetBased = fOffsetBased; 267 280 } 268 281 else … … 279 292 if (pHeap) 280 293 { 281 pHeap-> heap= NIL_RTHEAPSIMPLE;294 pHeap->u.hPtr = NIL_RTHEAPSIMPLE; 282 295 HGSMIAreaClear (&pHeap->area); 283 296 pHeap->cRefs = 0; … … 290 303 uint16_t u16ChannelInfo) 291 304 { 292 if (pHeap-> heap== NIL_RTHEAPSIMPLE)305 if (pHeap->u.hPtr == NIL_RTHEAPSIMPLE) 293 306 { 294 307 return NULL; … … 297 310 size_t cbAlloc = HGSMIBufferRequiredSize (cbData); 298 311 299 HGSMIBUFFERHEADER *pHeader = (HGSMIBUFFERHEADER *)RTHeapSimpleAlloc (pHeap->heap, cbAlloc, 0); 312 HGSMIBUFFERHEADER *pHeader; 313 if (!pHeap->fOffsetBased) 314 pHeader = (HGSMIBUFFERHEADER *)RTHeapSimpleAlloc (pHeap->u.hPtr, cbAlloc, 0); 315 else 316 pHeader = (HGSMIBUFFERHEADER *)RTHeapOffsetAlloc (pHeap->u.hOff, cbAlloc, 0); 300 317 301 318 if (!pHeader) … … 325 342 { 326 343 if ( pvData 327 && pHeap-> heap!= NIL_RTHEAPSIMPLE)344 && pHeap->u.hPtr != NIL_RTHEAPSIMPLE) 328 345 { 329 346 HGSMIBUFFERHEADER *pHeader = HGSMIBufferHeaderFromData (pvData); 330 347 331 RTHeapSimpleFree (pHeap->heap, pHeader); 348 if (!pHeap->fOffsetBased) 349 RTHeapSimpleFree (pHeap->u.hPtr, pHeader); 350 else 351 RTHeapOffsetFree (pHeap->u.hOff, pHeader); 332 352 333 353 --pHeap->cRefs;
Note:
See TracChangeset
for help on using the changeset viewer.

