Changeset 55421 in vbox
- Timestamp:
- Apr 24, 2015 12:00:21 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 99763
- Location:
- trunk
- Files:
-
- 10 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 -
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/xpdm/VBoxDispVBVA.cpp
r50542 r55421 425 425 426 426 rc = HGSMIHeapSetup(&pDev->hgsmi.ctx.heapCtx, 427 HGSMI_HEAP_TYPE_MA,428 427 (uint8_t *)pDev->memInfo.VideoRamBase+pDev->layout.offDisplayInfo+sizeof(HGSMIHOSTFLAGS), 429 428 pDev->layout.cbDisplayInfo-sizeof(HGSMIHOSTFLAGS), -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPShgsmi.cpp
r50859 r55421 186 186 } 187 187 188 int VBoxSHGSMIInit(PVBOXSHGSMI pHeap, uint32_t u32HeapType,void *pvBase, HGSMISIZE cbArea, HGSMIOFFSET offBase,188 int VBoxSHGSMIInit(PVBOXSHGSMI pHeap, void *pvBase, HGSMISIZE cbArea, HGSMIOFFSET offBase, 189 189 const HGSMIENV *pEnv) 190 190 { 191 191 KeInitializeSpinLock(&pHeap->HeapLock); 192 return HGSMIHeapSetup(&pHeap->Heap, u32HeapType,pvBase, cbArea, offBase, pEnv);192 return HGSMIHeapSetup(&pHeap->Heap, pvBase, cbArea, offBase, pEnv); 193 193 } 194 194 -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPShgsmi.h
r50859 r55421 60 60 } 61 61 62 int VBoxSHGSMIInit(PVBOXSHGSMI pHeap, uint32_t u32HeapType,void *pvBase, HGSMISIZE cbArea, HGSMIOFFSET offBase, const HGSMIENV *pEnv);62 int VBoxSHGSMIInit(PVBOXSHGSMI pHeap, void *pvBase, HGSMISIZE cbArea, HGSMIOFFSET offBase, const HGSMIENV *pEnv); 63 63 void VBoxSHGSMITerm(PVBOXSHGSMI pHeap); 64 64 void* VBoxSHGSMIHeapAlloc(PVBOXSHGSMI pHeap, HGSMISIZE cbData, uint8_t u8Channel, uint16_t u16ChannelInfo); -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVdma.cpp
r52329 r55421 1628 1628 /* Setup a HGSMI heap within the adapter information area. */ 1629 1629 rc = VBoxSHGSMIInit(&pInfo->CmdHeap, 1630 HGSMI_HEAP_TYPE_MA,1631 1630 pvBuffer, 1632 1631 cbBuffer, -
trunk/src/VBox/Additions/common/VBoxVideo/HGSMIBase.cpp
r55193 r55421 341 341 pCtx->port = (RTIOPORT)VGA_PORT_HGSMI_GUEST; 342 342 #ifdef VBOX_WDDM_MINIPORT 343 return VBoxSHGSMIInit(&pCtx->heapCtx, HGSMI_HEAP_TYPE_MA,pvGuestHeapMemory,343 return VBoxSHGSMIInit(&pCtx->heapCtx, pvGuestHeapMemory, 344 344 cbGuestHeapMemory, offVRAMGuestHeapMemory, pEnv); 345 345 #else 346 return HGSMIHeapSetup(&pCtx->heapCtx, HGSMI_HEAP_TYPE_MA,pvGuestHeapMemory,346 return HGSMIHeapSetup(&pCtx->heapCtx, pvGuestHeapMemory, 347 347 cbGuestHeapMemory, offVRAMGuestHeapMemory, pEnv); 348 348 #endif -
trunk/src/VBox/Devices/Graphics/DevVGA_VBVA.cpp
r55342 r55421 2273 2273 pHeap->u32HeapOffset, pHeap->u32HeapSize)); 2274 2274 2275 rc = HGSMI SetupHostHeap(pIns, pHeap->u32HeapOffset, pHeap->u32HeapSize);2275 rc = HGSMIHostHeapSetup(pIns, pHeap->u32HeapOffset, pHeap->u32HeapSize); 2276 2276 } break; 2277 2277 -
trunk/src/VBox/Devices/Graphics/HGSMI/HGSMIHost.cpp
r55401 r55421 67 67 68 68 #include <VBox/err.h> 69 #define LOG_GROUP LOG_GROUP_ DEV_VGA69 #define LOG_GROUP LOG_GROUP_HGSMI 70 70 #include <VBox/log.h> 71 71 #include <VBox/vmm/ssm.h> … … 133 133 134 134 135 /* Host heap types. */ 136 #define HGSMI_HEAP_TYPE_NULL 0 /* Heap not initialized. */ 137 #define HGSMI_HEAP_TYPE_POINTER 1 /* Deprecated, used only for old saved states. RTHEAPSIMPLE. */ 138 #define HGSMI_HEAP_TYPE_OFFSET 2 /* Deprecated, used only for old saved states. RTHEAPOFFSET. */ 139 #define HGSMI_HEAP_TYPE_MA 3 /* Memory allocator. */ 140 141 typedef struct HGSMIHOSTHEAP 142 { 143 uint32_t u32HeapType; /* HGSMI_HEAP_TYPE_* */ 144 int32_t volatile cRefs; /* How many blocks allocated. */ 145 HGSMIAREA area; /* Host heap location. */ 146 union 147 { 148 HGSMIMADATA ma; /* Memory allocator for the default host heap implementation. */ 149 struct /* Legacy heap implementations. For old saved states. */ 150 { 151 union 152 { 153 RTHEAPSIMPLE hPtr; /* Pointer based heap. */ 154 RTHEAPOFFSET hOff; /* Offset based heap. */ 155 } u; 156 } legacy; 157 } u; 158 } HGSMIHOSTHEAP; 159 135 160 typedef struct HGSMIINSTANCE 136 161 { … … 142 167 143 168 HGSMIAREA area; /* The shared memory description. */ 144 HGSMIH EAP hostHeap;/* Host heap instance. */169 HGSMIHOSTHEAP hostHeap; /* Host heap instance. */ 145 170 RTCRITSECT hostHeapCritSect; /* Heap serialization lock. */ 146 171 … … 182 207 volatile uint32_t fl; /* Status flags of the entry. */ 183 208 184 HGSMIOFFSET offBuffer; /* Offset in the memory region of the entry data. */ 209 HGSMIOFFSET offBuffer; /* Offset of the HGSMI buffer header in the HGSMI host heap: 210 * [pIns->hostHeap.area.offBase .. offLast]. */ 185 211 186 212 #if 0 … … 510 536 } 511 537 538 static HGSMIOFFSET hgsmiHostHeapOffset(HGSMIHOSTHEAP *pHeap) 539 { 540 return pHeap->area.offBase; 541 } 542 543 static HGSMISIZE hgsmiHostHeapSize(HGSMIHOSTHEAP *pHeap) 544 { 545 return pHeap->area.cbArea; 546 } 547 548 static void *hgsmiHostHeapBufferAlloc(HGSMIHOSTHEAP *pHeap, 549 HGSMISIZE cbBuffer) 550 { 551 void *pvBuf = NULL; 552 553 if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_MA) 554 { 555 pvBuf = HGSMIMAAlloc(&pHeap->u.ma, cbBuffer); 556 } 557 else if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_POINTER) 558 { 559 pvBuf = RTHeapSimpleAlloc(pHeap->u.legacy.u.hPtr, cbBuffer, 0); 560 } 561 else if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_OFFSET) 562 { 563 pvBuf = RTHeapOffsetAlloc(pHeap->u.legacy.u.hOff, cbBuffer, 0); 564 } 565 566 if (pvBuf) 567 { 568 ++pHeap->cRefs; 569 } 570 571 return pvBuf; 572 } 573 574 static void hgsmiHostHeapBufferFree(HGSMIHOSTHEAP *pHeap, 575 void *pvBuf) 576 { 577 if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_MA) 578 { 579 HGSMIMAFree(&pHeap->u.ma, pvBuf); 580 } 581 else if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_POINTER) 582 { 583 RTHeapSimpleFree(pHeap->u.legacy.u.hPtr, pvBuf); 584 } 585 else if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_OFFSET) 586 { 587 RTHeapOffsetFree(pHeap->u.legacy.u.hOff, pvBuf); 588 } 589 --pHeap->cRefs; 590 } 591 592 static void *hgsmiHostHeapDataAlloc(HGSMIHOSTHEAP *pHeap, 593 HGSMISIZE cbData, 594 uint8_t u8Channel, 595 uint16_t u16ChannelInfo) 596 { 597 HGSMISIZE cbAlloc = HGSMIBufferRequiredSize(cbData); 598 HGSMIBUFFERHEADER *pHeader = (HGSMIBUFFERHEADER *)hgsmiHostHeapBufferAlloc(pHeap, cbAlloc); 599 if (!pHeader) 600 return NULL; 601 602 HGSMIBufferInitializeSingle(&pHeap->area, pHeader, cbAlloc, u8Channel, u16ChannelInfo); 603 604 return HGSMIBufferDataFromPtr(pHeader); 605 } 606 607 static void hgsmiHostHeapDataFree(HGSMIHOSTHEAP *pHeap, 608 void *pvData) 609 { 610 if ( pvData 611 && pHeap->u32HeapType != HGSMI_HEAP_TYPE_NULL) 612 { 613 HGSMIBUFFERHEADER *pHeader = HGSMIBufferHeaderFromData(pvData); 614 hgsmiHostHeapBufferFree(pHeap, pHeader); 615 } 616 } 617 618 /* Needed for heap relocation: offset of the heap handle relative to the start of heap area. */ 619 static HGSMIOFFSET hgsmiHostHeapHandleLocationOffset(HGSMIHOSTHEAP *pHeap) 620 { 621 HGSMIOFFSET offHeapHandle; 622 if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_POINTER) 623 { 624 offHeapHandle = (HGSMIOFFSET)((uintptr_t)pHeap->u.legacy.u.hPtr - (uintptr_t)pHeap->area.pu8Base); 625 } 626 else if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_OFFSET) 627 { 628 offHeapHandle = (HGSMIOFFSET)((uintptr_t)pHeap->u.legacy.u.hOff - (uintptr_t)pHeap->area.pu8Base); 629 } 630 else 631 { 632 offHeapHandle = HGSMIOFFSET_VOID; 633 } 634 return offHeapHandle; 635 } 636 637 static int hgsmiHostHeapRelocate(HGSMIHOSTHEAP *pHeap, 638 uint32_t u32HeapType, 639 void *pvBase, 640 uint32_t offHeapHandle, 641 uintptr_t offDelta, 642 HGSMISIZE cbArea, 643 HGSMIOFFSET offBase) 644 { 645 int rc = HGSMIAreaInitialize(&pHeap->area, pvBase, cbArea, offBase); 646 if (RT_SUCCESS(rc)) 647 { 648 if (u32HeapType == HGSMI_HEAP_TYPE_OFFSET) 649 { 650 pHeap->u.legacy.u.hOff = (RTHEAPOFFSET)((uint8_t *)pvBase + offHeapHandle); 651 } 652 else if (u32HeapType == HGSMI_HEAP_TYPE_POINTER) 653 { 654 pHeap->u.legacy.u.hPtr = (RTHEAPSIMPLE)((uint8_t *)pvBase + offHeapHandle); 655 rc = RTHeapSimpleRelocate(pHeap->u.legacy.u.hPtr, offDelta); AssertRC(rc); 656 } 657 else 658 { 659 /* HGSMI_HEAP_TYPE_MA does not need the relocation. */ 660 rc = VERR_NOT_SUPPORTED; 661 } 662 663 if (RT_SUCCESS(rc)) 664 { 665 pHeap->u32HeapType = u32HeapType; 666 } 667 else 668 { 669 HGSMIAreaClear(&pHeap->area); 670 } 671 } 672 673 return rc; 674 } 675 676 static int hgsmiHostHeapRestoreMA(HGSMIHOSTHEAP *pHeap, 677 void *pvBase, 678 HGSMISIZE cbArea, 679 HGSMIOFFSET offBase, 680 uint32_t cBlocks, 681 HGSMIOFFSET *paDescriptors, 682 HGSMISIZE cbMaxBlock, 683 HGSMIENV *pEnv) 684 { 685 int rc = HGSMIAreaInitialize(&pHeap->area, pvBase, cbArea, offBase); 686 if (RT_SUCCESS(rc)) 687 { 688 rc = HGSMIMAInit(&pHeap->u.ma, &pHeap->area, paDescriptors, cBlocks, cbMaxBlock, pEnv); 689 690 if (RT_FAILURE(rc)) 691 { 692 HGSMIAreaClear(&pHeap->area); 693 } 694 } 695 696 return rc; 697 } 698 699 static void hgsmiHostHeapSetupUninitialized(HGSMIHOSTHEAP *pHeap) 700 { 701 RT_ZERO(*pHeap); 702 pHeap->u32HeapType = HGSMI_HEAP_TYPE_NULL; 703 } 704 705 static void hgsmiHostHeapDestroy(HGSMIHOSTHEAP *pHeap) 706 { 707 if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_MA) 708 { 709 HGSMIMAUninit(&pHeap->u.ma); 710 } 711 hgsmiHostHeapSetupUninitialized(pHeap); 712 } 713 512 714 static int hgsmiHostFIFOAlloc (HGSMIINSTANCE *pIns, HGSMIHOSTFIFOENTRY **ppEntry) 513 715 { … … 557 759 static int hgsmiHostCommandFreeByEntry (HGSMIHOSTFIFOENTRY *pEntry) 558 760 { 761 LogFlowFunc(("offBuffer 0x%08X\n", pEntry->offBuffer)); 762 559 763 HGSMIINSTANCE *pIns = pEntry->pIns; 560 764 int rc = hgsmiFIFOLock (pIns); … … 564 768 hgsmiFIFOUnlock (pIns); 565 769 566 void *pv Mem = HGSMIBufferDataFromOffset(&pIns->area, pEntry->offBuffer);770 void *pvData = HGSMIBufferDataFromOffset(&pIns->hostHeap.area, pEntry->offBuffer); 567 771 568 772 rc = hgsmiHostHeapLock (pIns); … … 570 774 { 571 775 /* Deallocate the host heap memory. */ 572 HGSMIHeapFree (&pIns->hostHeap, pvMem);776 hgsmiHostHeapDataFree(&pIns->hostHeap, pvData); 573 777 574 778 hgsmiHostHeapUnlock(pIns); … … 577 781 hgsmiHostFIFOFree (pIns, pEntry); 578 782 } 783 784 LogFlowFunc(("%Rrc\n", rc)); 579 785 return rc; 580 786 } 581 787 582 788 static int hgsmiHostCommandFree (HGSMIINSTANCE *pIns, 583 void *pvMem) 584 { 585 HGSMIOFFSET offMem = HGSMIHeapBufferOffset (&pIns->hostHeap, pvMem); 789 void *pvData) 790 { 586 791 int rc = VINF_SUCCESS; 587 if (offMem != HGSMIOFFSET_VOID) 588 { 792 if (HGSMIAreaContainsPointer(&pIns->hostHeap.area, pvData)) 793 { 794 HGSMIHOSTFIFOENTRY *pEntry = NULL; 795 HGSMIOFFSET offBuffer = HGSMIBufferOffsetFromData(&pIns->hostHeap.area, pvData); 796 589 797 rc = hgsmiFIFOLock (pIns); 590 798 if(RT_SUCCESS(rc)) 591 799 { 592 /* Search the Processed list for the given offMem. */ 593 HGSMIHOSTFIFOENTRY *pEntry = NULL; 594 800 /* Search the Processed list for the given offBuffer. */ 595 801 HGSMIHOSTFIFOENTRY *pIter; 596 802 RTListForEach(&pIns->hostFIFOProcessed, pIter, HGSMIHOSTFIFOENTRY, nodeEntry) … … 598 804 Assert(pIter->fl == (HGSMI_F_HOST_FIFO_ALLOCATED | HGSMI_F_HOST_FIFO_PROCESSED)); 599 805 600 if (pIter->offBuffer == off Mem)806 if (pIter->offBuffer == offBuffer) 601 807 { 602 808 pEntry = pIter; … … 611 817 else 612 818 { 613 LogRel(("HGSMI[%s]: the host frees unprocessed FIFO entry: 0x%08X\n", pIns->pszName, offMem));614 AssertFailed ();819 AssertLogRelMsgFailed(("HGSMI[%s]: the host frees unprocessed FIFO entry: 0x%08X\n", 820 pIns->pszName, offBuffer)); 615 821 } 616 822 … … 621 827 { 622 828 /* Deallocate the host heap memory. */ 623 HGSMIHeapFree (&pIns->hostHeap, pvMem);829 hgsmiHostHeapDataFree(&pIns->hostHeap, pvData); 624 830 625 831 hgsmiHostHeapUnlock(pIns); … … 636 842 else 637 843 { 844 AssertLogRelMsgFailed(("HGSMI[%s]: the host frees invalid FIFO entry: %p\n", 845 pIns->pszName, pvData)); 638 846 rc = VERR_INVALID_POINTER; 639 LogRel(("HGSMI[%s]: the host frees invalid FIFO entry: %p\n", pIns->pszName, pvMem));640 AssertFailed ();641 847 } 642 848 return rc; … … 776 982 #endif 777 983 /** 778 * Allocate a shared memory block. The host can write command/data to the memory. 779 * 780 * @param pIns Pointer to HGSMI instance, 781 * @param ppvMem Where to store the allocated memory pointer to data. 782 * @param cbMem How many bytes of data to allocate. 984 * Allocate a shared memory buffer. The host can write command/data to the memory. 985 * The allocated buffer contains the 'header', 'data' and the 'tail', but *ppvData 986 * will point to the 'data'. 987 * 988 * @return VBox status code. Pointer to the payload data in *ppvData. 989 * @param pIns HGSMI instance, 990 * @param ppvData Where to store the allocated memory pointer to data. 991 * @param cbData How many bytes of data to allocate. 992 * @param u8Channel HGSMI channel. 993 * @param u16ChannelInfo Command parameter. 783 994 */ 784 995 int HGSMIHostCommandAlloc (HGSMIINSTANCE *pIns, 785 void **ppv Mem,786 HGSMISIZE cb Mem,996 void **ppvData, 997 HGSMISIZE cbData, 787 998 uint8_t u8Channel, 788 999 uint16_t u16ChannelInfo) 789 1000 { 790 LogFlowFunc (("pIns = %p, cb Mem = 0x%08X(%d)\n", pIns, cbMem, cbMem));1001 LogFlowFunc (("pIns = %p, cbData = 0x%08X(%d)\n", pIns, cbData, cbData)); 791 1002 792 1003 int rc = hgsmiHostHeapLock (pIns); 793 1004 if(RT_SUCCESS(rc)) 794 1005 { 795 void *pv Mem = HGSMIHeapAlloc(&pIns->hostHeap,796 cbMem,797 u8Channel,798 u16ChannelInfo);1006 void *pvData = hgsmiHostHeapDataAlloc(&pIns->hostHeap, 1007 cbData, 1008 u8Channel, 1009 u16ChannelInfo); 799 1010 hgsmiHostHeapUnlock(pIns); 800 1011 801 if (pv Mem)802 { 803 *ppv Mem = pvMem;1012 if (pvData) 1013 { 1014 *ppvData = pvData; 804 1015 } 805 1016 else 806 1017 { 807 LogRel((0, "HGSMIHeapAlloc: HGSMIHeapAlloc failed\n")); 808 rc = VERR_GENERAL_FAILURE; 809 } 810 } 811 812 LogFlowFunc (("rc = %Rrc, pvMem = %p\n", rc, *ppvMem)); 813 1018 LogRel(("HGSMI[%s]: host heap allocation failed %dbytes\n", pIns->pszName, cbData)); 1019 rc = VERR_NO_MEMORY; 1020 } 1021 } 1022 1023 LogFlowFunc(("%Rrc, pvData = %p\n", rc, *ppvData)); 814 1024 return rc; 815 1025 } … … 819 1029 * and make it freed on completion. 820 1030 * The caller does not get notified in any way on command completion, 821 * on success return the pvMem buffer can not be used after being passed to this function 822 * 823 * @param pIns Pointer to HGSMI instance, 824 * @param pvMem The pointer returned by 'HGSMIHostCommandAlloc'. 825 * @param bDoIrq specifies whether the guest interrupt should be generated, 826 * i.e. in case the command is not urgent(e.g. some guest command completion notification that does not require post-processing) 827 * the command could be posted without raising an irq. 1031 * on successful return the pvData buffer can not be used after being passed to this function. 1032 * 1033 * @param pIns HGSMI instance, 1034 * @param pvData The pointer returned by 'HGSMIHostCommandAlloc'. 1035 * @param bDoIrq Specifies whether the guest interrupt should be generated. 1036 * In case the command is not urgent (e.g. some guest command 1037 * completion notification that does not require post-processing) 1038 * the command could be posted without raising an irq. 828 1039 */ 829 1040 int HGSMIHostCommandProcessAndFreeAsynch (PHGSMIINSTANCE pIns, 830 void *pv Mem,1041 void *pvData, 831 1042 bool bDoIrq) 832 1043 { 833 LogFlowFunc(("pIns = %p, pv Mem = %p\n", pIns, pvMem));1044 LogFlowFunc(("pIns = %p, pvData = %p\n", pIns, pvData)); 834 1045 835 1046 #if 0 … … 837 1048 #endif 838 1049 839 HGSMIOFFSET offBuffer = HGSMI HeapBufferOffset (&pIns->hostHeap, pvMem);1050 HGSMIOFFSET offBuffer = HGSMIBufferOffsetFromData(&pIns->hostHeap.area, pvData); 840 1051 841 1052 int rc = hgsmiHostCommandProcess (pIns, offBuffer, … … 925 1136 }; 926 1137 927 int HGSMI SetupHostHeap(PHGSMIINSTANCE pIns,928 929 1138 int HGSMIHostHeapSetup(PHGSMIINSTANCE pIns, 1139 HGSMIOFFSET offHeap, 1140 HGSMISIZE cbHeap) 930 1141 { 931 1142 LogFlowFunc(("pIns %p, offHeap 0x%08X, cbHeap = 0x%08X\n", pIns, offHeap, cbHeap)); … … 933 1144 int rc = VINF_SUCCESS; 934 1145 935 Assert (pIns); 936 937 // if ( offHeap >= pIns->cbMem 938 // || cbHeap > pIns->cbMem 939 // || offHeap + cbHeap > pIns->cbMem) 940 // { 941 // rc = VERR_INVALID_PARAMETER; 942 // } 943 // else 1146 AssertPtrReturn(pIns, VERR_INVALID_PARAMETER); 1147 1148 if ( offHeap >= pIns->area.cbArea 1149 || cbHeap > pIns->area.cbArea 1150 || offHeap > pIns->area.cbArea - cbHeap) 1151 { 1152 AssertLogRelMsgFailed(("offHeap 0x%08X, cbHeap = 0x%08X, pIns->area.cbArea 0x%08X\n", 1153 offHeap, cbHeap, pIns->area.cbArea)); 1154 rc = VERR_INVALID_PARAMETER; 1155 } 1156 else 944 1157 { 945 1158 rc = hgsmiHostHeapLock (pIns); … … 949 1162 if (pIns->hostHeap.cRefs) 950 1163 { 951 AssertFailed(); 1164 AssertLogRelMsgFailed(("HGSMI[%s]: host heap setup ignored. %d allocated.\n", 1165 pIns->pszName, pIns->hostHeap.cRefs)); 952 1166 /* It is possible to change the heap only if there is no pending allocations. */ 953 1167 rc = VERR_ACCESS_DENIED; … … 955 1169 else 956 1170 { 957 rc = HGSMIHeapSetup (&pIns->hostHeap, 958 HGSMI_HEAP_TYPE_MA, 959 pIns->area.pu8Base+offHeap, 960 cbHeap, 961 offHeap, 962 &g_hgsmiEnv); 1171 rc = HGSMIAreaInitialize(&pIns->hostHeap.area, pIns->area.pu8Base + offHeap, cbHeap, offHeap); 1172 if (RT_SUCCESS(rc)) 1173 { 1174 rc = HGSMIMAInit(&pIns->hostHeap.u.ma, &pIns->hostHeap.area, NULL, 0, 0, &g_hgsmiEnv); 1175 } 1176 1177 if (RT_SUCCESS(rc)) 1178 { 1179 pIns->hostHeap.u32HeapType = HGSMI_HEAP_TYPE_MA; 1180 } 1181 else 1182 { 1183 HGSMIAreaClear(&pIns->hostHeap.area); 1184 } 963 1185 } 964 1186 … … 1205 1427 off = pIns->hostHeap.u32HeapType == HGSMI_HEAP_TYPE_MA? 1206 1428 0: 1207 HGSMIHeapHandleLocationOffset(&pIns->hostHeap);1429 hgsmiHostHeapHandleLocationOffset(&pIns->hostHeap); 1208 1430 rc = SSMR3PutU32 (pSSM, off); 1209 1431 if(off != HGSMIOFFSET_VOID) 1210 1432 { 1211 SSMR3PutU32 (pSSM, HGSMIHeapOffset(&pIns->hostHeap));1212 SSMR3PutU32 (pSSM, HGSMIHeapSize(&pIns->hostHeap));1433 SSMR3PutU32 (pSSM, hgsmiHostHeapOffset(&pIns->hostHeap)); 1434 SSMR3PutU32 (pSSM, hgsmiHostHeapSize(&pIns->hostHeap)); 1213 1435 /* need save mem pointer to calculate offset on restore */ 1214 1436 SSMR3PutU64 (pSSM, (uint64_t)(uintptr_t)pIns->area.pu8Base); … … 1261 1483 pIns->pHGFlags = (off != HGSMIOFFSET_VOID) ? (HGSMIHOSTFLAGS*)HGSMIOffsetToPointer (&pIns->area, off) : NULL; 1262 1484 1263 HGSMIH EAP hHeap = pIns->hostHeap;1485 HGSMIHOSTHEAP hHeap = pIns->hostHeap; 1264 1486 rc = SSMR3GetU32(pSSM, &off); 1265 1487 AssertRCReturn(rc, rc); … … 1311 1533 if (RT_SUCCESS(rc)) 1312 1534 { 1313 rc = HGSMIHeapRestoreMA(&pIns->hostHeap,1314 pIns->area.pu8Base+offHeap,1315 cbHeap,1316 offHeap,1317 cBlocks,1318 paDescriptors,1319 cbMaxBlock,1320 &g_hgsmiEnv);1535 rc = hgsmiHostHeapRestoreMA(&pIns->hostHeap, 1536 pIns->area.pu8Base+offHeap, 1537 cbHeap, 1538 offHeap, 1539 cBlocks, 1540 paDescriptors, 1541 cbMaxBlock, 1542 &g_hgsmiEnv); 1321 1543 1322 1544 RTMemFree(paDescriptors); … … 1332 1554 pIns->hostHeap.cRefs = 0; 1333 1555 1334 rc = HGSMIHeapRelocate(&pIns->hostHeap,1335 u32HeapType,1336 pIns->area.pu8Base+offHeap,1337 off,1338 uintptr_t(pIns->area.pu8Base) - uintptr_t(oldMem),1339 cbHeap,1340 offHeap);1556 rc = hgsmiHostHeapRelocate(&pIns->hostHeap, 1557 u32HeapType, 1558 pIns->area.pu8Base+offHeap, 1559 off, 1560 uintptr_t(pIns->area.pu8Base) - uintptr_t(oldMem), 1561 cbHeap, 1562 offHeap); 1341 1563 1342 1564 hgsmiHostHeapUnlock (pIns); … … 1534 1756 size_t cbContext) 1535 1757 { 1536 LogFlowFunc(("ppIns = %p, pVM = %p, pszName = [%s], pu8MemBase = %p, cbMem = 0x%08X, offMemBase= 0x%08X, "1758 LogFlowFunc(("ppIns = %p, pVM = %p, pszName = [%s], offBase = 0x%08X, pu8MemBase = %p, cbMem = 0x%08X, " 1537 1759 "pfnNotifyGuest = %p, pvNotifyGuest = %p, cbContext = %d\n", 1538 1760 ppIns, 1539 1761 pVM, 1540 1762 pszName, 1763 offBase, 1541 1764 pu8MemBase, 1542 1765 cbMem, … … 1585 1808 pIns->pszName = VALID_PTR(pszName)? pszName: ""; 1586 1809 1587 HGSMIHeapSetupUninitialized(&pIns->hostHeap);1810 hgsmiHostHeapSetupUninitialized(&pIns->hostHeap); 1588 1811 1589 1812 pIns->pfnNotifyGuest = pfnNotifyGuest; … … 1634 1857 #endif 1635 1858 1636 HGSMIHeapDestroy(&pIns->hostHeap); 1637 1638 HGSMIHeapSetupUninitialized(&pIns->hostHeap); 1859 hgsmiHostHeapDestroy(&pIns->hostHeap); 1639 1860 1640 1861 return flags; … … 1647 1868 if (pIns) 1648 1869 { 1649 HGSMIHeapDestroy(&pIns->hostHeap);1870 hgsmiHostHeapDestroy(&pIns->hostHeap); 1650 1871 1651 1872 if (RTCritSectIsInitialized (&pIns->hostHeapCritSect)) -
trunk/src/VBox/Devices/Graphics/HGSMI/HGSMIHost.h
r55401 r55421 69 69 uint8_t *pu8Channel); 70 70 71 int HGSMI SetupHostHeap(PHGSMIINSTANCE pIns,72 73 71 int HGSMIHostHeapSetup(PHGSMIINSTANCE pIns, 72 HGSMIOFFSET offHeap, 73 HGSMISIZE cbHeap); 74 74 75 75 int HGSMISaveStateExec (PHGSMIINSTANCE pIns, PSSMHANDLE pSSM); … … 107 107 /* Allocate a buffer in the host heap. */ 108 108 int HGSMIHostCommandAlloc (PHGSMIINSTANCE pIns, 109 void **ppv Mem,110 HGSMISIZE cb Mem,109 void **ppvData, 110 HGSMISIZE cbData, 111 111 uint8_t u8Channel, 112 112 uint16_t u16ChannelInfo); … … 116 116 117 117 int HGSMIHostCommandProcessAndFreeAsynch (PHGSMIINSTANCE pIns, 118 void *pv Mem,118 void *pvData, 119 119 bool bDoIrq); 120 120 -
trunk/src/VBox/GuestHost/HGSMI/HGSMICommon.cpp
r55342 r55421 101 101 } 102 102 103 static HGSMIOFFSET hgsmiBufferInitializeSingle (const HGSMIAREA *pArea, 104 HGSMIBUFFERHEADER *pHeader, 105 uint32_t u32DataSize, 106 uint8_t u8Channel, 107 uint16_t u16ChannelInfo) 103 int HGSMIAreaInitialize (HGSMIAREA *pArea, void *pvBase, HGSMISIZE cbArea, HGSMIOFFSET offBase) 104 { 105 uint8_t *pu8Base = (uint8_t *)pvBase; 106 107 if ( !pArea /* Check that the area: */ 108 || cbArea < HGSMIBufferMinimumSize () /* Large enough. */ 109 || pu8Base + cbArea < pu8Base /* No address space wrap. */ 110 || offBase > UINT32_C(0xFFFFFFFF) - cbArea /* Area within the 32 bit space: offBase + cbMem <= 0xFFFFFFFF */ 111 ) 112 { 113 return VERR_INVALID_PARAMETER; 114 } 115 116 pArea->pu8Base = pu8Base; 117 pArea->offBase = offBase; 118 pArea->offLast = cbArea - HGSMIBufferMinimumSize () + offBase; 119 pArea->cbArea = cbArea; 120 121 return VINF_SUCCESS; 122 } 123 124 void HGSMIAreaClear (HGSMIAREA *pArea) 125 { 126 if (pArea) 127 { 128 memset (pArea, 0, sizeof (HGSMIAREA)); 129 } 130 } 131 132 /* Initialize the memory buffer including its checksum. 133 * No changes alloed to the header and the tail after that. 134 */ 135 HGSMIOFFSET HGSMIBufferInitializeSingle(const HGSMIAREA *pArea, 136 HGSMIBUFFERHEADER *pHeader, 137 HGSMISIZE cbBuffer, 138 uint8_t u8Channel, 139 uint16_t u16ChannelInfo) 108 140 { 109 141 if ( !pArea 110 || !pHeader) 142 || !pHeader 143 || cbBuffer < HGSMIBufferMinimumSize()) 111 144 { 112 145 return HGSMIOFFSET_VOID; … … 119 152 */ 120 153 HGSMISIZE cbMaximumDataSize = pArea->offLast - pArea->offBase; 154 uint32_t u32DataSize = cbBuffer - HGSMIBufferMinimumSize(); 121 155 122 156 if ( u32DataSize > cbMaximumDataSize … … 143 177 } 144 178 145 int HGSMIAreaInitialize (HGSMIAREA *pArea, void *pvBase, HGSMISIZE cbArea, HGSMIOFFSET offBase)146 {147 uint8_t *pu8Base = (uint8_t *)pvBase;148 149 if ( !pArea /* Check that the area: */150 || cbArea < HGSMIBufferMinimumSize () /* Large enough. */151 || pu8Base + cbArea < pu8Base /* No address space wrap. */152 || offBase > UINT32_C(0xFFFFFFFF) - cbArea /* Area within the 32 bit space: offBase + cbMem <= 0xFFFFFFFF */153 )154 {155 return VERR_INVALID_PARAMETER;156 }157 158 pArea->pu8Base = pu8Base;159 pArea->offBase = offBase;160 pArea->offLast = cbArea - HGSMIBufferMinimumSize () + offBase;161 pArea->cbArea = cbArea;162 163 return VINF_SUCCESS;164 }165 166 void HGSMIAreaClear (HGSMIAREA *pArea)167 {168 if (pArea)169 {170 memset (pArea, 0, sizeof (HGSMIAREA));171 }172 }173 174 /* Initialize the memory buffer including its checksum.175 * No changes alloed to the header and the tail after that.176 */177 HGSMIOFFSET HGSMIBufferInitializeSingle (const HGSMIAREA *pArea,178 HGSMIBUFFERHEADER *pHeader,179 HGSMISIZE cbBuffer,180 uint8_t u8Channel,181 uint16_t u16ChannelInfo)182 {183 if (cbBuffer < HGSMIBufferMinimumSize ())184 {185 return HGSMIOFFSET_VOID;186 }187 188 return hgsmiBufferInitializeSingle (pArea, pHeader, cbBuffer - HGSMIBufferMinimumSize (), u8Channel, u16ChannelInfo);189 }190 191 void HGSMIHeapSetupUninitialized(HGSMIHEAP *pHeap)192 {193 RT_ZERO(*pHeap);194 pHeap->u32HeapType = HGSMI_HEAP_TYPE_NULL;195 }196 197 int HGSMIHeapRelocate (HGSMIHEAP *pHeap,198 uint32_t u32HeapType,199 void *pvBase,200 uint32_t offHeapHandle,201 uintptr_t offDelta,202 HGSMISIZE cbArea,203 HGSMIOFFSET offBase)204 {205 if ( !pHeap206 || !pvBase)207 {208 return VERR_INVALID_PARAMETER;209 }210 211 int rc = HGSMIAreaInitialize (&pHeap->area, pvBase, cbArea, offBase);212 213 if (RT_SUCCESS (rc))214 {215 if (u32HeapType == HGSMI_HEAP_TYPE_OFFSET)216 {217 pHeap->u.hOff = (RTHEAPOFFSET)((uint8_t *)pvBase + offHeapHandle);218 }219 else if (u32HeapType == HGSMI_HEAP_TYPE_POINTER)220 {221 pHeap->u.hPtr = (RTHEAPSIMPLE)((uint8_t *)pvBase + offHeapHandle);222 rc = RTHeapSimpleRelocate (pHeap->u.hPtr, offDelta); AssertRC(rc);223 }224 else225 {226 /* HGSMI_HEAP_TYPE_MA does not need the relocation. */227 rc = VERR_NOT_SUPPORTED;228 }229 230 if (RT_SUCCESS(rc))231 {232 pHeap->cRefs = 0;233 pHeap->u32HeapType = u32HeapType;234 }235 else236 {237 HGSMIAreaClear (&pHeap->area);238 }239 }240 241 return rc;242 }243 244 int HGSMIHeapRestoreMA(HGSMIHEAP *pHeap,245 void *pvBase,246 HGSMISIZE cbArea,247 HGSMIOFFSET offBase,248 uint32_t cBlocks,249 HGSMIOFFSET *paDescriptors,250 HGSMISIZE cbMaxBlock,251 HGSMIENV *pEnv)252 {253 int rc = HGSMIAreaInitialize(&pHeap->area, pvBase, cbArea, offBase);254 255 if (RT_SUCCESS (rc))256 {257 rc = HGSMIMAInit(&pHeap->u.ma, &pHeap->area, paDescriptors, cBlocks, cbMaxBlock, pEnv);258 259 if (RT_SUCCESS(rc))260 {261 pHeap->cRefs = 0;262 pHeap->u32HeapType = HGSMI_HEAP_TYPE_MA;263 }264 else265 {266 HGSMIAreaClear(&pHeap->area);267 }268 }269 270 return rc;271 }272 273 179 int HGSMIHeapSetup (HGSMIHEAP *pHeap, 274 uint32_t u32HeapType,275 180 void *pvBase, 276 181 HGSMISIZE cbArea, … … 288 193 if (RT_SUCCESS (rc)) 289 194 { 290 if (u32HeapType == HGSMI_HEAP_TYPE_MA) 291 { 292 rc = HGSMIMAInit(&pHeap->u.ma, &pHeap->area, NULL, 0, 0, pEnv); 293 } 294 else if (u32HeapType == HGSMI_HEAP_TYPE_POINTER) 295 { 296 rc = RTHeapSimpleInit (&pHeap->u.hPtr, pvBase, cbArea); 297 } 298 else if (u32HeapType == HGSMI_HEAP_TYPE_OFFSET) 299 { 300 rc = RTHeapOffsetInit (&pHeap->u.hOff, pvBase, cbArea); 301 } 302 else 303 { 304 rc = VERR_NOT_SUPPORTED; 305 } 306 307 if (RT_SUCCESS (rc)) 308 { 309 pHeap->cRefs = 0; 310 pHeap->u32HeapType = u32HeapType; 311 } 312 else 195 rc = HGSMIMAInit(&pHeap->ma, &pHeap->area, NULL, 0, 0, pEnv); 196 if (RT_FAILURE(rc)) 313 197 { 314 198 HGSMIAreaClear (&pHeap->area); … … 323 207 if (pHeap) 324 208 { 325 if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_MA) 326 { 327 HGSMIMAUninit(&pHeap->u.ma); 328 } 329 Assert(!pHeap->cRefs); 330 HGSMIHeapSetupUninitialized(pHeap); 209 HGSMIMAUninit(&pHeap->ma); 331 210 } 332 211 } … … 343 222 return NULL; 344 223 345 hgsmiBufferInitializeSingle (&pHeap->area, pHeader, cbData, u8Channel, u16ChannelInfo); 224 HGSMIOFFSET offBuffer = HGSMIBufferInitializeSingle(HGSMIHeapArea(pHeap), pHeader, 225 cbAlloc, u8Channel, u16ChannelInfo); 226 if (offBuffer == HGSMIOFFSET_VOID) 227 { 228 HGSMIHeapBufferFree(pHeap, pHeader); 229 return NULL; 230 } 346 231 347 232 return HGSMIBufferData (pHeader); 348 }349 350 HGSMIOFFSET HGSMIHeapBufferOffset (HGSMIHEAP *pHeap,351 void *pvData)352 {353 HGSMIBUFFERHEADER *pHeader = HGSMIBufferHeaderFromData (pvData);354 355 HGSMIOFFSET offBuffer = HGSMIPointerToOffset (&pHeap->area, pHeader);356 357 return offBuffer;358 233 } 359 234 … … 361 236 void *pvData) 362 237 { 363 if ( pvData 364 && pHeap->u32HeapType != HGSMI_HEAP_TYPE_NULL) 238 if (pvData) 365 239 { 366 240 HGSMIBUFFERHEADER *pHeader = HGSMIBufferHeaderFromData (pvData); … … 372 246 void* HGSMIHeapBufferAlloc (HGSMIHEAP *pHeap, HGSMISIZE cbBuffer) 373 247 { 374 void* pvBuf = NULL; 375 if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_MA) 376 { 377 pvBuf = HGSMIMAAlloc(&pHeap->u.ma, cbBuffer); 378 } 379 else if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_POINTER) 380 { 381 pvBuf = RTHeapSimpleAlloc (pHeap->u.hPtr, cbBuffer, 0); 382 } 383 else if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_OFFSET) 384 { 385 pvBuf = RTHeapOffsetAlloc (pHeap->u.hOff, cbBuffer, 0); 386 } 387 388 if (pvBuf) 389 { 390 ++pHeap->cRefs; 391 } 392 248 void *pvBuf = HGSMIMAAlloc(&pHeap->ma, cbBuffer); 393 249 return pvBuf; 394 250 } … … 397 253 void *pvBuf) 398 254 { 399 if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_MA) 400 { 401 HGSMIMAFree(&pHeap->u.ma, pvBuf); 402 } 403 else if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_POINTER) 404 { 405 RTHeapSimpleFree (pHeap->u.hPtr, pvBuf); 406 } 407 else if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_OFFSET) 408 { 409 RTHeapOffsetFree (pHeap->u.hOff, pvBuf); 410 } 411 412 --pHeap->cRefs; 255 HGSMIMAFree(&pHeap->ma, pvBuf); 413 256 } 414 257 … … 457 300 uint32_t u32Checksum = HGSMIChecksum(offBuffer, &header, &tail); 458 301 LogFlowFunc(("checksum check: u32Checksum = 0x%x pTail->u32Checksum = 0x%x\n", 459 u32Checksum, pTail->u32Checksum));302 u32Checksum, tail.u32Checksum)); 460 303 if (u32Checksum == tail.u32Checksum) 461 304 { … … 468 311 { 469 312 LogFunc(("invalid checksum 0x%x, expected 0x%x!!!\n", 470 u32Checksum, pTail->u32Checksum));313 u32Checksum, tail.u32Checksum)); 471 314 rc = VERR_INVALID_STATE; 472 315 HGSMI_STRICT_ASSERT_FAILED(); … … 487 330 /* A wrapper to safely call the handler. 488 331 */ 489 static inthgsmiChannelHandlerCall(const HGSMICHANNELHANDLER *pHandler,490 const HGSMIBUFFERCONTEXT *pBufferContext)332 static void hgsmiChannelHandlerCall(const HGSMICHANNELHANDLER *pHandler, 333 const HGSMIBUFFERCONTEXT *pBufferContext) 491 334 { 492 335 LogFlowFunc(("pHandler %p\n", pHandler)); 493 494 int rc;495 336 496 337 if ( pHandler 497 338 && pHandler->pfnHandler) 498 339 { 499 rc = pHandler->pfnHandler(pHandler->pvHandler, pBufferContext->pHeader->u16ChannelInfo, 500 pBufferContext->pvData, pBufferContext->cbData); 501 } 502 else 503 { 504 /* It is a NOOP case here. */ 505 rc = VINF_SUCCESS; 506 } 507 508 LogFlowFunc(("leave rc = %Rrc\n", rc)); 509 return rc; 340 pHandler->pfnHandler(pHandler->pvHandler, pBufferContext->pHeader->u16ChannelInfo, 341 pBufferContext->pvData, pBufferContext->cbData); 342 } 510 343 } 511 344 … … 557 390 if (pChannel) 558 391 { 559 rc =hgsmiChannelHandlerCall(&pChannel->handler, &bufferContext);392 hgsmiChannelHandlerCall(&pChannel->handler, &bufferContext); 560 393 HGSMI_STRICT_ASSERT(RT_SUCCESS(hgsmiVerifyBuffer(pArea, offBuffer, &bufferContext))); 561 394 }
Note:
See TracChangeset
for help on using the changeset viewer.