Changeset 71590 in vbox
- Timestamp:
- Mar 31, 2018 6:34:28 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 37 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/Graphics/HGSMI.h
r71585 r71590 94 94 * @thread EMT on the host side. 95 95 */ 96 typedef DECLCALLBACK(int) FNHGSMICHANNELHANDLER(void *pvHandler, uint16_t u16ChannelInfo, void *pvBuffer, HGSMISIZE cbBuffer); 96 typedef DECLCALLBACK(int) FNHGSMICHANNELHANDLER(void *pvHandler, uint16_t u16ChannelInfo, 97 RT_UNTRUSTED_VOLATILE_HSTGST void *pvBuffer, HGSMISIZE cbBuffer); 97 98 /** Pointer to a channel handler callback. */ 98 99 typedef FNHGSMICHANNELHANDLER *PFNHGSMICHANNELHANDLER; … … 124 125 RT_C_DECLS_BEGIN 125 126 126 DECLINLINE(HGSMIBUFFERHEADER *) HGSMIBufferHeaderFromPtr(void *pvBuffer)127 DECLINLINE(HGSMIBUFFERHEADER *) HGSMIBufferHeaderFromPtr(void RT_UNTRUSTED_VOLATILE_HSTGST *pvBuffer) 127 128 { 128 129 return (HGSMIBUFFERHEADER *)pvBuffer; 129 130 } 130 131 131 DECLINLINE(uint8_t *) HGSMIBufferDataFromPtr(void*pvBuffer)132 { 133 return (uint8_t *)pvBuffer + sizeof(HGSMIBUFFERHEADER);134 } 135 136 DECLINLINE(HGSMIBUFFERTAIL *) HGSMIBufferTailFromPtr(void *pvBuffer,137 138 { 139 return (HGSMIBUFFERTAIL *)(HGSMIBufferDataFromPtr(pvBuffer) + u32DataSize);132 DECLINLINE(uint8_t RT_UNTRUSTED_VOLATILE_HSTGST *) HGSMIBufferDataFromPtr(void RT_UNTRUSTED_VOLATILE_HSTGST *pvBuffer) 133 { 134 return (uint8_t RT_UNTRUSTED_VOLATILE_HSTGST *)pvBuffer + sizeof(HGSMIBUFFERHEADER); 135 } 136 137 DECLINLINE(HGSMIBUFFERTAIL RT_UNTRUSTED_VOLATILE_HSTGST *) 138 HGSMIBufferTailFromPtr(void RT_UNTRUSTED_VOLATILE_HSTGST *pvBuffer, uint32_t u32DataSize) 139 { 140 return (HGSMIBUFFERTAIL RT_UNTRUSTED_VOLATILE_HSTGST *)(HGSMIBufferDataFromPtr(pvBuffer) + u32DataSize); 140 141 } 141 142 … … 145 146 } 146 147 147 DECLINLINE(HGSMIBUFFERHEADER *) HGSMIBufferHeaderFromData(const void*pvData)148 { 149 return (HGSMIBUFFERHEADER *)((uint8_t *)pvData - sizeof(HGSMIBUFFERHEADER));148 DECLINLINE(HGSMIBUFFERHEADER RT_UNTRUSTED_VOLATILE_HSTGST *) HGSMIBufferHeaderFromData(const void RT_UNTRUSTED_VOLATILE_HSTGST *pvData) 149 { 150 return (HGSMIBUFFERHEADER RT_UNTRUSTED_VOLATILE_HSTGST *)((uint8_t *)pvData - sizeof(HGSMIBUFFERHEADER)); 150 151 } 151 152 … … 155 156 } 156 157 157 DECLINLINE(HGSMIOFFSET) HGSMIPointerToOffset(const HGSMIAREA *pArea, 158 const void *pv) 158 DECLINLINE(HGSMIOFFSET) HGSMIPointerToOffset(const HGSMIAREA *pArea, const void RT_UNTRUSTED_VOLATILE_HSTGST *pv) 159 159 { 160 160 return pArea->offBase + (HGSMIOFFSET)((uint8_t *)pv - pArea->pu8Base); 161 161 } 162 162 163 DECLINLINE(void *) HGSMIOffsetToPointer(const HGSMIAREA *pArea, 164 HGSMIOFFSET offBuffer) 163 DECLINLINE(void RT_UNTRUSTED_VOLATILE_HSTGST *) HGSMIOffsetToPointer(const HGSMIAREA *pArea, HGSMIOFFSET offBuffer) 165 164 { 166 165 return pArea->pu8Base + (offBuffer - pArea->offBase); 167 166 } 168 167 169 DECLINLINE(uint8_t *) HGSMIBufferDataFromOffset(const HGSMIAREA *pArea, 170 HGSMIOFFSET offBuffer) 171 { 172 void *pvBuffer = HGSMIOffsetToPointer(pArea, offBuffer); 168 DECLINLINE(uint8_t RT_UNTRUSTED_VOLATILE_HSTGST*) HGSMIBufferDataFromOffset(const HGSMIAREA *pArea, HGSMIOFFSET offBuffer) 169 { 170 void RT_UNTRUSTED_VOLATILE_HSTGST *pvBuffer = HGSMIOffsetToPointer(pArea, offBuffer); 173 171 return HGSMIBufferDataFromPtr(pvBuffer); 174 172 } 175 173 176 DECLINLINE(HGSMIOFFSET) HGSMIBufferOffsetFromData(const HGSMIAREA *pArea, 177 void *pvData) 178 { 179 HGSMIBUFFERHEADER *pHeader = HGSMIBufferHeaderFromData(pvData); 174 DECLINLINE(HGSMIOFFSET) HGSMIBufferOffsetFromData(const HGSMIAREA *pArea, void RT_UNTRUSTED_VOLATILE_HSTGST *pvData) 175 { 176 HGSMIBUFFERHEADER RT_UNTRUSTED_VOLATILE_HSTGST *pHeader = HGSMIBufferHeaderFromData(pvData); 180 177 return HGSMIPointerToOffset(pArea, pHeader); 181 178 } 182 179 183 DECLINLINE(uint8_t *) HGSMIBufferDataAndChInfoFromOffset(const HGSMIAREA *pArea, 184 HGSMIOFFSET offBuffer, 185 uint16_t *pu16ChannelInfo) 186 { 187 HGSMIBUFFERHEADER *pHeader = (HGSMIBUFFERHEADER *)HGSMIOffsetToPointer(pArea, offBuffer); 180 DECLINLINE(uint8_t RT_UNTRUSTED_VOLATILE_HSTGST *) HGSMIBufferDataAndChInfoFromOffset(const HGSMIAREA *pArea, 181 HGSMIOFFSET offBuffer, 182 uint16_t *pu16ChannelInfo) 183 { 184 HGSMIBUFFERHEADER RT_UNTRUSTED_VOLATILE_HSTGST *pHeader = 185 (HGSMIBUFFERHEADER RT_UNTRUSTED_VOLATILE_HSTGST *)HGSMIOffsetToPointer(pArea, offBuffer); 188 186 *pu16ChannelInfo = pHeader->u16ChannelInfo; 189 187 return HGSMIBufferDataFromPtr(pHeader); 190 188 } 191 189 192 uint32_t HGSMIChecksum(HGSMIOFFSET offBuffer, 193 const HGSMIBUFFERHEADER *pHeader, 194 const HGSMIBUFFERTAIL *pTail); 195 196 int HGSMIAreaInitialize(HGSMIAREA *pArea, 197 void *pvBase, 198 HGSMISIZE cbArea, 199 HGSMIOFFSET offBase); 200 190 uint32_t HGSMIChecksum(HGSMIOFFSET offBuffer, const HGSMIBUFFERHEADER RT_UNTRUSTED_VOLATILE_HSTGST *pHeader, 191 const HGSMIBUFFERTAIL RT_UNTRUSTED_VOLATILE_HSTGST *pTail); 192 193 int HGSMIAreaInitialize(HGSMIAREA *pArea, void *pvBase, HGSMISIZE cbArea, HGSMIOFFSET offBase); 201 194 void HGSMIAreaClear(HGSMIAREA *pArea); 202 195 … … 206 199 } 207 200 208 DECLINLINE(bool) HGSMIAreaContainsPointer(const HGSMIAREA *pArea, const void *pv) 209 { 210 return (uintptr_t)pv >= (uintptr_t)pArea->pu8Base && (uintptr_t)pv - (uintptr_t)pArea->pu8Base < pArea->cbArea; 211 } 212 213 HGSMIOFFSET HGSMIBufferInitializeSingle(const HGSMIAREA *pArea, 214 HGSMIBUFFERHEADER *pHeader, 215 HGSMISIZE cbBuffer, 216 uint8_t u8Channel, 217 uint16_t u16ChannelInfo); 218 219 int HGSMIHeapSetup(HGSMIHEAP *pHeap, 220 void *pvBase, 221 HGSMISIZE cbArea, 222 HGSMIOFFSET offBase, 223 const HGSMIENV *pEnv); 224 201 DECLINLINE(bool) HGSMIAreaContainsPointer(const HGSMIAREA *pArea, const void RT_UNTRUSTED_VOLATILE_HSTGST *pv) 202 { 203 return (uintptr_t)pv - (uintptr_t)pArea->pu8Base < pArea->cbArea; 204 } 205 206 HGSMIOFFSET HGSMIBufferInitializeSingle(const HGSMIAREA *pArea, HGSMIBUFFERHEADER *pHeader, HGSMISIZE cbBuffer, 207 uint8_t u8Channel, uint16_t u16ChannelInfo); 208 209 int HGSMIHeapSetup(HGSMIHEAP *pHeap, void *pvBase, HGSMISIZE cbArea, HGSMIOFFSET offBase, const HGSMIENV *pEnv); 225 210 void HGSMIHeapDestroy(HGSMIHEAP *pHeap); 226 227 void *HGSMIHeapBufferAlloc(HGSMIHEAP *pHeap, 228 HGSMISIZE cbBuffer); 229 230 void HGSMIHeapBufferFree(HGSMIHEAP *pHeap, 231 void *pvBuf); 232 233 void *HGSMIHeapAlloc(HGSMIHEAP *pHeap, 234 HGSMISIZE cbData, 235 uint8_t u8Channel, 236 uint16_t u16ChannelInfo); 237 238 void HGSMIHeapFree(HGSMIHEAP *pHeap, 239 void *pvData); 211 void RT_UNTRUSTED_VOLATILE_HSTGST *HGSMIHeapBufferAlloc(HGSMIHEAP *pHeap, HGSMISIZE cbBuffer); 212 void HGSMIHeapBufferFree(HGSMIHEAP *pHeap, void RT_UNTRUSTED_VOLATILE_HSTGST *pvBuf); 213 214 void RT_UNTRUSTED_VOLATILE_HOST *HGSMIHeapAlloc(HGSMIHEAP *pHeap, 215 HGSMISIZE cbData, 216 uint8_t u8Channel, 217 uint16_t u16ChannelInfo); 218 219 void HGSMIHeapFree(HGSMIHEAP *pHeap, void RT_UNTRUSTED_VOLATILE_HSTGST *pvData); 240 220 241 221 DECLINLINE(const HGSMIAREA *) HGSMIHeapArea(HGSMIHEAP *pHeap) … … 254 234 } 255 235 256 DECLINLINE(HGSMIOFFSET) HGSMIHeapBufferOffset(HGSMIHEAP *pHeap, 257 void *pvData) 236 DECLINLINE(HGSMIOFFSET) HGSMIHeapBufferOffset(HGSMIHEAP *pHeap, void RT_UNTRUSTED_VOLATILE_HOST *pvData) 258 237 { 259 238 return HGSMIBufferOffsetFromData(HGSMIHeapArea(pHeap), pvData); 260 239 } 261 240 262 HGSMICHANNEL *HGSMIChannelFindById(HGSMICHANNELINFO *pChannelInfo, 263 uint8_t u8Channel); 264 265 int HGSMIChannelRegister(HGSMICHANNELINFO *pChannelInfo, 266 uint8_t u8Channel, 267 const char *pszName, 268 PFNHGSMICHANNELHANDLER pfnChannelHandler, 269 void *pvChannelHandler); 270 271 int HGSMIBufferProcess(const HGSMIAREA *pArea, 272 HGSMICHANNELINFO *pChannelInfo, 273 HGSMIOFFSET offBuffer); 241 HGSMICHANNEL *HGSMIChannelFindById(HGSMICHANNELINFO *pChannelInfo, uint8_t u8Channel); 242 243 int HGSMIChannelRegister(HGSMICHANNELINFO *pChannelInfo, uint8_t u8Channel, const char *pszName, 244 PFNHGSMICHANNELHANDLER pfnChannelHandler, void *pvChannelHandler); 245 int HGSMIBufferProcess(const HGSMIAREA *pArea, HGSMICHANNELINFO *pChannelInfo, HGSMIOFFSET offBuffer); 274 246 RT_C_DECLS_END 275 247 -
trunk/include/VBox/Graphics/HGSMIBase.h
r69307 r71590 48 48 } 49 49 50 DECLHIDDEN(void *) VBoxHGSMIBufferAlloc(PHGSMIGUESTCOMMANDCONTEXT pCtx, 51 HGSMISIZE cbData, 52 uint8_t u8Ch, 53 uint16_t u16Op); 54 DECLHIDDEN(void) VBoxHGSMIBufferFree(PHGSMIGUESTCOMMANDCONTEXT pCtx, 55 void *pvBuffer); 56 DECLHIDDEN(int) VBoxHGSMIBufferSubmit(PHGSMIGUESTCOMMANDCONTEXT pCtx, 57 void *pvBuffer); 50 DECLHIDDEN(void RT_UNTRUSTED_VOLATILE_HOST *) VBoxHGSMIBufferAlloc(PHGSMIGUESTCOMMANDCONTEXT pCtx, HGSMISIZE cbData, 51 uint8_t u8Ch, uint16_t u16Op); 52 DECLHIDDEN(void) VBoxHGSMIBufferFree(PHGSMIGUESTCOMMANDCONTEXT pCtx, void RT_UNTRUSTED_VOLATILE_HOST *pvBuffer); 53 DECLHIDDEN(int) VBoxHGSMIBufferSubmit(PHGSMIGUESTCOMMANDCONTEXT pCtx, void RT_UNTRUSTED_VOLATILE_HOST *pvBuffer); 58 54 /** @} */ 59 55 -
trunk/include/VBox/Graphics/HGSMIHostCmd.h
r69015 r71590 38 38 * @{ */ 39 39 40 DECLHIDDEN(void) VBoxHGSMIHostCmdComplete(PHGSMIHOSTCOMMANDCONTEXT pCtx, 41 void *pvMem); 40 DECLHIDDEN(void) VBoxHGSMIHostCmdComplete(PHGSMIHOSTCOMMANDCONTEXT pCtx, void RT_UNTRUSTED_VOLATILE_HOST *pvMem); 42 41 DECLHIDDEN(void) VBoxHGSMIProcessHostQueue(PHGSMIHOSTCOMMANDCONTEXT pCtx); 43 42 -
trunk/include/VBox/Graphics/HGSMIMemAlloc.h
r69107 r71590 76 76 void HGSMIMAUninit(HGSMIMADATA *pMA); 77 77 78 void *HGSMIMAAlloc(HGSMIMADATA *pMA, HGSMISIZE cb);79 void HGSMIMAFree(HGSMIMADATA *pMA, void *pv);78 void RT_UNTRUSTED_VOLATILE_HSTGST *HGSMIMAAlloc(HGSMIMADATA *pMA, HGSMISIZE cb); 79 void HGSMIMAFree(HGSMIMADATA *pMA, void RT_UNTRUSTED_VOLATILE_GUEST *pv); 80 80 81 81 HGSMIMABLOCK *HGSMIMASearchOffset(HGSMIMADATA *pMA, HGSMIOFFSET off); -
trunk/include/VBox/Graphics/VBoxVideo.h
r70075 r71590 1358 1358 1359 1359 1360 DECLINLINE(uint8_t *) VBoxSHGSMIBufferData (const VBOXSHGSMIHEADER* pHeader) 1361 { 1362 return (uint8_t *)pHeader + sizeof (VBOXSHGSMIHEADER); 1360 DECLINLINE(uint8_t RT_UNTRUSTED_VOLATILE_GUEST *) 1361 VBoxSHGSMIBufferData(const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_GUEST *pHeader) 1362 { 1363 return (uint8_t RT_UNTRUSTED_VOLATILE_GUEST *)pHeader + sizeof(VBOXSHGSMIHEADER); 1363 1364 } 1364 1365 1365 #define VBoxSHGSMIBufferHeaderSize() (sizeof 1366 1367 DECLINLINE( PVBOXSHGSMIHEADER) VBoxSHGSMIBufferHeader (const void*pvData)1368 { 1369 return ( PVBOXSHGSMIHEADER)((uint8_t *)pvData - sizeof(VBOXSHGSMIHEADER));1366 #define VBoxSHGSMIBufferHeaderSize() (sizeof(VBOXSHGSMIHEADER)) 1367 1368 DECLINLINE(VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_GUEST *) VBoxSHGSMIBufferHeader(const void RT_UNTRUSTED_VOLATILE_GUEST *pvData) 1369 { 1370 return (VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_GUEST *)((uintptr_t)pvData - sizeof(VBOXSHGSMIHEADER)); 1370 1371 } 1371 1372 … … 1391 1392 uint32_t u32Offset; 1392 1393 int32_t i32Result; 1393 } VBOXVDMA_CTL , *PVBOXVDMA_CTL;1394 } VBOXVDMA_CTL; 1394 1395 1395 1396 typedef struct VBOXVDMA_RECTL -
trunk/include/VBox/vmm/pdmifs.h
r70596 r71590 715 715 716 716 /** Pointer to a 2D graphics acceleration command. */ 717 typedef struct VBOXVHWACMD *PVBOXVHWACMD;717 typedef struct VBOXVHWACMD VBOXVHWACMD; 718 718 /** Pointer to a VBVA command header. */ 719 719 typedef struct VBVACMDHDR *PVBVACMDHDR; … … 842 842 * 843 843 * @param pInterface Pointer to this interface. 844 * @param enmCmd The command type (don't re-read from pCmd). 844 845 * @param pCmd Video HW Acceleration Command to be processed. 845 846 * @returns VINF_SUCCESS - command is completed, … … 848 849 * @thread The emulation thread. 849 850 */ 850 DECLR3CALLBACKMEMBER(int, pfnVHWACommandProcess,(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVHWACMD pCmd)); 851 DECLR3CALLBACKMEMBER(int, pfnVHWACommandProcess,(PPDMIDISPLAYCONNECTOR pInterface, int enmCmd, 852 VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCmd)); 851 853 852 854 /** … … 2269 2271 * completed. 2270 2272 */ 2271 DECLR3CALLBACKMEMBER(int, pfnVHWACommandCompleteAsync,(PPDMIDISPLAYVBVACALLBACKS pInterface, PVBOXVHWACMD pCmd)); 2273 DECLR3CALLBACKMEMBER(int, pfnVHWACommandCompleteAsync,(PPDMIDISPLAYVBVACALLBACKS pInterface, 2274 VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCmd)); 2272 2275 2273 2276 DECLR3CALLBACKMEMBER(int, pfnCrHgsmiCommandCompleteAsync,(PPDMIDISPLAYVBVACALLBACKS pInterface, -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPCr.cpp
r69500 r71590 15 15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. 16 16 */ 17 17 18 #ifdef VBOX_WITH_CROGL 18 19 … … 37 38 } 38 39 39 static void *vboxMpCrShgsmiBufferAlloc(PVBOXMP_DEVEXT pDevExt, HGSMISIZE cbData)40 static void RT_UNTRUSTED_VOLATILE_HOST *vboxMpCrShgsmiBufferAlloc(PVBOXMP_DEVEXT pDevExt, HGSMISIZE cbData) 40 41 { 41 42 return VBoxSHGSMIHeapBufferAlloc(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx.heapCtx, cbData); 42 43 } 43 44 44 static VBOXVIDEOOFFSET vboxMpCrShgsmiBufferOffset(PVBOXMP_DEVEXT pDevExt, void *pvBuffer) 45 { 46 return (VBOXVIDEOOFFSET)HGSMIPointerToOffset(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx.heapCtx.Heap.area, 47 (const HGSMIBUFFERHEADER *)pvBuffer); 48 } 49 50 static void* vboxMpCrShgsmiBufferFromOffset(PVBOXMP_DEVEXT pDevExt, VBOXVIDEOOFFSET offBuffer) 45 static VBOXVIDEOOFFSET vboxMpCrShgsmiBufferOffset(PVBOXMP_DEVEXT pDevExt, void RT_UNTRUSTED_VOLATILE_HOST *pvBuffer) 46 { 47 return (VBOXVIDEOOFFSET)HGSMIPointerToOffset(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx.heapCtx.Heap.area, pvBuffer); 48 } 49 50 static void RT_UNTRUSTED_VOLATILE_HOST *vboxMpCrShgsmiBufferFromOffset(PVBOXMP_DEVEXT pDevExt, VBOXVIDEOOFFSET offBuffer) 51 51 { 52 52 return HGSMIOffsetToPointer(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx.heapCtx.Heap.area, (HGSMIOFFSET)offBuffer); 53 53 } 54 54 55 static void vboxMpCrShgsmiBufferFree(PVBOXMP_DEVEXT pDevExt, void *pvBuffer)55 static void vboxMpCrShgsmiBufferFree(PVBOXMP_DEVEXT pDevExt, void RT_UNTRUSTED_VOLATILE_HOST *pvBuffer) 56 56 { 57 57 VBoxSHGSMIHeapBufferFree(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx.heapCtx, pvBuffer); 58 58 } 59 59 60 static VBOXVIDEOOFFSET vboxMpCrShgsmiTransportBufOffset(PVBOXMP_CRSHGSMITRANSPORT pCon, void *pvBuffer)60 static VBOXVIDEOOFFSET vboxMpCrShgsmiTransportBufOffset(PVBOXMP_CRSHGSMITRANSPORT pCon, void RT_UNTRUSTED_VOLATILE_HOST *pvBuffer) 61 61 { 62 62 return vboxMpCrShgsmiBufferOffset(pCon->pDevExt, pvBuffer); 63 63 } 64 64 65 static void *vboxMpCrShgsmiTransportBufFromOffset(PVBOXMP_CRSHGSMITRANSPORT pCon, VBOXVIDEOOFFSET offBuffer)65 static void RT_UNTRUSTED_VOLATILE_HOST *vboxMpCrShgsmiTransportBufFromOffset(PVBOXMP_CRSHGSMITRANSPORT pCon, VBOXVIDEOOFFSET offBuffer) 66 66 { 67 67 return vboxMpCrShgsmiBufferFromOffset(pCon->pDevExt, offBuffer); 68 68 } 69 69 70 void *VBoxMpCrShgsmiTransportBufAlloc(PVBOXMP_CRSHGSMITRANSPORT pCon, uint32_t cbBuffer)70 void RT_UNTRUSTED_VOLATILE_HOST *VBoxMpCrShgsmiTransportBufAlloc(PVBOXMP_CRSHGSMITRANSPORT pCon, uint32_t cbBuffer) 71 71 { 72 72 return vboxMpCrShgsmiBufferAlloc(pCon->pDevExt, cbBuffer); 73 73 } 74 74 75 void VBoxMpCrShgsmiTransportBufFree(PVBOXMP_CRSHGSMITRANSPORT pCon, void *pvBuffer)75 void VBoxMpCrShgsmiTransportBufFree(PVBOXMP_CRSHGSMITRANSPORT pCon, void RT_UNTRUSTED_VOLATILE_HOST *pvBuffer) 76 76 { 77 77 vboxMpCrShgsmiBufferFree(pCon->pDevExt, pvBuffer); … … 297 297 298 298 typedef DECLCALLBACK(void) FNVBOXMP_CRSHGSMITRANSPORT_SENDREADASYNC_COMPLETION(PVBOXMP_CRSHGSMITRANSPORT pCon, int rc, 299 void *pvRx, uint32_t cbRx, void *pvCtx); 299 void RT_UNTRUSTED_VOLATILE_HOST *pvRx, 300 uint32_t cbRx, void *pvCtx); 300 301 typedef FNVBOXMP_CRSHGSMITRANSPORT_SENDREADASYNC_COMPLETION *PFNVBOXMP_CRSHGSMITRANSPORT_SENDREADASYNC_COMPLETION; 301 302 … … 321 322 VBOXVDMACMD_CHROMIUM_BUFFER *pRxBuf = &pBody->aBuffers[1]; 322 323 PVBOXMP_CRSHGSMICON_BUFDR pWbDr = (PVBOXMP_CRSHGSMICON_BUFDR)pRxBuf->u64GuestData; 323 void *pvRx = NULL;324 void RT_UNTRUSTED_VOLATILE_HOST *pvRx = NULL; 324 325 uint32_t cbRx = 0; 325 326 … … 418 419 } VBOXMP_CRHGSMICON_WRR_COMPLETION_CTX, *PVBOXMP_CRHGSMICON_WRR_COMPLETION_CTX; 419 420 421 /** @callback_method_impl{FNVBOXMP_CRSHGSMITRANSPORT_SENDREADASYNC_COMPLETION} */ 420 422 static DECLCALLBACK(void) vboxMpCrShgsmiTransportSendWriteReadReadRepostCompletion(PVBOXMP_CRSHGSMITRANSPORT pCon, int rc, 421 void *pvRx, uint32_t cbRx, void *pvCtx) 423 void RT_UNTRUSTED_VOLATILE_HOST *pvRx, 424 uint32_t cbRx, void *pvCtx) 422 425 { 423 426 PVBOXMP_CRHGSMICON_WRR_COMPLETION_CTX pData = (PVBOXMP_CRHGSMICON_WRR_COMPLETION_CTX)pvCtx; … … 448 451 PVBOXMP_CRSHGSMICON_BUFDR pWbDr = (PVBOXMP_CRSHGSMICON_BUFDR)pRxBuf->u64GuestData; 449 452 PFNVBOXMP_CRSHGSMITRANSPORT_SENDWRITEREADASYNC_COMPLETION pfnCompletion = (PFNVBOXMP_CRSHGSMITRANSPORT_SENDWRITEREADASYNC_COMPLETION)pBufCmd->u64GuestData; 450 void *pvRx = NULL;453 void RT_UNTRUSTED_VOLATILE_HOST *pvRx = NULL; 451 454 uint32_t cbRx = 0; 452 455 … … 552 555 } 553 556 554 static DECLCALLBACK(VOID) vboxMpCrShgsmiTransportVbvaSendWriteAsyncCompletion(PVBOXSHGSMI pHeap, void *pvCmd, void *pvContext) 557 /** @callback_method_impl{FNVBOXSHGSMICMDCOMPLETION} */ 558 static DECLCALLBACK(VOID) 559 vboxMpCrShgsmiTransportVbvaSendWriteAsyncCompletion(PVBOXSHGSMI pHeap, void RT_UNTRUSTED_VOLATILE_HOST *pvCmd, void *pvContext) 555 560 { 556 561 RT_NOREF(pHeap); … … 559 564 560 565 PVBOXMP_CRSHGSMITRANSPORT pCon = (PVBOXMP_CRSHGSMITRANSPORT)pvContext; 561 VBOXCMDVBVA_CRCMD_CMD *pCmd;566 VBOXCMDVBVA_CRCMD_CMD RT_UNTRUSTED_VOLATILE_HOST *pCmd = NULL; 562 567 int rc = VBoxCmdVbvaConCmdCompletionData(pvCmd, &pCmd); 563 568 const UINT cBuffers = 2; … … 581 586 const uint32_t cbCmd = VBOXMP_CRSHGSMICON_DR_SIZE(cBuffers, sizeof (VBOXMP_CRHGSMICMD_WRITEREAD), cbContextData); 582 587 PVBOXMP_DEVEXT pDevExt = pCon->pDevExt; 583 PVBOXVDMACBUF_DRpDr = vboxVdmaCBufDrCreate(&pDevExt->u.primary.Vdma, cbCmd);588 VBOXVDMACBUF_DR RT_UNTRUSTED_VOLATILE_HOST *pDr = vboxVdmaCBufDrCreate(&pDevExt->u.primary.Vdma, cbCmd); 584 589 if (!pDr) 585 590 { … … 686 691 const uint32_t cBuffers = 2; 687 692 const uint32_t cbCmd = VBOXMP_CRSHGSMICON_DR_SIZE(cBuffers, sizeof (VBOXMP_CRHGSMICMD_WRITE), cbContextData); 688 PVBOXVDMACBUF_DRpDr = vboxVdmaCBufDrCreate(&pDevExt->u.primary.Vdma, cbCmd);693 VBOXVDMACBUF_DR RT_UNTRUSTED_VOLATILE_HOST *pDr = vboxVdmaCBufDrCreate(&pDevExt->u.primary.Vdma, cbCmd); 689 694 if (!pDr) 690 695 { … … 1103 1108 } 1104 1109 1105 int VBoxMpCrCmdRxReadbackHandler(CRMessageReadback *pRx, uint32_t cbRx)1106 { 1107 if (cbRx < sizeof 1110 int VBoxMpCrCmdRxReadbackHandler(CRMessageReadback RT_UNTRUSTED_VOLATILE_HOST *pRx, uint32_t cbRx) 1111 { 1112 if (cbRx < sizeof(*pRx)) 1108 1113 { 1109 1114 WARN(("invalid rx size %d", cbRx)); 1110 1115 return VERR_INVALID_PARAMETER; 1111 1116 } 1112 void * pvData= VBoxMpCrCmdRxReadbackData(pRx);1117 void *pvSrc = VBoxMpCrCmdRxReadbackData(pRx); 1113 1118 uint32_t cbData = VBoxMpCrCmdRxReadbackDataSize(pRx, cbRx); 1114 void *pvDataPtr= *((void**)&pRx->readback_ptr);1115 memcpy(pvD ataPtr, pvData, cbData);1119 void *pvDst = *((void**)&pRx->readback_ptr); 1120 memcpy(pvDst, pvSrc, cbData); 1116 1121 return VINF_SUCCESS; 1117 1122 } 1118 1123 1119 int VBoxMpCrCmdRxHandler(CRMessageHeader *pRx, uint32_t cbRx)1120 { 1121 if (cbRx < sizeof 1124 int VBoxMpCrCmdRxHandler(CRMessageHeader RT_UNTRUSTED_VOLATILE_HOST *pRx, uint32_t cbRx) 1125 { 1126 if (cbRx < sizeof(*pRx)) 1122 1127 { 1123 1128 WARN(("invalid rx size %d", cbRx)); 1124 1129 return VERR_INVALID_PARAMETER; 1125 1130 } 1126 CRMessage Header *pHdr = (CRMessageHeader*)pRx;1127 switch ( pHdr->type)1131 CRMessageType enmType = pRx->type; 1132 switch (enmType) 1128 1133 { 1129 1134 case CR_MESSAGE_READBACK: 1130 return VBoxMpCrCmdRxReadbackHandler((CRMessageReadback *)pRx, cbRx);1135 return VBoxMpCrCmdRxReadbackHandler((CRMessageReadback RT_UNTRUSTED_VOLATILE_HOST *)pRx, cbRx); 1131 1136 default: 1132 WARN(("unsupported rx message type: %d", pHdr->type));1137 WARN(("unsupported rx message type: %d", enmType)); 1133 1138 return VERR_INVALID_PARAMETER; 1134 1139 } -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPCr.h
r69500 r71590 45 45 { 46 46 uint32_t cbBuf; 47 void *pvBuf;47 void RT_UNTRUSTED_VOLATILE_HOST *pvBuf; 48 48 } VBOXMP_CRSHGSMICON_BUFDR, *PVBOXMP_CRSHGSMICON_BUFDR; 49 49 … … 62 62 * the callee must NOT free it or use outside of the callback context. 63 63 * */ 64 typedef DECLCALLBACK(void) FNVBOXMP_CRSHGSMITRANSPORT_SENDWRITEREADASYNC_COMPLETION(PVBOXMP_CRSHGSMITRANSPORT pCon, int rc, void *pvRx, uint32_t cbRx, void *pvCtx); 64 typedef DECLCALLBACK(void) FNVBOXMP_CRSHGSMITRANSPORT_SENDWRITEREADASYNC_COMPLETION(PVBOXMP_CRSHGSMITRANSPORT pCon, int rc, 65 void RT_UNTRUSTED_VOLATILE_HOST *pvRx, 66 uint32_t cbRx, void *pvCtx); 65 67 typedef FNVBOXMP_CRSHGSMITRANSPORT_SENDWRITEREADASYNC_COMPLETION *PFNVBOXMP_CRSHGSMITRANSPORT_SENDWRITEREADASYNC_COMPLETION; 66 68 … … 79 81 void VBoxMpCrShgsmiTransportCmdTermWriteAsync(PVBOXMP_CRSHGSMITRANSPORT pCon, void *pvContext); 80 82 81 void *VBoxMpCrShgsmiTransportBufAlloc(PVBOXMP_CRSHGSMITRANSPORT pCon, uint32_t cbBuffer);82 void VBoxMpCrShgsmiTransportBufFree(PVBOXMP_CRSHGSMITRANSPORT pCon, void *pvBuffer);83 void RT_UNTRUSTED_VOLATILE_HOST *VBoxMpCrShgsmiTransportBufAlloc(PVBOXMP_CRSHGSMITRANSPORT pCon, uint32_t cbBuffer); 84 void VBoxMpCrShgsmiTransportBufFree(PVBOXMP_CRSHGSMITRANSPORT pCon, void RT_UNTRUSTED_VOLATILE_HOST *pvBuffer); 83 85 84 86 typedef struct VBOXMP_CRPACKER … … 98 100 } 99 101 100 DECLINLINE(void) VBoxMpCrPackerTxBufferInit(PVBOXMP_CRPACKER pPacker, void *pvBuffer, uint32_t cbBuffer, uint32_t cCommands) 101 { 102 crPackInitBuffer(&pPacker->CrBuffer, pvBuffer, cbBuffer, cbBuffer, cCommands); 102 DECLINLINE(void) VBoxMpCrPackerTxBufferInit(PVBOXMP_CRPACKER pPacker, void RT_UNTRUSTED_VOLATILE_HOST *pvBuffer, 103 uint32_t cbBuffer, uint32_t cCommands) 104 { 105 crPackInitBuffer(&pPacker->CrBuffer, (void *)pvBuffer, cbBuffer, cbBuffer, cCommands); 103 106 crPackSetBuffer(&pPacker->CrPacker, &pPacker->CrBuffer); 104 107 } … … 190 193 } 191 194 192 DECLINLINE(void *) VBoxMpCrCmdRxReadbackData(CRMessageReadback*pRx)193 { 194 return pRx + 1;195 } 196 197 DECLINLINE(uint32_t) VBoxMpCrCmdRxReadbackDataSize(CRMessageReadback *pRx, uint32_t cbRx)195 DECLINLINE(void *) VBoxMpCrCmdRxReadbackData(CRMessageReadback RT_UNTRUSTED_VOLATILE_HOST *pRx) 196 { 197 return (void *)(pRx + 1); 198 } 199 200 DECLINLINE(uint32_t) VBoxMpCrCmdRxReadbackDataSize(CRMessageReadback RT_UNTRUSTED_VOLATILE_HOST *pRx, uint32_t cbRx) 198 201 { 199 202 RT_NOREF(pRx); 200 203 return cbRx - sizeof(*pRx); 201 204 } 202 int VBoxMpCrCmdRxReadbackHandler(CRMessageReadback *pRx, uint32_t cbRx);203 int VBoxMpCrCmdRxHandler(CRMessageHeader *pRx, uint32_t cbRx);205 int VBoxMpCrCmdRxReadbackHandler(CRMessageReadback RT_UNTRUSTED_VOLATILE_HOST *pRx, uint32_t cbRx); 206 int VBoxMpCrCmdRxHandler(CRMessageHeader RT_UNTRUSTED_VOLATILE_HOST *pRx, uint32_t cbRx); 204 207 205 208 /* must be called after calling VBoxMpCrCtlConIs3DSupported only */ -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPMisc.cpp
r71196 r71590 1392 1392 UINT cbCmd = VBOXVDMACMD_SIZE_FROMBODYSIZE(RT_OFFSETOF(VBOXVDMACMD_CHROMIUM_CMD, aBuffers[cBuffers])); 1393 1393 1394 PVBOXVDMACBUF_DRpDr = vboxVdmaCBufDrCreate(&pDevExt->u.primary.Vdma, cbCmd);1394 VBOXVDMACBUF_DR RT_UNTRUSTED_VOLATILE_HOST *pDr = vboxVdmaCBufDrCreate(&pDevExt->u.primary.Vdma, cbCmd); 1395 1395 if (pDr) 1396 1396 { … … 1438 1438 { 1439 1439 PVBOXVDMADDI_CMD pDdiCmd = VBOXVDMADDI_CMD_FROM_BUF_DR(pDr); 1440 vboxVdmaDdiCmdInit(pDdiCmd, 0, 0, vboxVideoAMgrAllocSubmitCompletion, pDr);1440 vboxVdmaDdiCmdInit(pDdiCmd, 0, 0, vboxVideoAMgrAllocSubmitCompletion, (void *)pDr); 1441 1441 /* mark command as submitted & invisible for the dx runtime since dx did not originate it */ 1442 1442 vboxVdmaDdiCmdSubmittedNotDx(pDdiCmd); … … 1808 1808 { 1809 1809 int rc = VINF_SUCCESS; 1810 PVBOXVDMA_CTL pCmd = (PVBOXVDMA_CTL)VBoxSHGSMICommandAlloc(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx.heapCtx, 1811 sizeof(VBOXVDMA_CTL), HGSMI_CH_VBVA, VBVA_VDMA_CTL); 1810 VBOXVDMA_CTL RT_UNTRUSTED_VOLATILE_GUEST *pCmd 1811 = (VBOXVDMA_CTL RT_UNTRUSTED_VOLATILE_GUEST *)VBoxSHGSMICommandAlloc(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx.heapCtx, 1812 sizeof(VBOXVDMA_CTL), HGSMI_CH_VBVA, VBVA_VDMA_CTL); 1812 1813 if (pCmd) 1813 1814 { … … 1845 1846 } 1846 1847 1847 VBoxSHGSMICommandFree 1848 VBoxSHGSMICommandFree(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx.heapCtx, pCmd); 1848 1849 } 1849 1850 else -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPShgsmi.cpp
r69500 r71590 20 20 21 21 /* SHGSMI */ 22 DECLINLINE(void) vboxSHGSMICommandRetain( PVBOXSHGSMIHEADERpCmd)22 DECLINLINE(void) vboxSHGSMICommandRetain(VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *pCmd) 23 23 { 24 24 ASMAtomicIncU32(&pCmd->cRefs); 25 25 } 26 26 27 void vboxSHGSMICommandFree(PVBOXSHGSMI pHeap, PVBOXSHGSMIHEADERpCmd)27 void vboxSHGSMICommandFree(PVBOXSHGSMI pHeap, VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *pCmd) 28 28 { 29 29 VBoxSHGSMIHeapFree(pHeap, pCmd); 30 30 } 31 31 32 DECLINLINE(void) vboxSHGSMICommandRelease(PVBOXSHGSMI pHeap, PVBOXSHGSMIHEADERpCmd)32 DECLINLINE(void) vboxSHGSMICommandRelease(PVBOXSHGSMI pHeap, VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *pCmd) 33 33 { 34 34 uint32_t cRefs = ASMAtomicDecU32(&pCmd->cRefs); 35 35 Assert(cRefs < UINT32_MAX / 2); 36 36 if(!cRefs) 37 vboxSHGSMICommandFree 38 } 39 40 static DECLCALLBACK(void) vboxSHGSMICompletionSetEvent(PVBOXSHGSMI pHeap, void *pvCmd, void *pvContext)37 vboxSHGSMICommandFree(pHeap, pCmd); 38 } 39 40 static DECLCALLBACK(void) vboxSHGSMICompletionSetEvent(PVBOXSHGSMI pHeap, void RT_UNTRUSTED_VOLATILE_HOST *pvCmd, void *pvContext) 41 41 { 42 42 RT_NOREF(pHeap, pvCmd); … … 44 44 } 45 45 46 DECLCALLBACK(void) vboxSHGSMICompletionCommandRelease(PVBOXSHGSMI pHeap, void *pvCmd, void *pvContext)46 DECLCALLBACK(void) vboxSHGSMICompletionCommandRelease(PVBOXSHGSMI pHeap, void RT_UNTRUSTED_VOLATILE_HOST *pvCmd, void *pvContext) 47 47 { 48 48 RT_NOREF(pvContext); … … 51 51 52 52 /* do not wait for completion */ 53 DECLINLINE(const VBOXSHGSMIHEADER *) vboxSHGSMICommandPrepAsynch(PVBOXSHGSMI pHeap, PVBOXSHGSMIHEADER pHeader) 53 DECLINLINE(const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *) 54 vboxSHGSMICommandPrepAsynch(PVBOXSHGSMI pHeap, VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *pHeader) 54 55 { 55 56 RT_NOREF(pHeap); … … 59 60 } 60 61 61 DECLINLINE(void) vboxSHGSMICommandDoneAsynch(PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER *pHeader)62 DECLINLINE(void) vboxSHGSMICommandDoneAsynch(PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *pHeader) 62 63 { 63 64 if(!(ASMAtomicReadU32((volatile uint32_t *)&pHeader->fFlags) & VBOXSHGSMI_FLAG_HG_ASYNCH)) … … 71 72 } 72 73 73 const VBOXSHGSMIHEADER* VBoxSHGSMICommandPrepAsynchEvent(PVBOXSHGSMI pHeap, PVOID pvBuff, RTSEMEVENT hEventSem) 74 { 75 PVBOXSHGSMIHEADER pHeader = VBoxSHGSMIBufferHeader(pvBuff); 74 const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST * 75 VBoxSHGSMICommandPrepAsynchEvent(PVBOXSHGSMI pHeap, void RT_UNTRUSTED_VOLATILE_HOST *pvBuff, RTSEMEVENT hEventSem) 76 { 77 VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *pHeader = VBoxSHGSMIBufferHeader(pvBuff); 76 78 pHeader->u64Info1 = (uint64_t)vboxSHGSMICompletionSetEvent; 77 79 pHeader->u64Info2 = (uintptr_t)hEventSem; … … 81 83 } 82 84 83 const VBOXSHGSMIHEADER* VBoxSHGSMICommandPrepSynch(PVBOXSHGSMI pHeap, PVOID pCmd) 85 const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *VBoxSHGSMICommandPrepSynch(PVBOXSHGSMI pHeap, 86 void RT_UNTRUSTED_VOLATILE_HOST *pCmd) 84 87 { 85 88 RTSEMEVENT hEventSem; … … 93 96 } 94 97 95 void VBoxSHGSMICommandDoneAsynch(PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER *pHeader)98 void VBoxSHGSMICommandDoneAsynch(PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *pHeader) 96 99 { 97 100 vboxSHGSMICommandDoneAsynch(pHeap, pHeader); 98 101 } 99 102 100 int VBoxSHGSMICommandDoneSynch(PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER *pHeader)103 int VBoxSHGSMICommandDoneSynch(PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *pHeader) 101 104 { 102 105 VBoxSHGSMICommandDoneAsynch(pHeap, pHeader); … … 109 112 } 110 113 111 void VBoxSHGSMICommandCancelAsynch(PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER *pHeader)114 void VBoxSHGSMICommandCancelAsynch(PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *pHeader) 112 115 { 113 116 vboxSHGSMICommandRelease(pHeap, (PVBOXSHGSMIHEADER)pHeader); 114 117 } 115 118 116 void VBoxSHGSMICommandCancelSynch (PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER*pHeader)117 { 118 VBoxSHGSMICommandCancelAsynch 119 void VBoxSHGSMICommandCancelSynch(PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *pHeader) 120 { 121 VBoxSHGSMICommandCancelAsynch(pHeap, pHeader); 119 122 RTSEMEVENT hEventSem = (RTSEMEVENT)pHeader->u64Info2; 120 123 RTSemEventDestroy(hEventSem); 121 124 } 122 125 123 const VBOXSHGSMIHEADER* VBoxSHGSMICommandPrepAsynch(PVBOXSHGSMI pHeap, PVOID pvBuff, PFNVBOXSHGSMICMDCOMPLETION pfnCompletion, 124 PVOID pvCompletion, uint32_t fFlags) 126 const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST * 127 VBoxSHGSMICommandPrepAsynch(PVBOXSHGSMI pHeap, void RT_UNTRUSTED_VOLATILE_HOST *pvBuff, 128 PFNVBOXSHGSMICMDCOMPLETION pfnCompletion, PVOID pvCompletion, uint32_t fFlags) 125 129 { 126 130 fFlags &= ~VBOXSHGSMI_FLAG_GH_ASYNCH_CALLBACK_IRQ; 127 PVBOXSHGSMIHEADER pHeader = VBoxSHGSMIBufferHeader(pvBuff);131 VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *pHeader = VBoxSHGSMIBufferHeader(pvBuff); 128 132 pHeader->u64Info1 = (uintptr_t)pfnCompletion; 129 133 pHeader->u64Info2 = (uintptr_t)pvCompletion; 130 134 pHeader->fFlags = fFlags; 131 135 132 return vboxSHGSMICommandPrepAsynch 133 } 134 135 const VBOXSHGSMIHEADER * VBoxSHGSMICommandPrepAsynchIrq(PVBOXSHGSMI pHeap, PVOID pvBuff,136 PFNVBOXSHGSMICMDCOMPLETION_IRQ pfnCompletion, PVOID pvCompletion,137 136 return vboxSHGSMICommandPrepAsynch(pHeap, pHeader); 137 } 138 139 const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST * 140 VBoxSHGSMICommandPrepAsynchIrq(PVBOXSHGSMI pHeap, void RT_UNTRUSTED_VOLATILE_HOST *pvBuff, 141 PFNVBOXSHGSMICMDCOMPLETION_IRQ pfnCompletion, PVOID pvCompletion, uint32_t fFlags) 138 142 { 139 143 fFlags |= VBOXSHGSMI_FLAG_GH_ASYNCH_CALLBACK_IRQ | VBOXSHGSMI_FLAG_GH_ASYNCH_IRQ; 140 PVBOXSHGSMIHEADER pHeader = VBoxSHGSMIBufferHeader(pvBuff);144 VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *pHeader = VBoxSHGSMIBufferHeader(pvBuff); 141 145 pHeader->u64Info1 = (uintptr_t)pfnCompletion; 142 146 pHeader->u64Info2 = (uintptr_t)pvCompletion; … … 144 148 pHeader->fFlags = fFlags; 145 149 146 return vboxSHGSMICommandPrepAsynch 147 } 148 149 void *VBoxSHGSMIHeapAlloc(PVBOXSHGSMI pHeap, HGSMISIZE cbData, uint8_t u8Channel, uint16_t u16ChannelInfo)150 { 151 KIRQL OldIrql; 152 void *pvData;150 return vboxSHGSMICommandPrepAsynch(pHeap, pHeader); 151 } 152 153 void RT_UNTRUSTED_VOLATILE_HOST *VBoxSHGSMIHeapAlloc(PVBOXSHGSMI pHeap, HGSMISIZE cbData, uint8_t u8Channel, uint16_t u16ChannelInfo) 154 { 155 KIRQL OldIrql; 156 void RT_UNTRUSTED_VOLATILE_HOST *pvData; 153 157 Assert(KeGetCurrentIrql() <= DISPATCH_LEVEL); 154 158 KeAcquireSpinLock(&pHeap->HeapLock, &OldIrql); … … 160 164 } 161 165 162 void VBoxSHGSMIHeapFree(PVBOXSHGSMI pHeap, void *pvBuffer)166 void VBoxSHGSMIHeapFree(PVBOXSHGSMI pHeap, void RT_UNTRUSTED_VOLATILE_HOST *pvBuffer) 163 167 { 164 168 KIRQL OldIrql; … … 169 173 } 170 174 171 void *VBoxSHGSMIHeapBufferAlloc(PVBOXSHGSMI pHeap, HGSMISIZE cbData)172 { 173 KIRQL OldIrql; 174 void * pvData;175 void RT_UNTRUSTED_VOLATILE_HOST *VBoxSHGSMIHeapBufferAlloc(PVBOXSHGSMI pHeap, HGSMISIZE cbData) 176 { 177 KIRQL OldIrql; 178 void RT_UNTRUSTED_VOLATILE_HOST * pvData; 175 179 Assert(KeGetCurrentIrql() <= DISPATCH_LEVEL); 176 180 KeAcquireSpinLock(&pHeap->HeapLock, &OldIrql); … … 182 186 } 183 187 184 void VBoxSHGSMIHeapBufferFree(PVBOXSHGSMI pHeap, void *pvBuffer)188 void VBoxSHGSMIHeapBufferFree(PVBOXSHGSMI pHeap, void RT_UNTRUSTED_VOLATILE_HOST *pvBuffer) 185 189 { 186 190 KIRQL OldIrql; … … 203 207 } 204 208 205 void* VBoxSHGSMICommandAlloc(PVBOXSHGSMI pHeap, HGSMISIZE cbData, uint8_t u8Channel, uint16_t u16ChannelInfo) 209 void RT_UNTRUSTED_VOLATILE_HOST *VBoxSHGSMICommandAlloc(PVBOXSHGSMI pHeap, HGSMISIZE cbData, uint8_t u8Channel, 210 uint16_t u16ChannelInfo) 206 211 { 207 212 /* Issue the flush command. */ 208 PVBOXSHGSMIHEADER pHeader = (PVBOXSHGSMIHEADER)VBoxSHGSMIHeapAlloc(pHeap, cbData + sizeof (VBOXSHGSMIHEADER), u8Channel, 209 u16ChannelInfo); 213 VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *pHeader = 214 (VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *)VBoxSHGSMIHeapAlloc(pHeap, cbData + sizeof(VBOXSHGSMIHEADER), 215 u8Channel, u16ChannelInfo); 210 216 Assert(pHeader); 211 217 if (pHeader) … … 217 223 } 218 224 219 void VBoxSHGSMICommandFree(PVBOXSHGSMI pHeap, void *pvBuffer)220 { 221 PVBOXSHGSMIHEADERpHeader = VBoxSHGSMIBufferHeader(pvBuffer);222 vboxSHGSMICommandRelease 225 void VBoxSHGSMICommandFree(PVBOXSHGSMI pHeap, void RT_UNTRUSTED_VOLATILE_HOST *pvBuffer) 226 { 227 VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *pHeader = VBoxSHGSMIBufferHeader(pvBuffer); 228 vboxSHGSMICommandRelease(pHeap, pHeader); 223 229 } 224 230 … … 226 232 #define VBOXSHGSMI_LISTENTRY2CMD(_pEntry) ( (PVBOXSHGSMIHEADER)((uint8_t *)(_pEntry) - RT_OFFSETOF(VBOXSHGSMIHEADER, pvNext)) ) 227 233 228 int VBoxSHGSMICommandProcessCompletion (PVBOXSHGSMI pHeap, VBOXSHGSMIHEADER*pCur, bool bIrq, PVBOXVTLIST pPostProcessList)234 int VBoxSHGSMICommandProcessCompletion(PVBOXSHGSMI pHeap, VBOXSHGSMIHEADER *pCur, bool bIrq, PVBOXVTLIST pPostProcessList) 229 235 { 230 236 int rc = VINF_SUCCESS; -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPShgsmi.h
r69500 r71590 30 30 } VBOXSHGSMI, *PVBOXSHGSMI; 31 31 32 typedef DECLCALLBACK(void) FNVBOXSHGSMICMDCOMPLETION(PVBOXSHGSMI pHeap, void *pvCmd, void *pvContext);32 typedef DECLCALLBACK(void) FNVBOXSHGSMICMDCOMPLETION(PVBOXSHGSMI pHeap, void RT_UNTRUSTED_VOLATILE_HOST *pvCmd, void *pvContext); 33 33 typedef FNVBOXSHGSMICMDCOMPLETION *PFNVBOXSHGSMICMDCOMPLETION; 34 34 35 typedef DECLCALLBACK(PFNVBOXSHGSMICMDCOMPLETION) FNVBOXSHGSMICMDCOMPLETION_IRQ(PVBOXSHGSMI pHeap, void *pvCmd, void *pvContext, void **ppvCompletion); 35 typedef DECLCALLBACK(PFNVBOXSHGSMICMDCOMPLETION) FNVBOXSHGSMICMDCOMPLETION_IRQ(PVBOXSHGSMI pHeap, 36 void RT_UNTRUSTED_VOLATILE_HOST *pvCmd, 37 void *pvContext, void **ppvCompletion); 36 38 typedef FNVBOXSHGSMICMDCOMPLETION_IRQ *PFNVBOXSHGSMICMDCOMPLETION_IRQ; 37 39 38 40 39 const VBOXSHGSMIHEADER* VBoxSHGSMICommandPrepAsynchEvent(PVBOXSHGSMI pHeap, PVOID pvBuff, RTSEMEVENT hEventSem); 40 const VBOXSHGSMIHEADER* VBoxSHGSMICommandPrepSynch(PVBOXSHGSMI pHeap, PVOID pCmd); 41 const VBOXSHGSMIHEADER* VBoxSHGSMICommandPrepAsynch(PVBOXSHGSMI pHeap, PVOID pvBuff, PFNVBOXSHGSMICMDCOMPLETION pfnCompletion, PVOID pvCompletion, uint32_t fFlags); 42 const VBOXSHGSMIHEADER* VBoxSHGSMICommandPrepAsynchIrq(PVBOXSHGSMI pHeap, PVOID pvBuff, PFNVBOXSHGSMICMDCOMPLETION_IRQ pfnCompletion, PVOID pvCompletion, uint32_t fFlags); 41 const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST * 42 VBoxSHGSMICommandPrepAsynchEvent(PVBOXSHGSMI pHeap, PVOID pvBuff, RTSEMEVENT hEventSem); 43 const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST * 44 VBoxSHGSMICommandPrepSynch(PVBOXSHGSMI pHeap, void RT_UNTRUSTED_VOLATILE_HOST *pvCmd); 45 const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST * 46 VBoxSHGSMICommandPrepAsynch(PVBOXSHGSMI pHeap, void RT_UNTRUSTED_VOLATILE_HOST *pvBuff, 47 PFNVBOXSHGSMICMDCOMPLETION pfnCompletion, PVOID pvCompletion, uint32_t fFlags); 48 const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST * 49 VBoxSHGSMICommandPrepAsynchIrq(PVBOXSHGSMI pHeap, void RT_UNTRUSTED_VOLATILE_HOST *pvBuff, 50 PFNVBOXSHGSMICMDCOMPLETION_IRQ pfnCompletion, PVOID pvCompletion, uint32_t fFlags); 43 51 44 void VBoxSHGSMICommandDoneAsynch(PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER *pHeader);45 int VBoxSHGSMICommandDoneSynch(PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER*pHeader);46 void VBoxSHGSMICommandCancelAsynch(PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER *pHeader);47 void VBoxSHGSMICommandCancelSynch(PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER *pHeader);52 void VBoxSHGSMICommandDoneAsynch(PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *pHeader); 53 int VBoxSHGSMICommandDoneSynch(PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *pHeader); 54 void VBoxSHGSMICommandCancelAsynch(PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *pHeader); 55 void VBoxSHGSMICommandCancelSynch(PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *pHeader); 48 56 49 DECLINLINE(HGSMIOFFSET) VBoxSHGSMICommandOffset(const PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER *pHeader)57 DECLINLINE(HGSMIOFFSET) VBoxSHGSMICommandOffset(const PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *pHeader) 50 58 { 51 59 return HGSMIHeapBufferOffset(&pHeap->Heap, (void*)pHeader); … … 61 69 int VBoxSHGSMIInit(PVBOXSHGSMI pHeap, void *pvBase, HGSMISIZE cbArea, HGSMIOFFSET offBase, const HGSMIENV *pEnv); 62 70 void VBoxSHGSMITerm(PVBOXSHGSMI pHeap); 63 void *VBoxSHGSMIHeapAlloc(PVBOXSHGSMI pHeap, HGSMISIZE cbData, uint8_t u8Channel, uint16_t u16ChannelInfo);64 void VBoxSHGSMIHeapFree(PVBOXSHGSMI pHeap, void *pvBuffer);65 void *VBoxSHGSMIHeapBufferAlloc(PVBOXSHGSMI pHeap, HGSMISIZE cbData);66 void VBoxSHGSMIHeapBufferFree(PVBOXSHGSMI pHeap, void *pvBuffer);67 void *VBoxSHGSMICommandAlloc(PVBOXSHGSMI pHeap, HGSMISIZE cbData, uint8_t u8Channel, uint16_t u16ChannelInfo);68 void VBoxSHGSMICommandFree(PVBOXSHGSMI pHeap, void *pvBuffer);71 void RT_UNTRUSTED_VOLATILE_HOST *VBoxSHGSMIHeapAlloc(PVBOXSHGSMI pHeap, HGSMISIZE cbData, uint8_t u8Channel, uint16_t u16ChannelInfo); 72 void VBoxSHGSMIHeapFree(PVBOXSHGSMI pHeap, void RT_UNTRUSTED_VOLATILE_HOST *pvBuffer); 73 void RT_UNTRUSTED_VOLATILE_HOST *VBoxSHGSMIHeapBufferAlloc(PVBOXSHGSMI pHeap, HGSMISIZE cbData); 74 void VBoxSHGSMIHeapBufferFree(PVBOXSHGSMI pHeap, void RT_UNTRUSTED_VOLATILE_HOST *pvBuffer); 75 void RT_UNTRUSTED_VOLATILE_HOST *VBoxSHGSMICommandAlloc(PVBOXSHGSMI pHeap, HGSMISIZE cbData, uint8_t u8Channel, uint16_t u16ChannelInfo); 76 void VBoxSHGSMICommandFree(PVBOXSHGSMI pHeap, void RT_UNTRUSTED_VOLATILE_HOST *pvBuffer); 69 77 int VBoxSHGSMICommandProcessCompletion(PVBOXSHGSMI pHeap, VBOXSHGSMIHEADER* pCmd, bool bIrq, struct VBOXVTLIST * pPostProcessList); 70 78 int VBoxSHGSMICommandPostprocessCompletion(PVBOXSHGSMI pHeap, struct VBOXVTLIST * pPostProcessList); -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVbva.cpp
r69500 r71590 123 123 #define vboxCmdVbvaSubmit vboxCmdVbvaSubmitHgsmi 124 124 125 static VBOXCMDVBVA_CTL *vboxCmdVbvaCtlCreate(PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, uint32_t cbCtl)125 static VBOXCMDVBVA_CTL RT_UNTRUSTED_VOLATILE_HOST *vboxCmdVbvaCtlCreate(PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, uint32_t cbCtl) 126 126 { 127 127 Assert(cbCtl >= sizeof (VBOXCMDVBVA_CTL)); 128 return (VBOXCMDVBVA_CTL*)VBoxSHGSMICommandAlloc(&pHGSMICtx->heapCtx, cbCtl, HGSMI_CH_VBVA, VBVA_CMDVBVA_CTL); 129 } 130 131 static void vboxCmdVbvaCtlFree(PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, VBOXCMDVBVA_CTL * pCtl) 128 return (VBOXCMDVBVA_CTL RT_UNTRUSTED_VOLATILE_HOST *)VBoxSHGSMICommandAlloc(&pHGSMICtx->heapCtx, cbCtl, 129 HGSMI_CH_VBVA, VBVA_CMDVBVA_CTL); 130 } 131 132 static void vboxCmdVbvaCtlFree(PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, VBOXCMDVBVA_CTL RT_UNTRUSTED_VOLATILE_HOST *pCtl) 132 133 { 133 134 VBoxSHGSMICommandFree(&pHGSMICtx->heapCtx, pCtl); 134 135 } 135 136 136 static int vboxCmdVbvaCtlSubmitSync(PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, VBOXCMDVBVA_CTL *pCtl)137 { 138 const VBOXSHGSMIHEADER *pHdr = VBoxSHGSMICommandPrepSynch(&pHGSMICtx->heapCtx, pCtl);137 static int vboxCmdVbvaCtlSubmitSync(PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, VBOXCMDVBVA_CTL RT_UNTRUSTED_VOLATILE_HOST *pCtl) 138 { 139 const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *pHdr = VBoxSHGSMICommandPrepSynch(&pHGSMICtx->heapCtx, pCtl); 139 140 if (!pHdr) 140 141 { … … 176 177 static int vboxCmdVbvaCtlSubmitAsync(PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, VBOXCMDVBVA_CTL * pCtl, FNVBOXSHGSMICMDCOMPLETION pfnCompletion, void *pvCompletion) 177 178 { 178 const VBOXSHGSMIHEADER* pHdr = VBoxSHGSMICommandPrepAsynch(&pHGSMICtx->heapCtx, pCtl, pfnCompletion, pvCompletion, VBOXSHGSMI_FLAG_GH_ASYNCH_IRQ); 179 const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *pHdr = VBoxSHGSMICommandPrepAsynch(&pHGSMICtx->heapCtx, pCtl, pfnCompletion, 180 pvCompletion, VBOXSHGSMI_FLAG_GH_ASYNCH_IRQ); 179 181 HGSMIOFFSET offCmd = VBoxSHGSMICommandOffset(&pHGSMICtx->heapCtx, pHdr); 180 182 if (offCmd == HGSMIOFFSET_VOID) … … 191 193 return rc; 192 194 } 193 else 194 WARN(("vboxCmdVbvaSubmit returnd %d", rc)); 195 195 196 WARN(("vboxCmdVbvaSubmit returnd %d", rc)); 196 197 VBoxSHGSMICommandCancelAsynch(&pHGSMICtx->heapCtx, pHdr); 197 198 198 return rc; 199 199 } … … 201 201 static int vboxVBVAExCtlSubmitEnableDisable(PVBVAEXBUFFERCONTEXT pCtx, PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, bool fEnable) 202 202 { 203 VBOXCMDVBVA_CTL_ENABLE *pCtl = (VBOXCMDVBVA_CTL_ENABLE*)vboxCmdVbvaCtlCreate(pHGSMICtx, sizeof (*pCtl)); 203 VBOXCMDVBVA_CTL_ENABLE RT_UNTRUSTED_VOLATILE_HOST *pCtl = 204 (VBOXCMDVBVA_CTL_ENABLE RT_UNTRUSTED_VOLATILE_HOST *)vboxCmdVbvaCtlCreate(pHGSMICtx, sizeof (*pCtl)); 204 205 if (!pCtl) 205 206 { … … 210 211 pCtl->Hdr.u32Type = VBOXCMDVBVACTL_TYPE_ENABLE; 211 212 pCtl->Hdr.i32Result = VERR_NOT_IMPLEMENTED; 212 memset( &pCtl->Enable, 0, sizeof(pCtl->Enable));213 memset((void *)&pCtl->Enable, 0, sizeof(pCtl->Enable)); 213 214 pCtl->Enable.u32Flags = fEnable? VBVA_F_ENABLE: VBVA_F_DISABLE; 214 215 pCtl->Enable.u32Offset = pCtx->offVRAMBuffer; … … 1232 1233 uint32_t *pu32ClientID) 1233 1234 { 1234 VBOXCMDVBVA_CTL_3DCTL_CONNECT *pConnect = (VBOXCMDVBVA_CTL_3DCTL_CONNECT*)vboxCmdVbvaCtlCreate(pHGSMICtx, sizeof (VBOXCMDVBVA_CTL_3DCTL_CONNECT)); 1235 VBOXCMDVBVA_CTL_3DCTL_CONNECT RT_UNTRUSTED_VOLATILE_HOST *pConnect = 1236 (VBOXCMDVBVA_CTL_3DCTL_CONNECT RT_UNTRUSTED_VOLATILE_HOST *)vboxCmdVbvaCtlCreate(pHGSMICtx, 1237 sizeof(VBOXCMDVBVA_CTL_3DCTL_CONNECT)); 1235 1238 if (!pConnect) 1236 1239 { … … 1268 1271 int vboxCmdVbvaConDisconnect(PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, uint32_t u32ClientID) 1269 1272 { 1270 VBOXCMDVBVA_CTL_3DCTL *pDisconnect = (VBOXCMDVBVA_CTL_3DCTL*)vboxCmdVbvaCtlCreate(pHGSMICtx, sizeof (VBOXCMDVBVA_CTL_3DCTL)); 1273 VBOXCMDVBVA_CTL_3DCTL RT_UNTRUSTED_VOLATILE_HOST *pDisconnect = 1274 (VBOXCMDVBVA_CTL_3DCTL RT_UNTRUSTED_VOLATILE_HOST*)vboxCmdVbvaCtlCreate(pHGSMICtx, sizeof(VBOXCMDVBVA_CTL_3DCTL)); 1271 1275 if (!pDisconnect) 1272 1276 { … … 1331 1335 void vboxCmdVbvaConCmdFree(PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, VBOXCMDVBVA_CRCMD_CMD *pCmd) 1332 1336 { 1333 VBOXCMDVBVA_CTL_3DCTL_CMD *pHdr = ((VBOXCMDVBVA_CTL_3DCTL_CMD*)pCmd)-1;1337 VBOXCMDVBVA_CTL_3DCTL_CMD RT_UNTRUSTED_VOLATILE_HOST *pHdr = ((VBOXCMDVBVA_CTL_3DCTL_CMD RT_UNTRUSTED_VOLATILE_HOST *)pCmd) - 1; 1334 1338 vboxCmdVbvaCtlFree(pHGSMICtx, &pHdr->Hdr); 1335 1339 } … … 1351 1355 } 1352 1356 1353 int VBoxCmdVbvaConCmdSubmitAsync(PVBOXMP_DEVEXT pDevExt, VBOXCMDVBVA_CRCMD_CMD* pCmd, FNVBOXSHGSMICMDCOMPLETION pfnCompletion, void *pvCompletion) 1357 int VBoxCmdVbvaConCmdSubmitAsync(PVBOXMP_DEVEXT pDevExt, VBOXCMDVBVA_CRCMD_CMD* pCmd, 1358 PFNVBOXSHGSMICMDCOMPLETION pfnCompletion, void *pvCompletion) 1354 1359 { 1355 1360 return vboxCmdVbvaConSubmitAsync(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, pCmd, pfnCompletion, pvCompletion); 1356 1361 } 1357 1362 1358 int VBoxCmdVbvaConCmdCompletionData(void *pvCmd, VBOXCMDVBVA_CRCMD_CMD**ppCmd)1359 { 1360 VBOXCMDVBVA_CTL_3DCTL_CMD *pCmd = (VBOXCMDVBVA_CTL_3DCTL_CMD*)pvCmd;1363 int VBoxCmdVbvaConCmdCompletionData(void RT_UNTRUSTED_VOLATILE_HOST *pvCmd, VBOXCMDVBVA_CRCMD_CMD RT_UNTRUSTED_VOLATILE_HOST **ppCmd) 1364 { 1365 VBOXCMDVBVA_CTL_3DCTL_CMD RT_UNTRUSTED_VOLATILE_HOST *pCmd = (VBOXCMDVBVA_CTL_3DCTL_CMD RT_UNTRUSTED_VOLATILE_HOST *)pvCmd; 1361 1366 if (ppCmd) 1362 *ppCmd = (VBOXCMDVBVA_CRCMD_CMD *)(pCmd+1);1367 *ppCmd = (VBOXCMDVBVA_CRCMD_CMD RT_UNTRUSTED_VOLATILE_HOST *)(pCmd + 1); 1363 1368 return pCmd->Hdr.i32Result; 1364 1369 } … … 1368 1373 Assert(KeGetCurrentIrql() < DISPATCH_LEVEL); 1369 1374 1370 VBOXCMDVBVA_CTL_RESIZE *pResize = (VBOXCMDVBVA_CTL_RESIZE*)vboxCmdVbvaCtlCreate(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, sizeof (VBOXCMDVBVA_CTL_RESIZE)); 1375 VBOXCMDVBVA_CTL_RESIZE RT_UNTRUSTED_VOLATILE_HOST *pResize = 1376 (VBOXCMDVBVA_CTL_RESIZE RT_UNTRUSTED_VOLATILE_HOST*)vboxCmdVbvaCtlCreate(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, 1377 sizeof(VBOXCMDVBVA_CTL_RESIZE)); 1371 1378 if (!pResize) 1372 1379 { … … 1381 1388 if (RT_SUCCESS(rc)) 1382 1389 { 1383 VBOXCMDVBVA_RESIZE_ENTRY *pEntry = &pResize->Resize.aEntries[0];1384 memcpy( pEntry->aTargetMap, pTargetMap, sizeof(pEntry->aTargetMap));1390 VBOXCMDVBVA_RESIZE_ENTRY RT_UNTRUSTED_VOLATILE_HOST *pEntry = &pResize->Resize.aEntries[0]; 1391 memcpy((void *)&pEntry->aTargetMap[0], pTargetMap, sizeof(pEntry->aTargetMap)); 1385 1392 LOG(("[%d] %dx%d, TargetMap0 0x%x, flags 0x%x", 1386 1393 pEntry->Screen.u32ViewIndex, pEntry->Screen.u32Width, pEntry->Screen.u32Height, pEntry->aTargetMap[0], pEntry->Screen.u16Flags)); -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVbva.h
r69500 r71590 239 239 VBOXCMDVBVA_CRCMD_CMD* VBoxCmdVbvaConCmdAlloc(PVBOXMP_DEVEXT pDevExt, uint32_t cbCmd); 240 240 void VBoxCmdVbvaConCmdFree(PVBOXMP_DEVEXT pDevExt, VBOXCMDVBVA_CRCMD_CMD* pCmd); 241 int VBoxCmdVbvaConCmdSubmitAsync(PVBOXMP_DEVEXT pDevExt, VBOXCMDVBVA_CRCMD_CMD* pCmd, FNVBOXSHGSMICMDCOMPLETION pfnCompletion, void *pvCompletion); 242 int VBoxCmdVbvaConCmdCompletionData(void *pvCmd, VBOXCMDVBVA_CRCMD_CMD **ppCmd); 241 int VBoxCmdVbvaConCmdSubmitAsync(PVBOXMP_DEVEXT pDevExt, VBOXCMDVBVA_CRCMD_CMD* pCmd, 242 PFNVBOXSHGSMICMDCOMPLETION pfnCompletion, void *pvCompletion); 243 int VBoxCmdVbvaConCmdCompletionData(void RT_UNTRUSTED_VOLATILE_HOST *pvCmd, VBOXCMDVBVA_CRCMD_CMD RT_UNTRUSTED_VOLATILE_HOST **ppCmd); 243 244 int VBoxCmdVbvaConCmdResize(PVBOXMP_DEVEXT pDevExt, const VBOXWDDM_ALLOC_DATA *pAllocData, const uint32_t *pTargetMap, const POINT * pVScreenPos, uint16_t fFlags); 244 245 #endif /* #ifdef VBOX_WITH_CROGL */ -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVdma.cpp
r69500 r71590 342 342 } 343 343 344 NTSTATUS vboxVdmaCrSubmitWriteReadAsync(PVBOXMP_DEVEXT pDevExt, VBOXMP_CRPACKER *pCrPacker, uint32_t u32CrConClientID, PFNVBOXMP_CRSHGSMITRANSPORT_SENDWRITEREADASYNC_COMPLETION pfnCompletion, void *pvCompletion) 344 NTSTATUS vboxVdmaCrSubmitWriteReadAsync(PVBOXMP_DEVEXT pDevExt, VBOXMP_CRPACKER *pCrPacker, uint32_t u32CrConClientID, 345 PFNVBOXMP_CRSHGSMITRANSPORT_SENDWRITEREADASYNC_COMPLETION pfnCompletion, void *pvCompletion) 345 346 { 346 347 Assert(u32CrConClientID); … … 547 548 } 548 549 549 void *pvCommandBuffer = NULL;550 uint32_t cbCommandBuffer = VBOXMP_CRCMD_HEADER_SIZE ;551 cbCommandBuffer +=VBOXMP_CRCMD_SIZE_WINDOWVISIBLEREGIONS(cVRects);552 553 pvCommandBuffer = VBoxMpCrShgsmiTransportBufAlloc(&pDevExt->CrHgsmiTransport,cbCommandBuffer);550 ; 551 uint32_t cbCommandBuffer = VBOXMP_CRCMD_HEADER_SIZE 552 + VBOXMP_CRCMD_SIZE_WINDOWVISIBLEREGIONS(cVRects); 553 void RT_UNTRUSTED_VOLATILE_HOST *pvCommandBuffer = VBoxMpCrShgsmiTransportBufAlloc(&pDevExt->CrHgsmiTransport, 554 cbCommandBuffer); 554 555 if (!pvCommandBuffer) 555 556 { … … 603 604 } 604 605 605 void *pvCommandBuffer = VBoxMpCrShgsmiTransportBufAlloc(&pDevExt->CrHgsmiTransport, cbCommandBuffer);606 void RT_UNTRUSTED_VOLATILE_HOST *pvCommandBuffer = VBoxMpCrShgsmiTransportBufAlloc(&pDevExt->CrHgsmiTransport, cbCommandBuffer); 606 607 if (!pvCommandBuffer) 607 608 { … … 878 879 } VBOXVDMA_CRRXGENERICSYNC, *PVBOXVDMA_CRRXGENERICSYNC; 879 880 880 static DECLCALLBACK(void) vboxVdmaCrRxGenericSyncCompletion(PVBOXMP_CRSHGSMITRANSPORT pCon, int rc, void *pvRx, uint32_t cbRx, void *pvCtx) 881 /** @callback_method_impl{PFNVBOXMP_CRSHGSMITRANSPORT_SENDWRITEREADASYNC_COMPLETION} */ 882 static DECLCALLBACK(void) vboxVdmaCrRxGenericSyncCompletion(PVBOXMP_CRSHGSMITRANSPORT pCon, int rc, 883 void RT_UNTRUSTED_VOLATILE_HOST *pvRx, uint32_t cbRx, void *pvCtx) 881 884 { 882 885 PVBOXMP_VDMACR_WRITEREADCOMPLETION pvCompletionData = (PVBOXMP_VDMACR_WRITEREADCOMPLETION)pvCtx; … … 884 887 if (RT_SUCCESS(rc)) 885 888 { 886 rc = VBoxMpCrCmdRxHandler((CRMessageHeader *)pvRx, cbRx);889 rc = VBoxMpCrCmdRxHandler((CRMessageHeader *)pvRx, cbRx); 887 890 if (!RT_SUCCESS(rc)) 888 891 { … … 927 930 { 928 931 VBOXMP_CRPACKER CrPacker; 929 void *pvCommandBuffer;932 void RT_UNTRUSTED_VOLATILE_HOST *pvCommandBuffer; 930 933 } VBOXMP_CRHGSMIMGR; 931 934 … … 1095 1098 uint32_t cbCommandBuffer = VBOXMP_CRCMD_HEADER_SIZE + VBOXMP_CRCMD_SIZE_VBOXTEXPRESENT(cRects); 1096 1099 uint32_t cCommands = 1; 1097 void *pvCommandBuffer = VBoxMpCrShgsmiTransportBufAlloc(&pDevExt->CrHgsmiTransport, cbCommandBuffer);1100 void RT_UNTRUSTED_VOLATILE_HOST *pvCommandBuffer = VBoxMpCrShgsmiTransportBufAlloc(&pDevExt->CrHgsmiTransport, cbCommandBuffer); 1098 1101 if (!pvCommandBuffer) 1099 1102 { … … 1125 1128 uint32_t cbCommandBuffer = VBOXMP_CRCMD_HEADER_SIZE + VBOXMP_CRCMD_SIZE_CHROMIUMPARAMETERICR; 1126 1129 uint32_t cCommands = 1; 1127 void *pvCommandBuffer = VBoxMpCrShgsmiTransportBufAlloc(&pDevExt->CrHgsmiTransport, cbCommandBuffer);1130 void RT_UNTRUSTED_VOLATILE_HOST *pvCommandBuffer = VBoxMpCrShgsmiTransportBufAlloc(&pDevExt->CrHgsmiTransport, cbCommandBuffer); 1128 1131 if (!pvCommandBuffer) 1129 1132 { … … 1528 1531 int rc = VINF_SUCCESS; 1529 1532 1530 PVBOXVDMA_CTL pCmd = (PVBOXVDMA_CTL)VBoxSHGSMICommandAlloc(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx.heapCtx, sizeof (VBOXVDMA_CTL), HGSMI_CH_VBVA, VBVA_VDMA_CTL); 1533 VBOXVDMA_CTL RT_UNTRUSTED_VOLATILE_HOST *pCmd = 1534 (VBOXVDMA_CTL RT_UNTRUSTED_VOLATILE_HOST *)VBoxSHGSMICommandAlloc(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx.heapCtx, 1535 sizeof(VBOXVDMA_CTL), HGSMI_CH_VBVA, VBVA_VDMA_CTL); 1531 1536 if (pCmd) 1532 1537 { … … 1535 1540 pCmd->i32Result = VERR_NOT_SUPPORTED; 1536 1541 1537 const VBOXSHGSMIHEADER* pHdr = VBoxSHGSMICommandPrepSynch(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx.heapCtx, pCmd); 1542 const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *pHdr = VBoxSHGSMICommandPrepSynch(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx.heapCtx, 1543 pCmd); 1538 1544 Assert(pHdr); 1539 1545 if (pHdr) … … 1566 1572 } 1567 1573 1568 VBoxSHGSMICommandFree 1574 VBoxSHGSMICommandFree(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx.heapCtx, pCmd); 1569 1575 } 1570 1576 else … … 1714 1720 1715 1721 #ifdef VBOX_WITH_VDMA 1716 void vboxVdmaCBufDrFree (PVBOXVDMAINFO pInfo, PVBOXVDMACBUF_DRpDr)1717 { 1718 VBoxSHGSMICommandFree 1719 } 1720 1721 PVBOXVDMACBUF_DR vboxVdmaCBufDrCreate(PVBOXVDMAINFO pInfo, uint32_t cbTrailingData)1722 void vboxVdmaCBufDrFree(PVBOXVDMAINFO pInfo, VBOXVDMACBUF_DR RT_UNTRUSTED_VOLATILE_HOST *pDr) 1723 { 1724 VBoxSHGSMICommandFree(&pInfo->CmdHeap, pDr); 1725 } 1726 1727 VBOXVDMACBUF_DR RT_UNTRUSTED_VOLATILE_HOST *vboxVdmaCBufDrCreate(PVBOXVDMAINFO pInfo, uint32_t cbTrailingData) 1722 1728 { 1723 1729 uint32_t cbDr = VBOXVDMACBUF_DR_SIZE(cbTrailingData); 1724 PVBOXVDMACBUF_DR pDr = (PVBOXVDMACBUF_DR)VBoxSHGSMICommandAlloc (&pInfo->CmdHeap, cbDr, HGSMI_CH_VBVA, VBVA_VDMA_CMD); 1730 VBOXVDMACBUF_DR RT_UNTRUSTED_VOLATILE_HOST *pDr = 1731 (VBOXVDMACBUF_DR RT_UNTRUSTED_VOLATILE_HOST *)VBoxSHGSMICommandAlloc(&pInfo->CmdHeap, cbDr, HGSMI_CH_VBVA, VBVA_VDMA_CMD); 1725 1732 Assert(pDr); 1726 1733 if (pDr) 1727 memset (pDr, 0, cbDr);1734 memset((void *)pDr, 0, cbDr); 1728 1735 else 1729 1736 LOGREL(("VBoxSHGSMICommandAlloc returned NULL")); … … 1741 1748 } 1742 1749 1743 static DECLCALLBACK(PFNVBOXSHGSMICMDCOMPLETION) vboxVdmaCBufDrCompletionIrq(PVBOXSHGSMI pHeap, void *pvCmd, 1744 void *pvContext, void **ppvCompletion) 1750 /** @callback_method_impl{FNVBOXSHGSMICMDCOMPLETION_IRQ} */ 1751 static DECLCALLBACK(PFNVBOXSHGSMICMDCOMPLETION) 1752 vboxVdmaCBufDrCompletionIrq(PVBOXSHGSMI pHeap, void RT_UNTRUSTED_VOLATILE_HOST *pvCmd, void *pvContext, void **ppvCompletion) 1745 1753 { 1746 1754 RT_NOREF(pHeap, ppvCompletion); 1747 1755 PVBOXMP_DEVEXT pDevExt = (PVBOXMP_DEVEXT)pvContext; 1748 PVBOXVDMACBUF_DR pDr = (PVBOXVDMACBUF_DR)pvCmd;1756 VBOXVDMACBUF_DR RT_UNTRUSTED_VOLATILE_HOST *pDr = (VBOXVDMACBUF_DR RT_UNTRUSTED_VOLATILE_HOST *)pvCmd; 1749 1757 1750 1758 DXGK_INTERRUPT_TYPE enmComplType; … … 1756 1764 else if (pDr->rc == VERR_INTERRUPTED) 1757 1765 { 1758 Assert (0);1766 AssertFailed(); 1759 1767 enmComplType = DXGK_INTERRUPT_DMA_PREEMPTED; 1760 1768 } 1761 1769 else 1762 1770 { 1763 Assert (0);1771 AssertFailed(); 1764 1772 enmComplType = DXGK_INTERRUPT_DMA_FAULTED; 1765 1773 } … … 1775 1783 } 1776 1784 1777 int vboxVdmaCBufDrSubmit(PVBOXMP_DEVEXT pDevExt, PVBOXVDMAINFO pInfo, PVBOXVDMACBUF_DR pDr) 1778 { 1779 const VBOXSHGSMIHEADER* pHdr = VBoxSHGSMICommandPrepAsynchIrq (&pInfo->CmdHeap, pDr, vboxVdmaCBufDrCompletionIrq, pDevExt, VBOXSHGSMI_FLAG_GH_ASYNCH_FORCE); 1785 int vboxVdmaCBufDrSubmit(PVBOXMP_DEVEXT pDevExt, PVBOXVDMAINFO pInfo, VBOXVDMACBUF_DR RT_UNTRUSTED_VOLATILE_HOST *pDr) 1786 { 1787 const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *pHdr = 1788 VBoxSHGSMICommandPrepAsynchIrq(&pInfo->CmdHeap, pDr, vboxVdmaCBufDrCompletionIrq, pDevExt, VBOXSHGSMI_FLAG_GH_ASYNCH_FORCE); 1780 1789 Assert(pHdr); 1781 1790 int rc = VERR_GENERAL_FAILURE; … … 1808 1817 } 1809 1818 1810 int vboxVdmaCBufDrSubmitSynch(PVBOXMP_DEVEXT pDevExt, PVBOXVDMAINFO pInfo, PVBOXVDMACBUF_DR pDr) 1811 { 1812 const VBOXSHGSMIHEADER* pHdr = VBoxSHGSMICommandPrepAsynch (&pInfo->CmdHeap, pDr, NULL, NULL, VBOXSHGSMI_FLAG_GH_SYNCH); 1819 int vboxVdmaCBufDrSubmitSynch(PVBOXMP_DEVEXT pDevExt, PVBOXVDMAINFO pInfo, VBOXVDMACBUF_DR RT_UNTRUSTED_VOLATILE_HOST *pDr) 1820 { 1821 const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *pHdr = VBoxSHGSMICommandPrepAsynch(&pInfo->CmdHeap, pDr, NULL, 1822 NULL, VBOXSHGSMI_FLAG_GH_SYNCH); 1813 1823 Assert(pHdr); 1814 1824 int rc = VERR_GENERAL_FAILURE; -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVdma.h
r69500 r71590 71 71 NTSTATUS vboxVdmaDdiCmdSubmitted(PVBOXMP_DEVEXT pDevExt, PVBOXVDMADDI_CMD pCmd); 72 72 73 DECLINLINE(VOID) vboxVdmaDdiCmdInit(PVBOXVDMADDI_CMD pCmd, 74 uint32_t u32NodeOrdinal, uint32_t u32FenceId, 75 PFNVBOXVDMADDICMDCOMPLETE_DPC pfnComplete, PVOID pvComplete) 73 DECLINLINE(VOID) vboxVdmaDdiCmdInit(PVBOXVDMADDI_CMD pCmd, uint32_t u32NodeOrdinal, uint32_t u32FenceId, 74 PFNVBOXVDMADDICMDCOMPLETE_DPC pfnComplete, PVOID pvComplete) 76 75 { 77 76 pCmd->QueueEntry.Blink = NULL; … … 283 282 return VBoxSHGSMICommandPtrOffset(&pInfo->CmdHeap, pvPtr); 284 283 } 285 int vboxVdmaCBufDrSubmit(PVBOXMP_DEVEXT pDevExt, PVBOXVDMAINFO pInfo, PVBOXVDMACBUF_DRpDr);286 int vboxVdmaCBufDrSubmitSynch(PVBOXMP_DEVEXT pDevExt, PVBOXVDMAINFO pInfo, PVBOXVDMACBUF_DRpDr);287 struct VBOXVDMACBUF_DR *vboxVdmaCBufDrCreate(PVBOXVDMAINFO pInfo, uint32_t cbTrailingData);288 void vboxVdmaCBufDrFree(PVBOXVDMAINFO pInfo, struct VBOXVDMACBUF_DR *pDr);284 int vboxVdmaCBufDrSubmit(PVBOXMP_DEVEXT pDevExt, PVBOXVDMAINFO pInfo, VBOXVDMACBUF_DR RT_UNTRUSTED_VOLATILE_HOST *pDr); 285 int vboxVdmaCBufDrSubmitSynch(PVBOXMP_DEVEXT pDevExt, PVBOXVDMAINFO pInfo, VBOXVDMACBUF_DR RT_UNTRUSTED_VOLATILE_HOST *pDr); 286 struct VBOXVDMACBUF_DR RT_UNTRUSTED_VOLATILE_HOST *vboxVdmaCBufDrCreate(PVBOXVDMAINFO pInfo, uint32_t cbTrailingData); 287 void vboxVdmaCBufDrFree(PVBOXVDMAINFO pInfo, struct VBOXVDMACBUF_DR RT_UNTRUSTED_VOLATILE_HOST *pDr); 289 288 290 289 #define VBOXVDMACBUF_DR_DATA_OFFSET() (sizeof (VBOXVDMACBUF_DR)) -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVhwa.cpp
r69500 r71590 27 27 28 28 29 DECLINLINE(void) vboxVhwaHdrInit(VBOXVHWACMD* pHdr, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId, VBOXVHWACMD_TYPE enmCmd) 30 { 31 memset(pHdr, 0, sizeof(VBOXVHWACMD)); 29 DECLINLINE(void) vboxVhwaHdrInit(VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *pHdr, 30 D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId, VBOXVHWACMD_TYPE enmCmd) 31 { 32 memset((void *)pHdr, 0, sizeof(VBOXVHWACMD)); 32 33 pHdr->iDisplay = srcId; 33 34 pHdr->rc = VERR_GENERAL_FAILURE; … … 39 40 40 41 #ifdef VBOXVHWA_WITH_SHGSMI 41 static int vboxVhwaCommandSubmitHgsmi(struct _DEVICE_EXTENSION *pDevExt, HGSMIOFFSET offDr)42 static int vboxVhwaCommandSubmitHgsmi(struct _DEVICE_EXTENSION *pDevExt, HGSMIOFFSET offDr) 42 43 { 43 44 VBoxHGSMIGuestWrite(pDevExt, offDr); … … 45 46 } 46 47 #else 47 DECLINLINE(void) vbvaVhwaCommandRelease(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD *pCmd)48 DECLINLINE(void) vbvaVhwaCommandRelease(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *pCmd) 48 49 { 49 50 uint32_t cRefs = ASMAtomicDecU32(&pCmd->cRefs); … … 55 56 } 56 57 57 DECLINLINE(void) vbvaVhwaCommandRetain(VBOXVHWACMD *pCmd)58 DECLINLINE(void) vbvaVhwaCommandRetain(VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *pCmd) 58 59 { 59 60 ASMAtomicIncU32(&pCmd->cRefs); … … 61 62 62 63 /* do not wait for completion */ 63 void vboxVhwaCommandSubmitAsynch(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD* pCmd, PFNVBOXVHWACMDCOMPLETION pfnCompletion, void *pContext) 64 void vboxVhwaCommandSubmitAsynch(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *pCmd, 65 PFNVBOXVHWACMDCOMPLETION pfnCompletion, void *pContext) 64 66 { 65 67 pCmd->GuestVBVAReserved1 = (uintptr_t)pfnCompletion; … … 69 71 VBoxHGSMIBufferSubmit(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, pCmd); 70 72 71 if( !(pCmd->Flags & VBOXVHWACMD_FLAG_HG_ASYNCH) 72 || ( (pCmd->Flags & VBOXVHWACMD_FLAG_GH_ASYNCH_NOCOMPLETION) 73 && (pCmd->Flags & VBOXVHWACMD_FLAG_HG_ASYNCH_RETURNED) ) ) 73 uint32_t const fFlags = pCmd->Flags; 74 if( !(fFlags & VBOXVHWACMD_FLAG_HG_ASYNCH) 75 || ( (fFlags & VBOXVHWACMD_FLAG_GH_ASYNCH_NOCOMPLETION) 76 && (fFlags & VBOXVHWACMD_FLAG_HG_ASYNCH_RETURNED) ) ) 74 77 { 75 78 /* the command is completed */ … … 80 83 } 81 84 82 static DECLCALLBACK(void) vboxVhwaCompletionSetEvent(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD * pCmd, void * pvContext) 83 { 84 RT_NOREF(pDevExt, pCmd); 85 /** @callback_method_impl{FNVBOXVHWACMDCOMPLETION} */ 86 static DECLCALLBACK(void) 87 vboxVhwaCompletionSetEvent(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *pCmd, void *pvContext) 88 { 89 RT_NOREF(pDevExt, pCmd); 85 90 RTSemEventSignal((RTSEMEVENT)pvContext); 86 91 } 87 92 88 void vboxVhwaCommandSubmitAsynchByEvent(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD *pCmd, RTSEMEVENT hEvent)93 void vboxVhwaCommandSubmitAsynchByEvent(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *pCmd, RTSEMEVENT hEvent) 89 94 { 90 95 vboxVhwaCommandSubmitAsynch(pDevExt, pCmd, vboxVhwaCompletionSetEvent, hEvent); … … 98 103 } 99 104 100 VBOXVHWACMD* vboxVhwaCommandCreate(PVBOXMP_DEVEXT pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId, VBOXVHWACMD_TYPE enmCmd, VBOXVHWACMD_LENGTH cbCmd) 105 VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *vboxVhwaCommandCreate(PVBOXMP_DEVEXT pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId, 106 VBOXVHWACMD_TYPE enmCmd, VBOXVHWACMD_LENGTH cbCmd) 101 107 { 102 108 vboxVhwaCommandCheckCompletion(pDevExt); 109 VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *pHdr; 103 110 #ifdef VBOXVHWA_WITH_SHGSMI 104 VBOXVHWACMD* pHdr = (VBOXVHWACMD*)VBoxSHGSMICommandAlloc(&pDevExt->u.primary.hgsmiAdapterHeap,105 cbCmd + VBOXVHWACMD_HEADSIZE(),106 HGSMI_CH_VBVA,107 VBVA_VHWA_CMD);111 pHdr = (VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *)VBoxSHGSMICommandAlloc(&pDevExt->u.primary.hgsmiAdapterHeap, 112 cbCmd + VBOXVHWACMD_HEADSIZE(), 113 HGSMI_CH_VBVA, 114 VBVA_VHWA_CMD); 108 115 #else 109 VBOXVHWACMD* pHdr = (VBOXVHWACMD*)VBoxHGSMIBufferAlloc(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx,110 cbCmd + VBOXVHWACMD_HEADSIZE(),111 HGSMI_CH_VBVA,112 VBVA_VHWA_CMD);116 pHdr = (VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *)VBoxHGSMIBufferAlloc(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, 117 cbCmd + VBOXVHWACMD_HEADSIZE(), 118 HGSMI_CH_VBVA, 119 VBVA_VHWA_CMD); 113 120 #endif 114 121 Assert(pHdr); 115 122 if (!pHdr) 116 {117 123 LOGREL(("VBoxHGSMIBufferAlloc failed")); 118 }119 124 else 120 {121 125 vboxVhwaHdrInit(pHdr, srcId, enmCmd); 122 }123 126 124 127 return pHdr; 125 128 } 126 129 127 void vboxVhwaCommandFree(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD *pCmd)130 void vboxVhwaCommandFree(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *pCmd) 128 131 { 129 132 #ifdef VBOXVHWA_WITH_SHGSMI … … 134 137 } 135 138 136 int vboxVhwaCommandSubmit(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD *pCmd)139 int vboxVhwaCommandSubmit(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *pCmd) 137 140 { 138 141 #ifdef VBOXVHWA_WITH_SHGSMI … … 184 187 185 188 #ifndef VBOXVHWA_WITH_SHGSMI 186 static DECLCALLBACK(void) vboxVhwaCompletionFreeCmd(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD *pCmd, void *pvContext) 189 /** @callback_method_impl{FNVBOXVHWACMDCOMPLETION} */ 190 static DECLCALLBACK(void) 191 vboxVhwaCompletionFreeCmd(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *pCmd, void *pvContext) 187 192 { 188 193 RT_NOREF(pvContext); … … 197 202 /* need to save next since the command may be released in a pfnCallback and thus its data might be invalid */ 198 203 pNext = pCur->pNext; 199 VBOXVHWACMD *pCmd = VBOXVHWA_LISTENTRY2CMD(pCur);204 VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *pCmd = VBOXVHWA_LISTENTRY2CMD(pCur); 200 205 PFNVBOXVHWACMDCOMPLETION pfnCallback = (PFNVBOXVHWACMDCOMPLETION)pCmd->GuestVBVAReserved1; 201 206 void *pvCallback = (void*)pCmd->GuestVBVAReserved2; … … 206 211 #endif 207 212 208 void vboxVhwaCommandSubmitAsynchAndComplete(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD *pCmd)213 void vboxVhwaCommandSubmitAsynchAndComplete(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *pCmd) 209 214 { 210 215 #ifdef VBOXVHWA_WITH_SHGSMI … … 231 236 VBOXVHWACMD_QUERYINFO1* vboxVhwaQueryHostInfo1(PVBOXMP_DEVEXT pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId) 232 237 { 233 VBOXVHWACMD* pCmd = vboxVhwaCommandCreate(pDevExt, srcId, VBOXVHWACMD_TYPE_QUERY_INFO1, sizeof(VBOXVHWACMD_QUERYINFO1)); 234 VBOXVHWACMD_QUERYINFO1 *pInfo1; 235 236 Assert(pCmd); 237 if (!pCmd) 238 { 239 LOGREL(("vboxVhwaCommandCreate failed")); 240 return NULL; 241 } 242 243 pInfo1 = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_QUERYINFO1); 238 VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *pCmd = vboxVhwaCommandCreate(pDevExt, srcId, VBOXVHWACMD_TYPE_QUERY_INFO1, 239 sizeof(VBOXVHWACMD_QUERYINFO1)); 240 AssertReturnStmt(pCmd, LOGREL(("vboxVhwaCommandCreate failed")), NULL); 241 242 VBOXVHWACMD_QUERYINFO1 *pInfo1 = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_QUERYINFO1); 244 243 pInfo1->u.in.guestVersion.maj = VBOXVHWA_VERSION_MAJ; 245 244 pInfo1->u.in.guestVersion.min = VBOXVHWA_VERSION_MIN; … … 249 248 int rc = vboxVhwaCommandSubmit(pDevExt, pCmd); 250 249 AssertRC(rc); 251 if(RT_SUCCESS(rc)) 252 { 253 if(RT_SUCCESS(pCmd->rc)) 254 { 250 if (RT_SUCCESS(rc)) 251 if (RT_SUCCESS(pCmd->rc)) 255 252 return VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_QUERYINFO1); 256 }257 }258 253 259 254 vboxVhwaCommandFree(pDevExt, pCmd); … … 263 258 VBOXVHWACMD_QUERYINFO2* vboxVhwaQueryHostInfo2(PVBOXMP_DEVEXT pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId, uint32_t numFourCC) 264 259 { 265 VBOXVHWACMD* pCmd = vboxVhwaCommandCreate(pDevExt, srcId, VBOXVHWACMD_TYPE_QUERY_INFO2, VBOXVHWAINFO2_SIZE(numFourCC)); 266 VBOXVHWACMD_QUERYINFO2 *pInfo2; 267 Assert(pCmd); 268 if (!pCmd) 269 { 270 LOGREL(("vboxVhwaCommandCreate failed")); 271 return NULL; 272 } 273 274 pInfo2 = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_QUERYINFO2); 260 VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *pCmd = vboxVhwaCommandCreate(pDevExt, srcId, VBOXVHWACMD_TYPE_QUERY_INFO2, 261 VBOXVHWAINFO2_SIZE(numFourCC)); 262 AssertReturnStmt(pCmd, LOGREL(("vboxVhwaCommandCreate failed")), NULL); 263 264 VBOXVHWACMD_QUERYINFO2 *pInfo2 = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_QUERYINFO2); 275 265 pInfo2->numFourCC = numFourCC; 276 266 … … 295 285 int vboxVhwaEnable(PVBOXMP_DEVEXT pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId) 296 286 { 297 int rc = VERR_GENERAL_FAILURE; 298 VBOXVHWACMD* pCmd; 299 300 pCmd = vboxVhwaCommandCreate(pDevExt, srcId, VBOXVHWACMD_TYPE_ENABLE, 0); 301 Assert(pCmd); 302 if (!pCmd) 303 { 304 LOGREL(("vboxVhwaCommandCreate failed")); 305 return rc; 306 } 307 308 rc = vboxVhwaCommandSubmit(pDevExt, pCmd); 287 VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *pCmd = vboxVhwaCommandCreate(pDevExt, srcId, VBOXVHWACMD_TYPE_ENABLE, 0); 288 AssertReturnStmt(pCmd, LOGREL(("vboxVhwaCommandCreate failed")), VERR_GENERAL_FAILURE); 289 290 int rc = vboxVhwaCommandSubmit(pDevExt, pCmd); 309 291 AssertRC(rc); 310 292 if(RT_SUCCESS(rc)) … … 325 307 vboxVhwaCommandCheckCompletion(pDevExt); 326 308 327 int rc = VERR_GENERAL_FAILURE; 328 VBOXVHWACMD* pCmd; 329 330 pCmd = vboxVhwaCommandCreate(pDevExt, srcId, VBOXVHWACMD_TYPE_DISABLE, 0); 331 Assert(pCmd); 332 if (!pCmd) 333 { 334 LOGREL(("vboxVhwaCommandCreate failed")); 335 return rc; 336 } 337 338 rc = vboxVhwaCommandSubmit(pDevExt, pCmd); 309 VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *pCmd = vboxVhwaCommandCreate(pDevExt, srcId, VBOXVHWACMD_TYPE_DISABLE, 0); 310 AssertReturnStmt(pCmd, LOGREL(("vboxVhwaCommandCreate failed")), VERR_GENERAL_FAILURE); 311 312 int rc = vboxVhwaCommandSubmit(pDevExt, pCmd); 339 313 AssertRC(rc); 340 if (RT_SUCCESS(rc))314 if (RT_SUCCESS(rc)) 341 315 { 342 316 if(RT_SUCCESS(pCmd->rc)) … … 511 485 return VERR_INVALID_STATE; 512 486 513 VBOXVHWACMD * pCmd = vboxVhwaCommandCreate(pDevExt, VidPnSourceId,514 VBOXVHWACMD_TYPE_SURF_DESTROY,sizeof(VBOXVHWACMD_SURF_DESTROY));487 VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *pCmd = vboxVhwaCommandCreate(pDevExt, VidPnSourceId, VBOXVHWACMD_TYPE_SURF_DESTROY, 488 sizeof(VBOXVHWACMD_SURF_DESTROY)); 515 489 Assert(pCmd); 516 if (pCmd)490 if (pCmd) 517 491 { 518 492 VBOXVHWACMD_SURF_DESTROY * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_DESTROY); … … 636 610 { 637 611 /* the first thing we need is to post create primary */ 638 VBOXVHWACMD * pCmd = vboxVhwaCommandCreate(pDevExt, VidPnSourceId,639 VBOXVHWACMD_TYPE_SURF_CREATE,sizeof(VBOXVHWACMD_SURF_CREATE));612 VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *pCmd = vboxVhwaCommandCreate(pDevExt, VidPnSourceId, VBOXVHWACMD_TYPE_SURF_CREATE, 613 sizeof(VBOXVHWACMD_SURF_CREATE)); 640 614 Assert(pCmd); 641 615 if (pCmd) … … 671 645 { 672 646 /* the first thing we need is to post create primary */ 673 VBOXVHWACMD * pCmd = vboxVhwaCommandCreate(pDevExt, VidPnSourceId,674 VBOXVHWACMD_TYPE_SURF_GETINFO,sizeof(VBOXVHWACMD_SURF_GETINFO));647 VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *pCmd = vboxVhwaCommandCreate(pDevExt, VidPnSourceId, VBOXVHWACMD_TYPE_SURF_GETINFO, 648 sizeof(VBOXVHWACMD_SURF_GETINFO)); 675 649 Assert(pCmd); 676 650 if (pCmd) … … 844 818 PVBOXWDDM_OVERLAYFLIP_INFO pOurInfo = (PVBOXWDDM_OVERLAYFLIP_INFO)pFlipInfo->pPrivateDriverData; 845 819 846 VBOXVHWACMD* pCmd = vboxVhwaCommandCreate(pOverlay->pDevExt, pOverlay->VidPnSourceId, 847 VBOXVHWACMD_TYPE_SURF_FLIP, sizeof(VBOXVHWACMD_SURF_FLIP)); 820 VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *pCmd = vboxVhwaCommandCreate(pOverlay->pDevExt, pOverlay->VidPnSourceId, 821 VBOXVHWACMD_TYPE_SURF_FLIP, 822 sizeof(VBOXVHWACMD_SURF_FLIP)); 848 823 Assert(pCmd); 849 if (pCmd)824 if (pCmd) 850 825 { 851 826 VBOXVHWACMD_SURF_FLIP * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_FLIP); … … 915 890 916 891 int rc; 917 VBOXVHWACMD* pCmd = vboxVhwaCommandCreate(pOverlay->pDevExt, pOverlay->VidPnSourceId, 918 VBOXVHWACMD_TYPE_SURF_FLIP, RT_OFFSETOF(VBOXVHWACMD_SURF_COLORFILL, u.in.aRects[pCF->ClrFill.Rects.cRects])); 892 VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *pCmd = 893 vboxVhwaCommandCreate(pOverlay->pDevExt, pOverlay->VidPnSourceId, VBOXVHWACMD_TYPE_SURF_FLIP, 894 RT_OFFSETOF(VBOXVHWACMD_SURF_COLORFILL, u.in.aRects[pCF->ClrFill.Rects.cRects])); 919 895 Assert(pCmd); 920 896 if(pCmd) … … 1003 979 PVBOXWDDM_OVERLAY_INFO pOurInfo = (PVBOXWDDM_OVERLAY_INFO)pOverlayInfo->pPrivateDriverData; 1004 980 1005 VBOXVHWACMD* pCmd = vboxVhwaCommandCreate(pOverlay->pDevExt, pOverlay->VidPnSourceId, 1006 VBOXVHWACMD_TYPE_SURF_OVERLAY_UPDATE, sizeof(VBOXVHWACMD_SURF_OVERLAY_UPDATE)); 981 VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST * pCmd = vboxVhwaCommandCreate(pOverlay->pDevExt, pOverlay->VidPnSourceId, 982 VBOXVHWACMD_TYPE_SURF_OVERLAY_UPDATE, 983 sizeof(VBOXVHWACMD_SURF_OVERLAY_UPDATE)); 1007 984 Assert(pCmd); 1008 if (pCmd)985 if (pCmd) 1009 986 { 1010 987 VBOXVHWACMD_SURF_OVERLAY_UPDATE * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_OVERLAY_UPDATE); -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVhwa.h
r69500 r71590 23 23 #include "VBoxMPShgsmi.h" 24 24 25 VBOXVHWACMD * vboxVhwaCommandCreate(PVBOXMP_DEVEXT pDevExt,26 D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId,27 VBOXVHWACMD_TYPE enmCmd,28 VBOXVHWACMD_LENGTH cbCmd);25 VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST * vboxVhwaCommandCreate(PVBOXMP_DEVEXT pDevExt, 26 D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId, 27 VBOXVHWACMD_TYPE enmCmd, 28 VBOXVHWACMD_LENGTH cbCmd); 29 29 30 void vboxVhwaCommandFree(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD* pCmd); 31 int vboxVhwaCommandSubmit(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD* pCmd); 32 int vboxVhwaCommandSubmit(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD* pCmd); 33 void vboxVhwaCommandSubmitAsynchAndComplete(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD* pCmd); 30 void vboxVhwaCommandFree(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *pCmd); 31 int vboxVhwaCommandSubmit(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST * pCmd); 32 void vboxVhwaCommandSubmitAsynchAndComplete(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *pCmd); 34 33 35 34 #ifndef VBOXVHWA_WITH_SHGSMI 36 typedef DECLCALLBACK(void) FNVBOXVHWACMDCOMPLETION(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD * pCmd, void * pContext); 35 typedef DECLCALLBACK(void) FNVBOXVHWACMDCOMPLETION(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST * pCmd, 36 void *pvContext); 37 37 typedef FNVBOXVHWACMDCOMPLETION *PFNVBOXVHWACMDCOMPLETION; 38 38 39 void vboxVhwaCommandSubmitAsynch(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD* pCmd, PFNVBOXVHWACMDCOMPLETION pfnCompletion, void * pContext); 40 void vboxVhwaCommandSubmitAsynchByEvent(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD* pCmd, RTSEMEVENT hEvent); 39 void vboxVhwaCommandSubmitAsynch(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *pCmd, 40 PFNVBOXVHWACMDCOMPLETION pfnCompletion, void * pContext); 41 void vboxVhwaCommandSubmitAsynchByEvent(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *pCmd, RTSEMEVENT hEvent); 41 42 42 #define VBOXVHWA_CMD2LISTENTRY(_pCmd) ((PVBOXVTLIST_ENTRY)&(_pCmd)->u.pNext)43 #define VBOXVHWA_LISTENTRY2CMD(_pEntry) ( (VBOXVHWACMD *)((uint8_t *)(_pEntry) - RT_OFFSETOF(VBOXVHWACMD, u.pNext)) )43 #define VBOXVHWA_CMD2LISTENTRY(_pCmd) ((PVBOXVTLIST_ENTRY)&(_pCmd)->u.pNext) 44 #define VBOXVHWA_LISTENTRY2CMD(_pEntry) ( (VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *)((uint8_t *)(_pEntry) - RT_OFFSETOF(VBOXVHWACMD, u.pNext)) ) 44 45 45 DECLINLINE(void) vboxVhwaPutList(VBOXVTLIST *pList, VBOXVHWACMD *pCmd)46 DECLINLINE(void) vboxVhwaPutList(VBOXVTLIST *pList, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *pCmd) 46 47 { 47 48 vboxVtListPut(pList, VBOXVHWA_CMD2LISTENTRY(pCmd), VBOXVHWA_CMD2LISTENTRY(pCmd)); -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.cpp
r71514 r71590 211 211 int vboxWddmGhDisplayPostInfoScreen(PVBOXMP_DEVEXT pDevExt, const VBOXWDDM_ALLOC_DATA *pAllocData, const POINT * pVScreenPos, uint16_t fFlags) 212 212 { 213 void *p = VBoxHGSMIBufferAlloc (&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, 214 sizeof (VBVAINFOSCREEN), 215 HGSMI_CH_VBVA, 216 VBVA_INFO_SCREEN); 217 if (!p) 213 VBVAINFOSCREEN RT_UNTRUSTED_VOLATILE_HOST *pScreen = 214 (VBVAINFOSCREEN RT_UNTRUSTED_VOLATILE_HOST *)VBoxHGSMIBufferAlloc(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, 215 sizeof(VBVAINFOSCREEN), 216 HGSMI_CH_VBVA, 217 VBVA_INFO_SCREEN); 218 if (!pScreen != NULL) 218 219 { 219 220 WARN(("VBoxHGSMIBufferAlloc failed")); 220 221 221 return VERR_OUT_OF_RESOURCES; 222 222 } 223 224 VBVAINFOSCREEN *pScreen = (VBVAINFOSCREEN *)p;225 223 226 224 int rc = vboxWddmScreenInfoInit(pScreen, pAllocData, pVScreenPos, fFlags); 227 225 if (RT_SUCCESS(rc)) 228 226 { 229 pScreen->u32StartOffset 230 231 rc = VBoxHGSMIBufferSubmit (&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, p);227 pScreen->u32StartOffset = 0; //(uint32_t)offVram; /* we pretend the view is located at the start of each framebuffer */ 228 229 rc = VBoxHGSMIBufferSubmit(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, pScreen); 232 230 if (RT_FAILURE(rc)) 233 231 WARN(("VBoxHGSMIBufferSubmit failed %d", rc)); … … 236 234 WARN(("VBoxHGSMIBufferSubmit failed %d", rc)); 237 235 238 VBoxHGSMIBufferFree (&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, p);236 VBoxHGSMIBufferFree(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, pScreen); 239 237 240 238 return rc; … … 251 249 252 250 /* Issue the screen info command. */ 253 void *p = VBoxHGSMIBufferAlloc (&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, 254 sizeof (VBVAINFOVIEW), 255 HGSMI_CH_VBVA, 256 VBVA_INFO_VIEW); 257 if (!p) 251 VBVAINFOVIEW RT_UNTRUSTED_VOLATILE_HOST *pView = 252 (VBVAINFOVIEW RT_UNTRUSTED_VOLATILE_HOST *)VBoxHGSMIBufferAlloc(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, 253 sizeof(VBVAINFOVIEW), HGSMI_CH_VBVA, VBVA_INFO_VIEW); 254 if (!pView) 258 255 { 259 256 WARN(("VBoxHGSMIBufferAlloc failed")); 260 257 return VERR_OUT_OF_RESOURCES; 261 258 } 262 263 VBVAINFOVIEW *pView = (VBVAINFOVIEW *)p;264 265 259 pView->u32ViewIndex = pAllocData->SurfDesc.VidPnSourceId; 266 260 pView->u32ViewOffset = (uint32_t)offVram; /* we pretend the view is located at the start of each framebuffer */ 267 261 pView->u32ViewSize = vboxWddmVramCpuVisibleSegmentSize(pDevExt)/VBoxCommonFromDeviceExt(pDevExt)->cDisplays; 268 269 262 pView->u32MaxScreenSize = pView->u32ViewSize; 270 263 271 int rc = VBoxHGSMIBufferSubmit (&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, p );264 int rc = VBoxHGSMIBufferSubmit (&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, pView); 272 265 if (RT_FAILURE(rc)) 273 266 WARN(("VBoxHGSMIBufferSubmit failed %d", rc)); 274 267 275 VBoxHGSMIBufferFree (&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, p); 276 268 VBoxHGSMIBufferFree(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, pView); 277 269 return rc; 278 270 } … … 1561 1553 1562 1554 uint16_t chInfo; 1563 uint8_t *pvCmd = HGSMIBufferDataAndChInfoFromOffset (&VBoxCommonFromDeviceExt(pDevExt)->guestCtx.heapCtx.Heap.area, offCmd, &chInfo); 1555 uint8_t RT_UNTRUSTED_VOLATILE_HOST *pvCmd = 1556 HGSMIBufferDataAndChInfoFromOffset(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx.heapCtx.Heap.area, offCmd, &chInfo); 1564 1557 if (!pvCmd) 1565 1558 { … … 1572 1565 case VBVA_CMDVBVA_CTL: 1573 1566 { 1574 int rc = VBoxSHGSMICommandProcessCompletion (&VBoxCommonFromDeviceExt(pDevExt)->guestCtx.heapCtx, (VBOXSHGSMIHEADER*)pvCmd, TRUE /*bool bIrq*/ , &CtlList); 1567 int rc = VBoxSHGSMICommandProcessCompletion(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx.heapCtx, 1568 (VBOXSHGSMIHEADER *)pvCmd, TRUE /*bool bIrq*/ , &CtlList); 1575 1569 AssertRC(rc); 1576 1570 break; … … 1718 1712 { 1719 1713 uint16_t chInfo; 1720 uint8_t *pvCmd = HGSMIBufferDataAndChInfoFromOffset(&pHeap->Heap.area, offCmd, &chInfo); 1714 uint8_t RT_UNTRUSTED_VOLATILE_GUEST *pvCmd = 1715 HGSMIBufferDataAndChInfoFromOffset(&pHeap->Heap.area, offCmd, &chInfo); 1721 1716 Assert(pvCmd); 1722 1717 if (pvCmd) … … 3962 3957 } 3963 3958 UINT cbCmd = VBOXVDMACMD_SIZE(VBOXVDMACMD_DMA_BPB_TRANSFER); 3964 PVBOXVDMACBUF_DR pDr = vboxVdmaCBufDrCreate(&pDevExt->u.primary.Vdma, cbCmd);3959 VBOXVDMACBUF_DR RT_UNTRUSTED_VOLATILE_HOST *pDr = vboxVdmaCBufDrCreate(&pDevExt->u.primary.Vdma, cbCmd); 3965 3960 Assert(pDr); 3966 3961 if (pDr) -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.h
r71323 r71590 164 164 } 165 165 166 DECLINLINE(int) vboxWddmScreenInfoInit(VBVAINFOSCREEN *pScreen, const VBOXWDDM_ALLOC_DATA *pAllocData, const POINT * pVScreenPos, uint16_t fFlags) 166 DECLINLINE(int) vboxWddmScreenInfoInit(VBVAINFOSCREEN RT_UNTRUSTED_VOLATILE_HOST *pScreen, 167 const VBOXWDDM_ALLOC_DATA *pAllocData, const POINT * pVScreenPos, uint16_t fFlags) 167 168 { 168 169 VBOXVIDEOOFFSET offVram = vboxWddmAddrFramOffset(&pAllocData->Addr); -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/xpdm/VBoxMPInternal.cpp
r69500 r71590 452 452 453 453 static DECLCALLBACK(int) 454 VBoxVbvaChannelGenericHandlerCB(void *pvHandler, uint16_t u16ChannelInfo, void *pvBuffer, HGSMISIZE cbBuffer) 454 VBoxVbvaChannelGenericHandlerCB(void *pvHandler, uint16_t u16ChannelInfo, 455 void RT_UNTRUSTED_VOLATILE_HOST *pvBuffer, HGSMISIZE cbBuffer) 455 456 { 456 457 VBVA_CHANNELCONTEXTS *pCallbacks = (VBVA_CHANNELCONTEXTS*)pvHandler; -
trunk/src/VBox/Additions/common/VBoxVideo/HGSMIBase.cpp
r69309 r71590 60 60 DECLHIDDEN(int) VBoxHGSMIReportFlagsLocation(PHGSMIGUESTCOMMANDCONTEXT pCtx, HGSMIOFFSET offLocation) 61 61 { 62 HGSMIBUFFERLOCATION *p; 63 64 /* Allocate the IO buffer. */65 p = (HGSMIBUFFERLOCATION*)VBoxHGSMIBufferAlloc(pCtx, sizeof(*p), HGSMI_CH_HGSMI,66 HGSMI_CC_HOST_FLAGS_LOCATION);62 63 /* Allocate the IO buffer. */ 64 HGSMIBUFFERLOCATION RT_UNTRUSTED_VOLATILE_HOST *p = 65 (HGSMIBUFFERLOCATION RT_UNTRUSTED_VOLATILE_HOST *)VBoxHGSMIBufferAlloc(pCtx, sizeof(*p), HGSMI_CH_HGSMI, 66 HGSMI_CC_HOST_FLAGS_LOCATION); 67 67 if (!p) 68 68 return VERR_NO_MEMORY; … … 90 90 DECLHIDDEN(int) VBoxHGSMISendCapsInfo(PHGSMIGUESTCOMMANDCONTEXT pCtx, uint32_t fCaps) 91 91 { 92 VBVACAPS *p; 93 94 /* Allocate the IO buffer. */95 p = (VBVACAPS*)VBoxHGSMIBufferAlloc(pCtx, sizeof(*p), HGSMI_CH_VBVA, VBVA_INFO_CAPS);92 93 /* Allocate the IO buffer. */ 94 VBVACAPS RT_UNTRUSTED_VOLATILE_HOST *p = 95 (VBVACAPS RT_UNTRUSTED_VOLATILE_HOST *)VBoxHGSMIBufferAlloc(pCtx, sizeof(*p), HGSMI_CH_VBVA, VBVA_INFO_CAPS); 96 96 97 97 if (!p) -
trunk/src/VBox/Additions/common/VBoxVideo/HGSMIBuffers.cpp
r69309 r71590 72 72 * @param u16Op the HGSMI command to be sent, set to the descriptor 73 73 */ 74 DECLHIDDEN(void *) VBoxHGSMIBufferAlloc(PHGSMIGUESTCOMMANDCONTEXT pCtx,75 HGSMISIZE cbData,76 uint8_t u8Ch,77 uint16_t u16Op)74 DECLHIDDEN(void RT_UNTRUSTED_VOLATILE_HOST *) VBoxHGSMIBufferAlloc(PHGSMIGUESTCOMMANDCONTEXT pCtx, 75 HGSMISIZE cbData, 76 uint8_t u8Ch, 77 uint16_t u16Op) 78 78 { 79 79 #ifdef VBOX_WDDM_MINIPORT 80 return VBoxSHGSMIHeapAlloc 80 return VBoxSHGSMIHeapAlloc(&pCtx->heapCtx, cbData, u8Ch, u16Op); 81 81 #else 82 return HGSMIHeapAlloc 82 return HGSMIHeapAlloc(&pCtx->heapCtx, cbData, u8Ch, u16Op); 83 83 #endif 84 84 } … … 91 91 * @param pvBuffer the pointer returned by @a VBoxHGSMIBufferAlloc 92 92 */ 93 DECLHIDDEN(void) VBoxHGSMIBufferFree(PHGSMIGUESTCOMMANDCONTEXT pCtx, 94 void *pvBuffer) 93 DECLHIDDEN(void) VBoxHGSMIBufferFree(PHGSMIGUESTCOMMANDCONTEXT pCtx, void RT_UNTRUSTED_VOLATILE_HOST *pvBuffer) 95 94 { 96 95 #ifdef VBOX_WDDM_MINIPORT 97 VBoxSHGSMIHeapFree 96 VBoxSHGSMIHeapFree(&pCtx->heapCtx, pvBuffer); 98 97 #else 99 HGSMIHeapFree 98 HGSMIHeapFree(&pCtx->heapCtx, pvBuffer); 100 99 #endif 101 100 } … … 107 106 * @param pvBuffer the pointer returned by @a VBoxHGSMIBufferAlloc 108 107 */ 109 DECLHIDDEN(int) VBoxHGSMIBufferSubmit(PHGSMIGUESTCOMMANDCONTEXT pCtx, 110 void *pvBuffer) 108 DECLHIDDEN(int) VBoxHGSMIBufferSubmit(PHGSMIGUESTCOMMANDCONTEXT pCtx, void RT_UNTRUSTED_VOLATILE_HOST *pvBuffer) 111 109 { 112 110 /* Initialize the buffer and get the offset for port IO. */ 113 HGSMIOFFSET offBuffer = HGSMIHeapBufferOffset 111 HGSMIOFFSET offBuffer = HGSMIHeapBufferOffset(HGSMIGUESTCMDHEAP_GET(&pCtx->heapCtx), pvBuffer); 114 112 115 113 Assert(offBuffer != HGSMIOFFSET_VOID); -
trunk/src/VBox/Additions/common/VBoxVideo/HGSMIHostCmd.cpp
r69309 r71590 76 76 * be completed 77 77 */ 78 DECLHIDDEN(void) VBoxHGSMIHostCmdComplete(PHGSMIHOSTCOMMANDCONTEXT pCtx, 79 void *pvMem) 80 { 81 HGSMIBUFFERHEADER *pHdr = HGSMIBufferHeaderFromData(pvMem); 78 DECLHIDDEN(void) VBoxHGSMIHostCmdComplete(PHGSMIHOSTCOMMANDCONTEXT pCtx, void RT_UNTRUSTED_VOLATILE_HOST *pvMem) 79 { 80 HGSMIBUFFERHEADER RT_UNTRUSTED_VOLATILE_GUEST *pHdr = HGSMIBufferHeaderFromData(pvMem); 82 81 HGSMIOFFSET offMem = HGSMIPointerToOffset(&pCtx->areaCtx, pHdr); 83 82 Assert(offMem != HGSMIOFFSET_VOID); 84 if(offMem != HGSMIOFFSET_VOID) 85 { 83 if (offMem != HGSMIOFFSET_VOID) 86 84 HGSMINotifyHostCmdComplete(pCtx, offMem); 87 }88 85 } 89 86 -
trunk/src/VBox/Additions/common/VBoxVideo/Modesetting.cpp
r71488 r71590 152 152 int rc; 153 153 /* Issue the screen info command. */ 154 void *p = VBoxHGSMIBufferAlloc(pCtx, sizeof(VBVAINFOVIEW) * u32Count,155 HGSMI_CH_VBVA, VBVA_INFO_VIEW);156 if (p)157 {158 VBVAINFOVIEW *pInfo = (VBVAINFOVIEW *)p;159 rc = pfnFill(pvData, pInfo, u32Count);154 VBVAINFOVIEW RT_UNTRUSTED_VOLATILE_HOST *pInfo = 155 (VBVAINFOVIEW RT_UNTRUSTED_VOLATILE_HOST *)VBoxHGSMIBufferAlloc(pCtx, sizeof(VBVAINFOVIEW) * u32Count, 156 HGSMI_CH_VBVA, VBVA_INFO_VIEW); 157 if (pInfo) 158 { 159 rc = pfnFill(pvData, (VBVAINFOVIEW *)pInfo /* lazy bird */, u32Count); 160 160 if (RT_SUCCESS(rc)) 161 VBoxHGSMIBufferSubmit (pCtx, p);162 VBoxHGSMIBufferFree(pCtx, p );161 VBoxHGSMIBufferSubmit(pCtx, pInfo); 162 VBoxHGSMIBufferFree(pCtx, pInfo); 163 163 } 164 164 else … … 294 294 { 295 295 /* Issue the screen info command. */ 296 void *p = VBoxHGSMIBufferAlloc(pCtx, 297 sizeof (VBVAINFOSCREEN), 298 HGSMI_CH_VBVA, 299 VBVA_INFO_SCREEN); 300 if (!p) 301 { 302 // LogFunc(("HGSMIHeapAlloc failed\n")); 303 } 304 else 305 { 306 VBVAINFOSCREEN *pScreen = (VBVAINFOSCREEN *)p; 307 296 VBVAINFOSCREEN RT_UNTRUSTED_VOLATILE_HOST *pScreen = 297 (VBVAINFOSCREEN RT_UNTRUSTED_VOLATILE_HOST *)VBoxHGSMIBufferAlloc(pCtx, sizeof(VBVAINFOSCREEN), 298 HGSMI_CH_VBVA, VBVA_INFO_SCREEN); 299 if (pScreen != NULL) 300 { 308 301 pScreen->u32ViewIndex = cDisplay; 309 302 pScreen->i32OriginX = cOriginX; … … 316 309 pScreen->u16Flags = fFlags; 317 310 318 VBoxHGSMIBufferSubmit(pCtx, p); 319 320 VBoxHGSMIBufferFree(pCtx, p); 311 VBoxHGSMIBufferSubmit(pCtx, pScreen); 312 313 VBoxHGSMIBufferFree(pCtx, pScreen); 314 } 315 else 316 { 317 // LogFunc(("HGSMIHeapAlloc failed\n")); 321 318 } 322 319 } … … 338 335 uint32_t cWidth, uint32_t cHeight) 339 336 { 340 int rc = VINF_SUCCESS;337 int rc; 341 338 VBVAREPORTINPUTMAPPING *p; 342 339 // Log(("%s: cOriginX=%d, cOriginY=%d, cWidth=%u, cHeight=%u\n", __PRETTY_FUNCTION__, (int)cOriginX, (int)cOriginX, … … 377 374 { 378 375 int rc; 379 void *p; 380 381 AssertPtr(paHints); 382 if (!VALID_PTR(paHints)) 383 return VERR_INVALID_POINTER; 384 385 p = VBoxHGSMIBufferAlloc(pCtx, sizeof(VBVAQUERYMODEHINTS) 386 + cScreens * sizeof(VBVAMODEHINT), 387 HGSMI_CH_VBVA, VBVA_QUERY_MODE_HINTS); 388 if (!p) 389 { 390 // LogFunc(("HGSMIHeapAlloc failed\n")); 391 return VERR_NO_MEMORY; 392 } 393 else 394 { 395 VBVAQUERYMODEHINTS *pQuery = (VBVAQUERYMODEHINTS *)p; 396 376 VBVAQUERYMODEHINTS RT_UNTRUSTED_VOLATILE_HOST *pQuery; 377 378 AssertPtrReturn(paHints, VERR_INVALID_POINTER); 379 pQuery = (VBVAQUERYMODEHINTS RT_UNTRUSTED_VOLATILE_HOST *)VBoxHGSMIBufferAlloc(pCtx, 380 sizeof(VBVAQUERYMODEHINTS) 381 + cScreens * sizeof(VBVAMODEHINT), 382 HGSMI_CH_VBVA, VBVA_QUERY_MODE_HINTS); 383 if (pQuery != NULL) 384 { 397 385 pQuery->cHintsQueried = cScreens; 398 386 pQuery->cbHintStructureGuest = sizeof(VBVAMODEHINT); 399 387 pQuery->rc = VERR_NOT_SUPPORTED; 400 388 401 VBoxHGSMIBufferSubmit(pCtx, p );389 VBoxHGSMIBufferSubmit(pCtx, pQuery); 402 390 rc = pQuery->rc; 403 391 if (RT_SUCCESS(rc)) 404 memcpy(paHints, ((uint8_t *)p) + sizeof(VBVAQUERYMODEHINTS), 405 cScreens * sizeof(VBVAMODEHINT)); 406 407 VBoxHGSMIBufferFree(pCtx, p); 392 memcpy(paHints, (void *)(pQuery + 1), cScreens * sizeof(VBVAMODEHINT)); 393 394 VBoxHGSMIBufferFree(pCtx, pQuery); 395 } 396 else 397 { 398 // LogFunc(("HGSMIHeapAlloc failed\n")); 399 rc = VERR_NO_MEMORY; 408 400 } 409 401 return rc; -
trunk/src/VBox/Additions/common/VBoxVideo/VBVABase.cpp
r69309 r71590 56 56 57 57 58 static bool vboxVBVAInformHost(PVBVABUFFERCONTEXT pCtx, 59 PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, 60 int32_t cScreen, bool bEnable) 61 { 62 bool bRc = false; 58 static bool vboxVBVAInformHost(PVBVABUFFERCONTEXT pCtx, PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, int32_t cScreen, bool fEnable) 59 { 60 bool fRc = false; 63 61 64 62 #if 0 /* All callers check this */ … … 66 64 #endif 67 65 { 68 void *p = VBoxHGSMIBufferAlloc(pHGSMICtx, 69 sizeof (VBVAENABLE_EX), 70 HGSMI_CH_VBVA, 71 VBVA_ENABLE); 72 if (!p) 73 { 74 // LogFunc(("HGSMIHeapAlloc failed\n")); 75 } 76 else 77 { 78 VBVAENABLE_EX *pEnable = (VBVAENABLE_EX *)p; 79 80 pEnable->Base.u32Flags = bEnable? VBVA_F_ENABLE: VBVA_F_DISABLE; 66 VBVAENABLE_EX RT_UNTRUSTED_VOLATILE_HOST *pEnable = 67 (VBVAENABLE_EX RT_UNTRUSTED_VOLATILE_HOST *)VBoxHGSMIBufferAlloc(pHGSMICtx, sizeof(VBVAENABLE_EX), 68 HGSMI_CH_VBVA, VBVA_ENABLE); 69 if (pEnable != NULL) 70 { 71 pEnable->Base.u32Flags = fEnable ? VBVA_F_ENABLE : VBVA_F_DISABLE; 81 72 pEnable->Base.u32Offset = pCtx->offVRAMBuffer; 82 73 pEnable->Base.i32Result = VERR_NOT_SUPPORTED; … … 87 78 } 88 79 89 VBoxHGSMIBufferSubmit(pHGSMICtx, p); 90 91 if (bEnable) 92 { 93 bRc = RT_SUCCESS(pEnable->Base.i32Result); 94 } 80 VBoxHGSMIBufferSubmit(pHGSMICtx, pEnable); 81 82 if (fEnable) 83 fRc = RT_SUCCESS(pEnable->Base.i32Result); 95 84 else 96 { 97 bRc = true; 98 } 99 100 VBoxHGSMIBufferFree(pHGSMICtx, p); 101 } 102 } 103 104 return bRc; 85 fRc = true; 86 87 VBoxHGSMIBufferFree(pHGSMICtx, pEnable); 88 } 89 else 90 { 91 // LogFunc(("HGSMIHeapAlloc failed\n")); 92 } 93 } 94 95 return fRc; 105 96 } 106 97 … … 112 103 VBVABUFFER *pVBVA, int32_t cScreen) 113 104 { 114 bool bRc = false;105 bool fRc = false; 115 106 116 107 // LogFlowFunc(("pVBVA %p\n", pVBVA)); … … 136 127 pCtx->pVBVA = pVBVA; 137 128 138 bRc = vboxVBVAInformHost(pCtx, pHGSMICtx, cScreen, true);139 } 140 141 if (! bRc)129 fRc = vboxVBVAInformHost(pCtx, pHGSMICtx, cScreen, true); 130 } 131 132 if (!fRc) 142 133 { 143 134 VBoxVBVADisable(pCtx, pHGSMICtx, cScreen); 144 135 } 145 136 146 return bRc;137 return fRc; 147 138 } 148 139 … … 158 149 159 150 vboxVBVAInformHost(pCtx, pHGSMICtx, cScreen, false); 160 161 return;162 151 } 163 152 … … 165 154 PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx) 166 155 { 167 bool bRc = false;156 bool fRc = false; 168 157 169 158 // LogFunc(("flags = 0x%08X\n", pCtx->pVBVA? pCtx->pVBVA->u32HostEvents: -1)); … … 205 194 pCtx->pRecord = pRecord; 206 195 207 bRc = true;208 } 209 } 210 211 return bRc;196 fRc = true; 197 } 198 } 199 200 return fRc; 212 201 } 213 202 … … 228 217 pCtx->fHwBufferOverflow = false; 229 218 pCtx->pRecord = NULL; 230 231 return;232 219 } 233 220 … … 245 232 { 246 233 /* Issue the flush command. */ 247 void *p = VBoxHGSMIBufferAlloc(pCtx, 248 sizeof (VBVAFLUSH), 249 HGSMI_CH_VBVA, 250 VBVA_FLUSH); 251 if (!p) 234 VBVAFLUSH RT_UNTRUSTED_VOLATILE_HOST *pFlush = 235 (VBVAFLUSH RT_UNTRUSTED_VOLATILE_HOST * )VBoxHGSMIBufferAlloc(pCtx, sizeof(VBVAFLUSH), HGSMI_CH_VBVA, VBVA_FLUSH); 236 if (pFlush != NULL) 237 { 238 pFlush->u32Reserved = 0; 239 240 VBoxHGSMIBufferSubmit(pCtx, pFlush); 241 242 VBoxHGSMIBufferFree(pCtx, pFlush); 243 } 244 else 252 245 { 253 246 // LogFunc(("HGSMIHeapAlloc failed\n")); 254 247 } 255 else256 {257 VBVAFLUSH *pFlush = (VBVAFLUSH *)p;258 259 pFlush->u32Reserved = 0;260 261 VBoxHGSMIBufferSubmit(pCtx, p);262 263 VBoxHGSMIBufferFree(pCtx, p);264 }265 266 return;267 248 } 268 249 … … 286 267 memcpy (&pVBVA->au8Data[0], (uint8_t *)p + u32BytesTillBoundary, i32Diff); 287 268 } 288 289 return;290 269 } 291 270 -
trunk/src/VBox/Additions/x11/vboxvideo/HGSMIMemAlloc.h
r69346 r71590 48 48 49 49 int HGSMIMAInit(HGSMIMADATA *pMA, const HGSMIAREA *pArea, 50 HGSMIOFFSET *paDescriptors, uint32_t cDescriptors, HGSMISIZE cbMaxBlock,51 const HGSMIENV *pEnv);50 HGSMIOFFSET *paDescriptors, uint32_t cDescriptors, 51 HGSMISIZE cbMaxBlock, const HGSMIENV *pEnv); 52 52 void HGSMIMAUninit(HGSMIMADATA *pMA); 53 53 54 void *HGSMIMAAlloc(HGSMIMADATA *pMA, HGSMISIZE cb);55 void HGSMIMAFree(HGSMIMADATA *pMA, void *pv);54 void RT_UNTRUSTED_VOLATILE_GUEST *HGSMIMAAlloc(HGSMIMADATA *pMA, HGSMISIZE cb); 55 void HGSMIMAFree(HGSMIMADATA *pMA, void RT_UNTRUSTED_VOLATILE_GUEST *pv); 56 56 57 57 RT_C_DECLS_END -
trunk/src/VBox/Additions/x11/vboxvideo/VBoxVideoIPRT.h
r69346 r71590 94 94 } while (0) 95 95 # define AssertPtr assert 96 # define AssertPtrReturn(pv, rcRet) do { assert(pv); if (pv) {} else return(rcRet); } while(0) 96 97 # define AssertRC(expr) assert (!expr) 97 98 #else … … 99 100 # define AssertFailed() do { } while(0) 100 101 # define AssertMsg(expr, msg) do { } while(0) 101 # define AssertPtr(expr) do { } while(0) 102 # define AssertPtr(ptr) do { } while(0) 103 # define AssertPtrReturn(pv, rcRet) do { if (pv) {} else return(rcRet); } while(0) 102 104 # define AssertRC(expr) do { } while(0) 103 105 #endif … … 136 138 # define UINT32_C(Value) (Value ## U) 137 139 #endif 140 #define RT_UNTRUSTED_GUEST 141 #define RT_UNTRUSTED_VOLATILE_GUEST volatile 142 #define RT_UNTRUSTED_HOST 143 #define RT_UNTRUSTED_VOLATILE_HOST volatile 144 #define RT_UNTRUSTED_HSTGST 145 #define RT_UNTRUSTED_VOLATILE_HSTGST volatile 138 146 139 147 #define likely _X_LIKELY -
trunk/src/VBox/Additions/x11/vboxvideo/hgsmimemalloc.c
r69346 r71590 35 35 * submit and free pattern, we replace the generic allocator with a simple 36 36 * Boolean. Need more be said? 37 * 38 * bird> Yes, it's buggy. You never set fAllocated. See HGSMIMAAlloc(). 37 39 */ 38 40 … … 64 66 } 65 67 66 static HGSMIOFFSET HGSMIMAPointerToOffset(const HGSMIMADATA *pMA, const void *pv)68 static HGSMIOFFSET HGSMIMAPointerToOffset(const HGSMIMADATA *pMA, const void RT_UNTRUSTED_VOLATILE_GUEST *pv) 67 69 { 68 70 if (HGSMIAreaContainsPointer(&pMA->area, pv)) 69 {70 71 return HGSMIPointerToOffset(&pMA->area, pv); 71 }72 72 73 73 AssertFailed(); … … 75 75 } 76 76 77 static void *HGSMIMAOffsetToPointer(const HGSMIMADATA *pMA, HGSMIOFFSET off)77 static void RT_UNTRUSTED_VOLATILE_GUEST *HGSMIMAOffsetToPointer(const HGSMIMADATA *pMA, HGSMIOFFSET off) 78 78 { 79 79 if (HGSMIAreaContainsOffset(&pMA->area, off)) 80 {81 80 return HGSMIOffsetToPointer(&pMA->area, off); 82 }83 81 84 82 AssertFailed(); … … 86 84 } 87 85 88 void *HGSMIMAAlloc(HGSMIMADATA *pMA, HGSMISIZE cb)86 void RT_UNTRUSTED_VOLATILE_GUEST *HGSMIMAAlloc(HGSMIMADATA *pMA, HGSMISIZE cb) 89 87 { 90 88 (void)cb; … … 93 91 HGSMIOFFSET off = pMA->area.offBase; 94 92 return HGSMIMAOffsetToPointer(pMA, off); 95 pMA->fAllocated = true; 93 pMA->fAllocated = true; /** @todo r=bird: Errr. what's this doing *after* the return statement? */ 96 94 } 97 95 98 void HGSMIMAFree(HGSMIMADATA *pMA, void *pv)96 void HGSMIMAFree(HGSMIMADATA *pMA, void RT_UNTRUSTED_VOLATILE_GUEST *pv) 99 97 { 100 98 HGSMIOFFSET off = HGSMIMAPointerToOffset(pMA, pv); 101 99 if (off != HGSMIOFFSET_VOID) 102 {103 100 pMA->fAllocated = false; 104 }105 101 else 106 {107 102 AssertFailed(); 108 }109 103 } 104 -
trunk/src/VBox/Devices/Graphics/DevVGA.h
r71146 r71590 204 204 { 205 205 RTLISTNODE Node; 206 PVBOXVHWACMDpCommand;206 VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCommand; 207 207 } VBOX_VHWA_PENDINGCMD; 208 208 #endif … … 521 521 void VBVARaiseIrq(PVGASTATE pVGAState, uint32_t fFlags); 522 522 523 int VBVAInfoView(PVGASTATE pVGAState, const VBVAINFOVIEW *pView);524 int VBVAInfoScreen(PVGASTATE pVGAState, const VBVAINFOSCREEN *pScreen);523 int VBVAInfoView(PVGASTATE pVGAState, const VBVAINFOVIEW RT_UNTRUSTED_VOLATILE_HOST *pView); 524 int VBVAInfoScreen(PVGASTATE pVGAState, const VBVAINFOSCREEN RT_UNTRUSTED_VOLATILE_HOST *pScreen); 525 525 int VBVAGetInfoViewAndScreen(PVGASTATE pVGAState, uint32_t u32ViewIndex, VBVAINFOVIEW *pView, VBVAINFOSCREEN *pScreen); 526 526 … … 531 531 532 532 # ifdef VBOX_WITH_VIDEOHWACCEL 533 DECLCALLBACK(int) vbvaVHWACommandCompleteAsync(PPDMIDISPLAYVBVACALLBACKS pInterface, PVBOXVHWACMDpCmd);533 DECLCALLBACK(int) vbvaVHWACommandCompleteAsync(PPDMIDISPLAYVBVACALLBACKS pInterface, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCmd); 534 534 int vbvaVHWAConstruct(PVGASTATE pVGAState); 535 535 int vbvaVHWAReset(PVGASTATE pVGAState); … … 577 577 void vboxVDMADestruct(PVBOXVDMAHOST pVdma); 578 578 void vboxVDMAReset(PVBOXVDMAHOST pVdma); 579 void vboxVDMAControl(PVBOXVDMAHOST pVdma, PVBOXVDMA_CTLpCmd, uint32_t cbCmd);580 void vboxVDMACommand(PVBOXVDMAHOST pVdma, PVBOXVDMACBUF_DRpCmd, uint32_t cbCmd);579 void vboxVDMAControl(PVBOXVDMAHOST pVdma, VBOXVDMA_CTL RT_UNTRUSTED_VOLATILE_GUEST *pCmd, uint32_t cbCmd); 580 void vboxVDMACommand(PVBOXVDMAHOST pVdma, VBOXVDMACBUF_DR RT_UNTRUSTED_VOLATILE_GUEST *pCmd, uint32_t cbCmd); 581 581 int vboxVDMASaveStateExecPrep(struct VBOXVDMAHOST *pVdma); 582 582 int vboxVDMASaveStateExecDone(struct VBOXVDMAHOST *pVdma); … … 589 589 int vboxCmdVBVACmdSubmit(PVGASTATE pVGAState); 590 590 int vboxCmdVBVACmdFlush(PVGASTATE pVGAState); 591 int vboxCmdVBVACmdCtl(PVGASTATE pVGAState, VBOXCMDVBVA_CTL *pCtl, uint32_t cbCtl);591 int vboxCmdVBVACmdCtl(PVGASTATE pVGAState, VBOXCMDVBVA_CTL RT_UNTRUSTED_VOLATILE_GUEST *pCtl, uint32_t cbCtl); 592 592 void vboxCmdVBVATimerRefresh(PVGASTATE pVGAState); 593 593 bool vboxCmdVBVAIsEnabled(PVGASTATE pVGAState); -
trunk/src/VBox/Devices/Graphics/DevVGA_VBVA.cpp
r70604 r71590 726 726 } 727 727 728 static int vbvaMousePointerShape(PVGASTATE pVGAState, VBVACONTEXT *pCtx, const VBVAMOUSEPOINTERSHAPE *pShape, HGSMISIZE cbShape) 729 { 730 const VBVAMOUSEPOINTERSHAPE parms = *pShape; 728 static int vbvaMousePointerShape(PVGASTATE pVGAState, VBVACONTEXT *pCtx, 729 const VBVAMOUSEPOINTERSHAPE RT_UNTRUSTED_VOLATILE_GUEST *pShape, HGSMISIZE cbShape) 730 { 731 VBVAMOUSEPOINTERSHAPE parms; 732 memcpy(&parms, (void *)pShape, sizeof(parms)); 731 733 ASMCompilerBarrier(); 732 734 … … 794 796 if (pCtx->mouseShapeInfo.pu8Shape) 795 797 { 796 memcpy(pCtx->mouseShapeInfo.pu8Shape, &pShape->au8Data[0], cbPointerData);798 memcpy(pCtx->mouseShapeInfo.pu8Shape, (void *)&pShape->au8Data[0], cbPointerData); 797 799 pCtx->mouseShapeInfo.cbShape = cbPointerData; 798 800 } … … 804 806 } 805 807 806 static uint32_t vbvaViewFromBufferPtr(PHGSMIINSTANCE pIns, const VBVACONTEXT *pCtx, const void *pvBuffer) 808 static uint32_t vbvaViewFromBufferPtr(PHGSMIINSTANCE pIns, const VBVACONTEXT *pCtx, 809 const void RT_UNTRUSTED_VOLATILE_GUEST *pvBuffer) 807 810 { 808 811 /* Check which view contains the buffer. */ … … 904 907 } 905 908 906 static void vbvaVHWACommandComplete(PVGASTATE pVGAState, PVBOXVHWACMDpCommand, bool fAsyncCommand)909 static void vbvaVHWACommandComplete(PVGASTATE pVGAState, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCommand, bool fAsyncCommand) 907 910 { 908 911 if (fAsyncCommand) … … 959 962 } 960 963 961 static void vbvaVHWACommandPend(PVGASTATE pVGAState, PVBOXVHWACMDpCommand)964 static void vbvaVHWACommandPend(PVGASTATE pVGAState, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCommand) 962 965 { 963 966 int rc = VERR_BUFFER_OVERFLOW; … … 995 998 } 996 999 997 static bool vbvaVHWACommandCanPend( PVBOXVHWACMD pCommand)998 { 999 switch ( pCommand->enmCmd)1000 static bool vbvaVHWACommandCanPend(VBOXVHWACMD_TYPE enmCmd) 1001 { 1002 switch (enmCmd) 1000 1003 { 1001 1004 case VBOXVHWACMD_TYPE_HH_CONSTRUCT: … … 1037 1040 rc = SSMR3GetU32(pSSM, &off32); 1038 1041 AssertRCReturn(rc, rc); 1039 PVBOXVHWACMD pCommand = (PVBOXVHWACMD)((uint8_t *)pVGAState->vram_ptrR3 + off32); 1042 VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCommand 1043 = (VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *)((uint8_t volatile *)pVGAState->vram_ptrR3 + off32); 1040 1044 vbvaVHWACommandPend(pVGAState, pCommand); 1041 1045 } … … 1044 1048 1045 1049 1046 static bool vbvaVHWACommandSubmit(PVGASTATE pVGAState, PVBOXVHWACMD pCommand, bool fAsyncCommand) 1047 { 1050 static bool vbvaVHWACommandSubmit(PVGASTATE pVGAState, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCommand, bool fAsyncCommand) 1051 { 1052 VBOXVHWACMD_TYPE enmCmd = pCommand->enmCmd; 1053 ASMCompilerBarrier(); 1054 1048 1055 bool fPend = false; 1049 1050 1056 if (pVGAState->pDrv->pfnVHWACommandProcess) 1051 1057 { 1052 Log(("VGA Command >>> %#p, %d\n", pCommand, pCommand->enmCmd));1053 int rc = pVGAState->pDrv->pfnVHWACommandProcess(pVGAState->pDrv, pCommand);1058 Log(("VGA Command >>> %#p, %d\n", pCommand, enmCmd)); 1059 int rc = pVGAState->pDrv->pfnVHWACommandProcess(pVGAState->pDrv, enmCmd, pCommand); 1054 1060 if (rc == VINF_CALLBACK_RETURN) 1055 1061 { 1056 Log(("VGA Command --- Going Async %#p, %d\n", pCommand, pCommand->enmCmd));1062 Log(("VGA Command --- Going Async %#p, %d\n", pCommand, enmCmd)); 1057 1063 return true; /* command will be completed asynchronously, return right away */ 1058 1064 } 1059 1065 if (rc == VERR_INVALID_STATE) 1060 1066 { 1061 Log(("VGA Command --- Trying Pend %#p, %d\n", pCommand, pCommand->enmCmd));1062 fPend = vbvaVHWACommandCanPend( pCommand);1067 Log(("VGA Command --- Trying Pend %#p, %d\n", pCommand, enmCmd)); 1068 fPend = vbvaVHWACommandCanPend(enmCmd); 1063 1069 if (!fPend) 1064 1070 { 1065 Log(("VGA Command --- Can NOT Pend %#p, %d\n", pCommand, pCommand->enmCmd));1071 Log(("VGA Command --- Can NOT Pend %#p, %d\n", pCommand, enmCmd)); 1066 1072 pCommand->rc = rc; 1067 1073 } 1068 1074 else 1069 Log(("VGA Command --- Can Pend %#p, %d\n", pCommand, pCommand->enmCmd));1075 Log(("VGA Command --- Can Pend %#p, %d\n", pCommand, enmCmd)); 1070 1076 } 1071 1077 else 1072 1078 { 1073 Log(("VGA Command --- Going Complete Sync rc %d %#p, %d\n", rc, pCommand, pCommand->enmCmd));1079 Log(("VGA Command --- Going Complete Sync rc %d %#p, %d\n", rc, pCommand, enmCmd)); 1074 1080 pCommand->rc = rc; 1075 1081 } … … 1122 1128 vbvaVHWACheckPendingCommands(pVGAState); 1123 1129 } 1124 static void vbvaVHWAHandleCommand(PVGASTATE pVGAState, PVBOXVHWACMDpCmd)1130 static void vbvaVHWAHandleCommand(PVGASTATE pVGAState, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCmd) 1125 1131 { 1126 1132 if (vbvaVHWACheckPendingCommands(pVGAState)) … … 1342 1348 } 1343 1349 1344 DECLCALLBACK(int) vbvaVHWACommandCompleteAsync(PPDMIDISPLAYVBVACALLBACKS pInterface, PVBOXVHWACMDpCmd)1350 DECLCALLBACK(int) vbvaVHWACommandCompleteAsync(PPDMIDISPLAYVBVACALLBACKS pInterface, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCmd) 1345 1351 { 1346 1352 int rc; … … 1362 1368 #endif 1363 1369 { 1364 VBVAHOSTCMD *pHostCmd = NULL; /* Shut up MSC. */1370 VBVAHOSTCMD RT_UNTRUSTED_VOLATILE_GUEST *pHostCmd = NULL; /* Shut up MSC. */ 1365 1371 if (pCmd->Flags & VBOXVHWACMD_FLAG_GH_ASYNCH_EVENT) 1366 1372 { 1367 1373 rc = HGSMIHostCommandAlloc(pIns, 1368 (void **)&pHostCmd,1374 (void RT_UNTRUSTED_VOLATILE_GUEST **)&pHostCmd, 1369 1375 VBVAHOSTCMD_SIZE(sizeof(VBVAHOSTCMDEVENT)), 1370 1376 HGSMI_CH_VBVA, … … 1373 1379 if (RT_SUCCESS(rc)) 1374 1380 { 1375 memset( pHostCmd, 0 , VBVAHOSTCMD_SIZE(sizeof(VBVAHOSTCMDEVENT)));1381 memset((void *)pHostCmd, 0 , VBVAHOSTCMD_SIZE(sizeof(VBVAHOSTCMDEVENT))); 1376 1382 pHostCmd->iDstID = pCmd->iDisplay; 1377 1383 pHostCmd->customOpCode = 0; … … 1387 1393 { 1388 1394 rc = HGSMIHostCommandAlloc(pIns, 1389 (void **)&pHostCmd,1395 (void RT_UNTRUSTED_VOLATILE_GUEST **)&pHostCmd, 1390 1396 VBVAHOSTCMD_SIZE(sizeof(VBVAHOSTCMDVHWACMDCOMPLETE)), 1391 1397 HGSMI_CH_VBVA, … … 1394 1400 if (RT_SUCCESS(rc)) 1395 1401 { 1396 memset( pHostCmd, 0 , VBVAHOSTCMD_SIZE(sizeof(VBVAHOSTCMDVHWACMDCOMPLETE)));1402 memset((void *)pHostCmd, 0 , VBVAHOSTCMD_SIZE(sizeof(VBVAHOSTCMDVHWACMDCOMPLETE))); 1397 1403 pHostCmd->iDstID = pCmd->iDisplay; 1398 1404 pHostCmd->customOpCode = VBVAHG_DCUSTOM_VHWA_CMDCOMPLETE; … … 2105 2111 } 2106 2112 2107 static int vbvaHandleQueryConf32(PVGASTATE pVGAState, VBVACONF32 volatile*pConf32)2113 static int vbvaHandleQueryConf32(PVGASTATE pVGAState, VBVACONF32 RT_UNTRUSTED_VOLATILE_GUEST *pConf32) 2108 2114 { 2109 2115 int rc = VINF_SUCCESS; … … 2112 2118 2113 2119 const uint32_t u32Index = pConf32->u32Index; 2120 ASMCompilerBarrier(); 2114 2121 2115 2122 LogFlowFunc(("VBVA_QUERY_CONF32: u32Index %d, u32Value 0x%x\n", … … 2155 2162 } 2156 2163 2157 static int vbvaHandleSetConf32(PVGASTATE pVGAState, VBVACONF32 *pConf32)2164 static int vbvaHandleSetConf32(PVGASTATE pVGAState, VBVACONF32 RT_UNTRUSTED_VOLATILE_GUEST *pConf32) 2158 2165 { 2159 2166 NOREF(pVGAState); 2160 2167 2161 int rc = VINF_SUCCESS; 2162 const VBVACONF32 parms = *pConf32; 2168 VBVACONF32 parms; 2169 parms.u32Index = pConf32->u32Index; 2170 parms.u32Value = pConf32->u32Value; 2163 2171 ASMCompilerBarrier(); 2164 2172 … … 2166 2174 parms.u32Index, parms.u32Value)); 2167 2175 2176 int rc = VINF_SUCCESS; 2168 2177 if (parms.u32Index == VBOX_VBVA_CONF32_MONITOR_COUNT) 2169 2178 { … … 2184 2193 } 2185 2194 2186 static int vbvaHandleInfoHeap(PVGASTATE pVGAState, const VBVAINFOHEAP *pInfoHeap) 2187 { 2188 const VBVAINFOHEAP parms = *pInfoHeap; 2195 static int vbvaHandleInfoHeap(PVGASTATE pVGAState, const VBVAINFOHEAP RT_UNTRUSTED_VOLATILE_GUEST *pInfoHeap) 2196 { 2197 VBVAINFOHEAP parms; 2198 parms.u32HeapOffset = pInfoHeap->u32HeapOffset; 2199 parms.u32HeapSize = pInfoHeap->u32HeapSize; 2189 2200 ASMCompilerBarrier(); 2190 2201 LogFlowFunc(("VBVA_INFO_HEAP: offset 0x%x, size 0x%x\n", … … 2194 2205 } 2195 2206 2196 int VBVAInfoView(PVGASTATE pVGAState, const VBVAINFOVIEW *pView) 2197 { 2198 const VBVAINFOVIEW view = *pView; 2207 int VBVAInfoView(PVGASTATE pVGAState, const VBVAINFOVIEW RT_UNTRUSTED_VOLATILE_GUEST *pView) 2208 { 2209 VBVAINFOVIEW view; 2210 view.u32ViewIndex = pView->u32ViewIndex; 2211 view.u32ViewOffset = pView->u32ViewOffset; 2212 view.u32ViewSize = pView->u32ViewSize; 2213 view.u32MaxScreenSize = pView->u32MaxScreenSize; 2199 2214 ASMCompilerBarrier(); 2200 2215 … … 2221 2236 } 2222 2237 2223 int VBVAInfoScreen(PVGASTATE pVGAState, const VBVAINFOSCREEN *pScreen) 2224 { 2225 const VBVAINFOSCREEN screen = *pScreen; 2226 2238 int VBVAInfoScreen(PVGASTATE pVGAState, const VBVAINFOSCREEN RT_UNTRUSTED_VOLATILE_GUEST *pScreen) 2239 { 2240 VBVAINFOSCREEN screen; 2241 memcpy(&screen, (void *)pScreen, sizeof(screen)); 2242 ASMCompilerBarrier(); 2227 2243 LogRel(("VBVA: InfoScreen: [%d] @%d,%d %dx%d, line 0x%x, BPP %d, flags 0x%x\n", 2228 2244 screen.u32ViewIndex, screen.i32OriginX, screen.i32OriginY, … … 2425 2441 * @thread EMT 2426 2442 */ 2427 static DECLCALLBACK(int) vbvaChannelHandler(void *pvHandler, uint16_t u16ChannelInfo, void *pvBuffer, HGSMISIZE cbBuffer) 2443 static DECLCALLBACK(int) vbvaChannelHandler(void *pvHandler, uint16_t u16ChannelInfo, 2444 void RT_UNTRUSTED_VOLATILE_GUEST *pvBuffer, HGSMISIZE cbBuffer) 2428 2445 { 2429 2446 int rc = VINF_SUCCESS; … … 2449 2466 if (cbBuffer >= VBoxSHGSMIBufferHeaderSize() + sizeof(VBOXCMDVBVA_CTL)) 2450 2467 { 2451 VBOXCMDVBVA_CTL *pCtl = (VBOXCMDVBVA_CTL *)VBoxSHGSMIBufferData((PVBOXSHGSMIHEADER)pvBuffer); 2468 VBOXCMDVBVA_CTL RT_UNTRUSTED_VOLATILE_GUEST *pCtl; 2469 pCtl = (VBOXCMDVBVA_CTL RT_UNTRUSTED_VOLATILE_GUEST *)VBoxSHGSMIBufferData((VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_GUEST *)pvBuffer); 2452 2470 rc = vboxCmdVBVACmdCtl(pVGAState, pCtl, cbBuffer - VBoxSHGSMIBufferHeaderSize()); 2453 2471 } … … 2461 2479 if (cbBuffer >= VBoxSHGSMIBufferHeaderSize() + sizeof(VBOXVDMACBUF_DR)) 2462 2480 { 2463 PVBOXVDMACBUF_DR pCmd = (PVBOXVDMACBUF_DR)VBoxSHGSMIBufferData((PVBOXSHGSMIHEADER)pvBuffer); 2481 VBOXVDMACBUF_DR RT_UNTRUSTED_VOLATILE_GUEST *pCmd; 2482 pCmd = (VBOXVDMACBUF_DR RT_UNTRUSTED_VOLATILE_GUEST *)VBoxSHGSMIBufferData((VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_GUEST *)pvBuffer); 2464 2483 vboxVDMACommand(pVGAState->pVdma, pCmd, cbBuffer - VBoxSHGSMIBufferHeaderSize()); 2465 2484 rc = VINF_SUCCESS; … … 2472 2491 if (cbBuffer >= VBoxSHGSMIBufferHeaderSize() + sizeof(VBOXVDMA_CTL)) 2473 2492 { 2474 PVBOXVDMA_CTL pCmd = (PVBOXVDMA_CTL)VBoxSHGSMIBufferData((PVBOXSHGSMIHEADER)pvBuffer); 2493 VBOXVDMA_CTL RT_UNTRUSTED_VOLATILE_GUEST *pCmd; 2494 pCmd = (VBOXVDMA_CTL RT_UNTRUSTED_VOLATILE_GUEST *)VBoxSHGSMIBufferData((VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_GUEST *)pvBuffer); 2475 2495 vboxVDMAControl(pVGAState->pVdma, pCmd, cbBuffer - VBoxSHGSMIBufferHeaderSize()); 2476 2496 } … … 2482 2502 case VBVA_QUERY_CONF32: 2483 2503 if (cbBuffer >= sizeof(VBVACONF32)) 2484 rc = vbvaHandleQueryConf32(pVGAState, (VBVACONF32 *)pvBuffer);2504 rc = vbvaHandleQueryConf32(pVGAState, (VBVACONF32 RT_UNTRUSTED_VOLATILE_GUEST *)pvBuffer); 2485 2505 else 2486 2506 rc = VERR_INVALID_PARAMETER; … … 2489 2509 case VBVA_SET_CONF32: 2490 2510 if (cbBuffer >= sizeof(VBVACONF32)) 2491 rc = vbvaHandleSetConf32(pVGAState, (VBVACONF32 *)pvBuffer);2511 rc = vbvaHandleSetConf32(pVGAState, (VBVACONF32 RT_UNTRUSTED_VOLATILE_GUEST *)pvBuffer); 2492 2512 else 2493 2513 rc = VERR_INVALID_PARAMETER; … … 2503 2523 #endif 2504 2524 /* Guest submits an array of VBVAINFOVIEW structures. */ 2505 const VBVAINFOVIEW *pView = (VBVAINFOVIEW*)pvBuffer;2525 const VBVAINFOVIEW RT_UNTRUSTED_VOLATILE_GUEST *pView = (VBVAINFOVIEW RT_UNTRUSTED_VOLATILE_GUEST *)pvBuffer; 2506 2526 for (; 2507 2527 cbBuffer >= sizeof(VBVAINFOVIEW); … … 2517 2537 case VBVA_INFO_HEAP: 2518 2538 if (cbBuffer >= sizeof(VBVAINFOHEAP)) 2519 rc = vbvaHandleInfoHeap(pVGAState, (VBVAINFOHEAP *)pvBuffer);2539 rc = vbvaHandleInfoHeap(pVGAState, (VBVAINFOHEAP RT_UNTRUSTED_VOLATILE_GUEST *)pvBuffer); 2520 2540 else 2521 2541 rc = VERR_INVALID_PARAMETER; … … 2535 2555 #endif 2536 2556 if (cbBuffer >= sizeof(VBVAINFOSCREEN)) 2537 rc = VBVAInfoScreen(pVGAState, (VBVAINFOSCREEN *)pvBuffer);2557 rc = VBVAInfoScreen(pVGAState, (VBVAINFOSCREEN RT_UNTRUSTED_VOLATILE_GUEST *)pvBuffer); 2538 2558 break; 2539 2559 … … 2545 2565 if (cbBuffer >= sizeof(VBVAENABLE)) 2546 2566 { 2547 VBVAENABLE volatile *pVbvaEnable = (VBVAENABLE volatile*)pvBuffer;2567 VBVAENABLE RT_UNTRUSTED_VOLATILE_GUEST *pVbvaEnable = (VBVAENABLE RT_UNTRUSTED_VOLATILE_GUEST *)pvBuffer; 2548 2568 2549 2569 uint32_t u32ScreenId; … … 2552 2572 { 2553 2573 if (cbBuffer >= sizeof(VBVAENABLE_EX)) 2554 u32ScreenId = ((VBVAENABLE_EX volatile*)pvBuffer)->u32ScreenId;2574 u32ScreenId = ((VBVAENABLE_EX RT_UNTRUSTED_VOLATILE_GUEST *)pvBuffer)->u32ScreenId; 2555 2575 else 2556 2576 { … … 2570 2590 if (cbBuffer >= sizeof(VBVAMOUSEPOINTERSHAPE)) 2571 2591 { 2572 VBVAMOUSEPOINTERSHAPE *pShape = (VBVAMOUSEPOINTERSHAPE *)pvBuffer; 2592 VBVAMOUSEPOINTERSHAPE RT_UNTRUSTED_VOLATILE_GUEST *pShape; 2593 pShape = (VBVAMOUSEPOINTERSHAPE RT_UNTRUSTED_VOLATILE_GUEST *)pvBuffer; 2573 2594 rc = vbvaMousePointerShape(pVGAState, pCtx, pShape, cbBuffer); 2574 2595 pShape->i32Result = rc; … … 2583 2604 if (cbBuffer >= VBOXVHWACMD_HEADSIZE()) 2584 2605 { 2585 vbvaVHWAHandleCommand(pVGAState, ( PVBOXVHWACMD)pvBuffer);2606 vbvaVHWAHandleCommand(pVGAState, (VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *)pvBuffer); 2586 2607 rc = VINF_SUCCESS; 2587 2608 } … … 2595 2616 if (cbBuffer >= sizeof(VBVACAPS)) 2596 2617 { 2597 VBVACAPS volatile *pCaps = (VBVACAPS volatile*)pvBuffer;2618 VBVACAPS RT_UNTRUSTED_VOLATILE_GUEST *pCaps = (VBVACAPS RT_UNTRUSTED_VOLATILE_GUEST *)pvBuffer; 2598 2619 pVGAState->fGuestCaps = pCaps->fCaps; 2599 2620 pVGAState->pDrv->pfnVBVAGuestCapabilityUpdate(pVGAState->pDrv, pVGAState->fGuestCaps); … … 2608 2629 if (cbBuffer >= sizeof(VBVASCANLINECFG)) 2609 2630 { 2610 VBVASCANLINECFG volatile *pCfg = (VBVASCANLINECFG volatile*)pvBuffer;2631 VBVASCANLINECFG RT_UNTRUSTED_VOLATILE_GUEST *pCfg = (VBVASCANLINECFG RT_UNTRUSTED_VOLATILE_GUEST *)pvBuffer; 2611 2632 pVGAState->fScanLineCfg = pCfg->fFlags; 2612 2633 pCfg->rc = rc = VINF_SUCCESS; … … 2619 2640 if (cbBuffer >= sizeof(VBVAQUERYMODEHINTS)) 2620 2641 { 2621 VBVAQUERYMODEHINTS volatile *pQueryModeHints = (VBVAQUERYMODEHINTS volatile *)pvBuffer; 2642 VBVAQUERYMODEHINTS RT_UNTRUSTED_VOLATILE_GUEST *pQueryModeHints; 2643 pQueryModeHints = (VBVAQUERYMODEHINTS RT_UNTRUSTED_VOLATILE_GUEST *)pvBuffer; 2622 2644 rc = vbvaHandleQueryModeHints(pVGAState, pQueryModeHints, cbBuffer); 2623 2645 pQueryModeHints->rc = rc; … … 2630 2652 if (cbBuffer >= sizeof(VBVAREPORTINPUTMAPPING)) 2631 2653 { 2632 const VBVAREPORTINPUTMAPPING inputMapping = *(VBVAREPORTINPUTMAPPING *)pvBuffer; 2654 VBVAREPORTINPUTMAPPING inputMapping; 2655 { 2656 VBVAREPORTINPUTMAPPING RT_UNTRUSTED_VOLATILE_GUEST *pInputMapping 2657 = (VBVAREPORTINPUTMAPPING RT_UNTRUSTED_VOLATILE_GUEST *)pvBuffer; 2658 inputMapping.x = pInputMapping->x; 2659 inputMapping.y = pInputMapping->y; 2660 inputMapping.cx = pInputMapping->cx; 2661 inputMapping.cy = pInputMapping->cy; 2662 } 2633 2663 ASMCompilerBarrier(); 2664 2634 2665 LogRelFlowFunc(("VBVA: ChannelHandler: VBVA_REPORT_INPUT_MAPPING: x=%RI32, y=%RI32, cx=%RU32, cy=%RU32\n", 2635 2666 inputMapping.x, inputMapping.y, inputMapping.cx, inputMapping.cy)); … … 2646 2677 if (cbBuffer >= sizeof(VBVACURSORPOSITION)) 2647 2678 { 2648 VBVACURSORPOSITION volatile *pReport = (VBVACURSORPOSITION volatile *)pvBuffer; 2679 VBVACURSORPOSITION RT_UNTRUSTED_VOLATILE_GUEST *pReport = (VBVACURSORPOSITION RT_UNTRUSTED_VOLATILE_GUEST *)pvBuffer; 2680 VBVACURSORPOSITION Report; 2681 Report.fReportPosition = pReport->fReportPosition; 2682 Report.x = pReport->x; 2683 Report.y = pReport->y; 2684 ASMCompilerBarrier(); 2649 2685 2650 2686 LogRelFlowFunc(("VBVA: ChannelHandler: VBVA_CURSOR_POSITION: fReportPosition=%RTbool, x=%RU32, y=%RU32\n", 2651 RT_BOOL(pReport->fReportPosition), pReport->x, pReport->y)); 2652 2653 pVGAState->pDrv->pfnVBVAReportCursorPosition(pVGAState->pDrv, RT_BOOL(pReport->fReportPosition), 2654 pReport->x, pReport->y); 2687 RT_BOOL(Report.fReportPosition), Report.x, Report.y)); 2688 2689 pVGAState->pDrv->pfnVBVAReportCursorPosition(pVGAState->pDrv, RT_BOOL(Report.fReportPosition), Report.x, Report.y); 2655 2690 pReport->x = pCtx->xCursor; 2656 2691 pReport->y = pCtx->yCursor; -
trunk/src/VBox/Devices/Graphics/DevVGA_VDMA.cpp
r71588 r71590 2398 2398 * @note cbCmdDr is at least sizeof(VBOXVDMACBUF_DR). 2399 2399 */ 2400 static int vboxVDMACmdCheckCrCmd(struct VBOXVDMAHOST *pVdma, PVBOXVDMACBUF_DRpCmdDr, uint32_t cbCmdDr)2400 static int vboxVDMACmdCheckCrCmd(struct VBOXVDMAHOST *pVdma, VBOXVDMACBUF_DR RT_UNTRUSTED_VOLATILE_GUEST *pCmdDr, uint32_t cbCmdDr) 2401 2401 { 2402 2402 uint32_t cbDmaCmd = 0; … … 2948 2948 * @thread VDMA 2949 2949 */ 2950 static void vboxVDMACommandProcess(PVBOXVDMAHOST pVdma, PVBOXVDMACBUF_DRpCmd, uint32_t cbCmd)2950 static void vboxVDMACommandProcess(PVBOXVDMAHOST pVdma, VBOXVDMACBUF_DR RT_UNTRUSTED_VOLATILE_GUEST *pCmd, uint32_t cbCmd) 2951 2951 { 2952 2952 PHGSMIINSTANCE pHgsmi = pVdma->pHgsmi; … … 2958 2958 * Get the command buffer (volatile). 2959 2959 */ 2960 uint16_t const cbCmdBuf = pCmd->cbBuf; 2961 const uint8_t *pbCmdBuf; 2960 uint16_t const cbCmdBuf = pCmd->cbBuf; 2961 uint32_t const fCmdFlags = pCmd->fFlags; 2962 const uint8_t *pbCmdBuf; /** @todo fixme later */ 2962 2963 PGMPAGEMAPLOCK Lock; 2963 2964 bool bReleaseLocked = false; 2964 if ( pCmd->fFlags & VBOXVDMACBUF_FLAG_BUF_FOLLOWS_DR)2965 if (fCmdFlags & VBOXVDMACBUF_FLAG_BUF_FOLLOWS_DR) 2965 2966 { 2966 2967 pbCmdBuf = VBOXVDMACBUF_DR_TAIL(pCmd, const uint8_t); … … 2969 2970 rc = VERR_INVALID_PARAMETER); 2970 2971 } 2971 else if ( pCmd->fFlags & VBOXVDMACBUF_FLAG_BUF_VRAM_OFFSET)2972 else if (fCmdFlags & VBOXVDMACBUF_FLAG_BUF_VRAM_OFFSET) 2972 2973 { 2973 2974 uint64_t offVRam = pCmd->Location.offVramBuf; … … 3165 3166 * @param cbCmd The size of the command. At least sizeof(VBOXVDMA_CTL). 3166 3167 */ 3167 void vboxVDMAControl(struct VBOXVDMAHOST *pVdma, PVBOXVDMA_CTLpCmd, uint32_t cbCmd)3168 void vboxVDMAControl(struct VBOXVDMAHOST *pVdma, VBOXVDMA_CTL RT_UNTRUSTED_VOLATILE_GUEST *pCmd, uint32_t cbCmd) 3168 3169 { 3169 3170 RT_NOREF(cbCmd); … … 3171 3172 3172 3173 VBOXVDMA_CTL_TYPE enmCtl = pCmd->enmCtl; 3174 ASMCompilerBarrier(); 3173 3175 switch (enmCtl) 3174 3176 { … … 3204 3206 * @param cbCmd The size of the command. At least sizeof(VBOXVDMACBUF_DR). 3205 3207 */ 3206 void vboxVDMACommand(struct VBOXVDMAHOST *pVdma, PVBOXVDMACBUF_DRpCmd, uint32_t cbCmd)3208 void vboxVDMACommand(struct VBOXVDMAHOST *pVdma, VBOXVDMACBUF_DR RT_UNTRUSTED_VOLATILE_GUEST *pCmd, uint32_t cbCmd) 3207 3209 { 3208 3210 #ifdef VBOX_WITH_CRHGSMI … … 3282 3284 * Handler for vboxCmdVBVACmdCtl()/VBOXCMDVBVACTL_TYPE_3DCTL. 3283 3285 */ 3284 static int vdmaVBVACtlGenericGuestSubmit(PVBOXVDMAHOST pVdma, VBVAEXHOSTCTL_TYPE enmType, VBOXCMDVBVA_CTL *pCtl, uint32_t cbCtl) 3286 static int vdmaVBVACtlGenericGuestSubmit(PVBOXVDMAHOST pVdma, VBVAEXHOSTCTL_TYPE enmType, 3287 VBOXCMDVBVA_CTL RT_UNTRUSTED_VOLATILE_GUEST *pCtl, uint32_t cbCtl) 3285 3288 { 3286 3289 Assert(cbCtl >= sizeof(VBOXCMDVBVA_CTL)); /* Checked by callers caller, vbvaChannelHandler(). */ … … 3791 3794 * sizeof(VBOXCMDVBVA_CTL). 3792 3795 */ 3793 int vboxCmdVBVACmdCtl(PVGASTATE pVGAState, VBOXCMDVBVA_CTL *pCtl, uint32_t cbCtl)3796 int vboxCmdVBVACmdCtl(PVGASTATE pVGAState, VBOXCMDVBVA_CTL RT_UNTRUSTED_VOLATILE_GUEST *pCtl, uint32_t cbCtl) 3794 3797 { 3795 3798 struct VBOXVDMAHOST *pVdma = pVGAState->pVdma; -
trunk/src/VBox/Devices/Graphics/HGSMI/HGSMIHost.cpp
r70596 r71590 514 514 } 515 515 516 static void *hgsmiHostHeapBufferAlloc(HGSMIHOSTHEAP *pHeap, 517 HGSMISIZE cbBuffer) 518 { 519 void *pvBuf = NULL; 516 static void RT_UNTRUSTED_VOLATILE_GUEST *hgsmiHostHeapBufferAlloc(HGSMIHOSTHEAP *pHeap, HGSMISIZE cbBuffer) 517 { 518 void RT_UNTRUSTED_VOLATILE_GUEST *pvBuf = NULL; 520 519 521 520 if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_MA) 522 {523 521 pvBuf = HGSMIMAAlloc(&pHeap->u.ma, cbBuffer); 524 }525 522 else if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_POINTER) 526 {527 523 pvBuf = RTHeapSimpleAlloc(pHeap->u.legacy.u.hPtr, cbBuffer, 0); 528 }529 524 else if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_OFFSET) 530 {531 525 pvBuf = RTHeapOffsetAlloc(pHeap->u.legacy.u.hOff, cbBuffer, 0); 532 }533 534 526 if (pvBuf) 535 { 536 ++pHeap->cRefs; 537 } 527 ASMAtomicIncS32(&pHeap->cRefs); 538 528 539 529 return pvBuf; 540 530 } 541 531 542 static void hgsmiHostHeapBufferFree(HGSMIHOSTHEAP *pHeap, 543 void *pvBuf) 532 static void hgsmiHostHeapBufferFree(HGSMIHOSTHEAP *pHeap, void RT_UNTRUSTED_VOLATILE_GUEST *pvBuf) 544 533 { 545 534 if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_MA) 546 {547 535 HGSMIMAFree(&pHeap->u.ma, pvBuf); 548 }549 536 else if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_POINTER) 550 { 551 RTHeapSimpleFree(pHeap->u.legacy.u.hPtr, pvBuf); 552 } 537 RTHeapSimpleFree(pHeap->u.legacy.u.hPtr, (void *)pvBuf); 553 538 else if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_OFFSET) 554 { 555 RTHeapOffsetFree(pHeap->u.legacy.u.hOff, pvBuf); 556 } 557 --pHeap->cRefs; 558 } 559 560 static void *hgsmiHostHeapDataAlloc(HGSMIHOSTHEAP *pHeap, 561 HGSMISIZE cbData, 562 uint8_t u8Channel, 563 uint16_t u16ChannelInfo) 539 RTHeapOffsetFree(pHeap->u.legacy.u.hOff, (void *)pvBuf); 540 ASMAtomicDecS32(&pHeap->cRefs); 541 } 542 543 static void RT_UNTRUSTED_VOLATILE_GUEST *hgsmiHostHeapDataAlloc(HGSMIHOSTHEAP *pHeap, HGSMISIZE cbData, 544 uint8_t u8Channel, uint16_t u16ChannelInfo) 564 545 { 565 546 HGSMISIZE cbAlloc = HGSMIBufferRequiredSize(cbData); … … 573 554 } 574 555 575 static void hgsmiHostHeapDataFree(HGSMIHOSTHEAP *pHeap, 576 void *pvData) 556 static void hgsmiHostHeapDataFree(HGSMIHOSTHEAP *pHeap, void RT_UNTRUSTED_VOLATILE_GUEST *pvData) 577 557 { 578 558 if ( pvData 579 559 && pHeap->u32HeapType != HGSMI_HEAP_TYPE_NULL) 580 560 { 581 HGSMIBUFFERHEADER *pHeader = HGSMIBufferHeaderFromData(pvData);561 HGSMIBUFFERHEADER RT_UNTRUSTED_VOLATILE_GUEST *pHeader = HGSMIBufferHeaderFromData(pvData); 582 562 hgsmiHostHeapBufferFree(pHeap, pHeader); 583 563 } … … 726 706 hgsmiFIFOUnlock (pIns); 727 707 728 void *pvData = HGSMIBufferDataFromOffset(&pIns->hostHeap.area, pEntry->offBuffer);708 void RT_UNTRUSTED_VOLATILE_GUEST *pvData = HGSMIBufferDataFromOffset(&pIns->hostHeap.area, pEntry->offBuffer); 729 709 730 710 rc = hgsmiHostHeapLock (pIns); … … 744 724 } 745 725 746 static int hgsmiHostCommandFree(HGSMIINSTANCE *pIns, 747 void *pvData) 726 static int hgsmiHostCommandFree(HGSMIINSTANCE *pIns, void RT_UNTRUSTED_VOLATILE_GUEST *pvData) 748 727 { 749 728 HGSMIOFFSET offBuffer = HGSMIBufferOffsetFromData(&pIns->hostHeap.area, pvData); … … 852 831 * @thread EMT 853 832 */ 854 static int hgsmiHostCommandSubmit(HGSMIINSTANCE *pIns, 855 void *pvData, 856 bool fDoIrq) 833 static int hgsmiHostCommandSubmit(HGSMIINSTANCE *pIns, void RT_UNTRUSTED_VOLATILE_GUEST *pvData, bool fDoIrq) 857 834 { 858 835 /* Append the command to FIFO. */ … … 883 860 * @param u16ChannelInfo Command parameter. 884 861 */ 885 int HGSMIHostCommandAlloc(HGSMIINSTANCE *pIns, 886 void **ppvData, 887 HGSMISIZE cbData, 888 uint8_t u8Channel, 889 uint16_t u16ChannelInfo) 862 int HGSMIHostCommandAlloc(HGSMIINSTANCE *pIns, void RT_UNTRUSTED_VOLATILE_GUEST **ppvData, HGSMISIZE cbData, 863 uint8_t u8Channel, uint16_t u16ChannelInfo) 890 864 { 891 865 LogFlowFunc(("pIns = %p, cbData = %d, u8Channel %d, u16ChannelInfo 0x%04X\n", … … 895 869 if (RT_SUCCESS(rc)) 896 870 { 897 void *pvData = hgsmiHostHeapDataAlloc(&pIns->hostHeap, 898 cbData, 899 u8Channel, 900 u16ChannelInfo); 871 void RT_UNTRUSTED_VOLATILE_GUEST *pvData = hgsmiHostHeapDataAlloc(&pIns->hostHeap, cbData, u8Channel, u16ChannelInfo); 901 872 hgsmiHostHeapUnlock(pIns); 902 873 … … 929 900 * the command could be posted without raising an irq. 930 901 */ 931 int HGSMIHostCommandSubmitAndFreeAsynch(PHGSMIINSTANCE pIns, 932 void *pvData, 933 bool fDoIrq) 902 int HGSMIHostCommandSubmitAndFreeAsynch(PHGSMIINSTANCE pIns, void RT_UNTRUSTED_VOLATILE_GUEST *pvData, bool fDoIrq) 934 903 { 935 904 LogFlowFunc(("pIns = %p, pvData = %p, fDoIrq = %d\n", pIns, pvData, fDoIrq)); … … 937 906 int rc; 938 907 if (HGSMIAreaContainsPointer(&pIns->hostHeap.area, pvData)) 939 {940 908 rc = hgsmiHostCommandSubmit(pIns, pvData, fDoIrq); 941 }942 909 else 943 910 { … … 957 924 * @param pvData The pointer returned by 'HGSMIHostCommandAlloc'. 958 925 */ 959 int HGSMIHostCommandFree(HGSMIINSTANCE *pIns, 960 void *pvData) 926 int HGSMIHostCommandFree(HGSMIINSTANCE *pIns, void RT_UNTRUSTED_VOLATILE_GUEST *pvData) 961 927 { 962 928 LogFlowFunc(("pIns = %p, pvData = %p\n", pIns, pvData)); … … 964 930 int rc; 965 931 if (HGSMIAreaContainsPointer(&pIns->hostHeap.area, pvData)) 966 {967 932 rc = hgsmiHostCommandFree(pIns, pvData); 968 }969 933 else 970 934 { … … 1437 1401 */ 1438 1402 1439 static int hgsmiChannelMapCreate(PHGSMIINSTANCE pIns, const char *pszChannel, uint8_t *pu8Channel)1440 {1441 RT_NOREF(pIns, pszChannel, pu8Channel);1442 /** @todo later */1443 return VERR_NOT_SUPPORTED;1444 }1445 1446 1403 /* Register a new HGSMI channel by a predefined index. 1447 1404 */ … … 1472 1429 } 1473 1430 1474 /* Register a new HGSMI channel by name. 1431 #if 0 /* unused */ 1432 1433 static int hgsmiChannelMapCreate(PHGSMIINSTANCE pIns, const char *pszChannel, uint8_t *pu8Channel) 1434 { 1435 RT_NOREF(pIns, pszChannel, pu8Channel); 1436 /** @todo later */ 1437 return VERR_NOT_SUPPORTED; 1438 } 1439 1440 /** 1441 * Register a new HGSMI channel by name. 1442 * 1443 * @note currently unused. 1475 1444 */ 1476 1445 int HGSMIChannelRegisterName(PHGSMIINSTANCE pIns, … … 1523 1492 return rc; 1524 1493 } 1525 1526 void *HGSMIOffsetToPointerHost (PHGSMIINSTANCE pIns, 1527 1494 #endif 1495 1496 void RT_UNTRUSTED_VOLATILE_GUEST *HGSMIOffsetToPointerHost(PHGSMIINSTANCE pIns, HGSMIOFFSET offBuffer) 1528 1497 { 1529 1498 const HGSMIAREA *pArea = &pIns->area; … … 1536 1505 } 1537 1506 1538 return HGSMIOffsetToPointer (pArea, offBuffer); 1539 } 1540 1541 1542 HGSMIOFFSET HGSMIPointerToOffsetHost (PHGSMIINSTANCE pIns, 1543 const void *pv) 1507 return HGSMIOffsetToPointer(pArea, offBuffer); 1508 } 1509 1510 1511 HGSMIOFFSET HGSMIPointerToOffsetHost(PHGSMIINSTANCE pIns, const void RT_UNTRUSTED_VOLATILE_GUEST *pv) 1544 1512 { 1545 1513 const HGSMIAREA *pArea = &pIns->area; 1546 1547 uintptr_t pBegin = (uintptr_t)pArea->pu8Base; 1548 uintptr_t pEnd = (uintptr_t)pArea->pu8Base + (pArea->cbArea - 1); 1549 uintptr_t p = (uintptr_t)pv; 1550 1551 if ( p < pBegin 1552 || p > pEnd) 1553 { 1554 LogFunc(("pointer %p is outside the area [%p;%p]!!!\n", pv, pBegin, pEnd)); 1555 return HGSMIOFFSET_VOID; 1556 } 1557 1558 return HGSMIPointerToOffset (pArea, (HGSMIBUFFERHEADER *)pv); 1514 uintptr_t off = (uintptr_t)pv - (uintptr_t)pArea->pu8Base; 1515 if (off < pArea->cbArea) 1516 return pArea->offBase + (HGSMIOFFSET)off; 1517 1518 LogFunc(("pointer %p is outside the area %p LB %#x!!!\n", pv, pArea->pu8Base, pArea->cbArea)); 1519 return HGSMIOFFSET_VOID; 1559 1520 } 1560 1521 … … 1567 1528 1568 1529 /* The guest submitted a buffer. */ 1569 static DECLCALLBACK(int) hgsmiChannelHandler (void *pvHandler, uint16_t u16ChannelInfo, void *pvBuffer, HGSMISIZE cbBuffer) 1530 static DECLCALLBACK(int) hgsmiChannelHandler (void *pvHandler, uint16_t u16ChannelInfo, 1531 RT_UNTRUSTED_VOLATILE_GUEST void *pvBuffer, HGSMISIZE cbBuffer) 1570 1532 { 1571 1533 int rc = VINF_SUCCESS; … … 1786 1748 } 1787 1749 1788 int hgsmiCompleteGuestCommand(PHGSMIINSTANCE pIns, 1789 HGSMIOFFSET offBuffer, 1790 bool bDoIrq) 1750 int hgsmiCompleteGuestCommand(PHGSMIINSTANCE pIns, HGSMIOFFSET offBuffer, bool fDoIrq) 1791 1751 { 1792 1752 int rc = hgsmiGuestCommandComplete (pIns, offBuffer); 1793 1753 if (RT_SUCCESS (rc)) 1794 1754 { 1795 if ( bDoIrq)1755 if (fDoIrq) 1796 1756 { 1797 1757 /* Now guest can read the FIFO, the notification is informational. */ … … 1808 1768 } 1809 1769 1810 int HGSMICompleteGuestCommand(PHGSMIINSTANCE pIns, 1811 void *pvMem, 1812 bool bDoIrq) 1770 int HGSMICompleteGuestCommand(PHGSMIINSTANCE pIns, void RT_UNTRUSTED_VOLATILE_GUEST *pvMem, bool fDoIrq) 1813 1771 { 1814 1772 LogFlowFunc(("pIns = %p, pvMem = %p\n", pIns, pvMem)); … … 1816 1774 int rc = VINF_SUCCESS; 1817 1775 1818 HGSMIBUFFERHEADER *pHeader= HGSMIBufferHeaderFromData(pvMem);1819 HGSMIOFFSET offBuffer = HGSMIPointerToOffset(&pIns->area, pHeader);1776 HGSMIBUFFERHEADER RT_UNTRUSTED_VOLATILE_GUEST *pHeader = HGSMIBufferHeaderFromData(pvMem); 1777 HGSMIOFFSET offBuffer = HGSMIPointerToOffset(&pIns->area, pHeader); 1820 1778 1821 1779 Assert(offBuffer != HGSMIOFFSET_VOID); 1822 1780 if (offBuffer != HGSMIOFFSET_VOID) 1823 1781 { 1824 rc = hgsmiCompleteGuestCommand (pIns, offBuffer, bDoIrq);1782 rc = hgsmiCompleteGuestCommand(pIns, offBuffer, fDoIrq); 1825 1783 AssertRC (rc); 1826 1784 } -
trunk/src/VBox/Devices/Graphics/HGSMI/HGSMIHost.h
r69500 r71590 1 1 /* $Id$ */ 2 2 /** @file 3 * 4 * VBox Host Guest Shared Memory Interface (HGSMI). 5 * Host part. 3 * VBox Host Guest Shared Memory Interface (HGSMI), host part. 6 4 */ 7 5 … … 38 36 */ 39 37 40 int HGSMICreate (PHGSMIINSTANCE *ppIns, 41 PVM pVM, 42 const char *pszName, 43 HGSMIOFFSET offBase, 44 uint8_t *pu8MemBase, 45 HGSMISIZE cbMem, 46 PFNHGSMINOTIFYGUEST pfnNotifyGuest, 47 void *pvNotifyGuest, 48 size_t cbContext); 38 int HGSMICreate(PHGSMIINSTANCE *ppIns, 39 PVM pVM, 40 const char *pszName, 41 HGSMIOFFSET offBase, 42 uint8_t *pu8MemBase, 43 HGSMISIZE cbMem, 44 PFNHGSMINOTIFYGUEST pfnNotifyGuest, 45 void *pvNotifyGuest, 46 size_t cbContext); 47 void HGSMIDestroy(PHGSMIINSTANCE pIns); 48 void *HGSMIContext(PHGSMIINSTANCE pIns); 49 49 50 void HGSMIDestroy (PHGSMIINSTANCE pIns); 50 void RT_UNTRUSTED_VOLATILE_GUEST *HGSMIOffsetToPointerHost(PHGSMIINSTANCE pIns, HGSMIOFFSET offBuffer); 51 HGSMIOFFSET HGSMIPointerToOffsetHost(PHGSMIINSTANCE pIns, const void RT_UNTRUSTED_VOLATILE_GUEST *pv); 51 52 52 void *HGSMIContext (PHGSMIINSTANCE pIns); 53 54 void *HGSMIOffsetToPointerHost (PHGSMIINSTANCE pIns, 55 HGSMIOFFSET offBuffer); 56 57 HGSMIOFFSET HGSMIPointerToOffsetHost (PHGSMIINSTANCE pIns, 58 const void *pv); 59 60 int HGSMIHostChannelRegister (PHGSMIINSTANCE pIns, 61 uint8_t u8Channel, 62 PFNHGSMICHANNELHANDLER pfnChannelHandler, 63 void *pvChannelHandler); 64 53 int HGSMIHostChannelRegister(PHGSMIINSTANCE pIns, uint8_t u8Channel, 54 PFNHGSMICHANNELHANDLER pfnChannelHandler, void *pvChannelHandler); 55 #if 0 /* unused */ 65 56 int HGSMIChannelRegisterName (PHGSMIINSTANCE pIns, 66 57 const char *pszChannel, … … 68 59 void *pvChannelHandler, 69 60 uint8_t *pu8Channel); 61 #endif 70 62 71 int HGSMIHostHeapSetup(PHGSMIINSTANCE pIns, 72 HGSMIOFFSET offHeap, 73 HGSMISIZE cbHeap); 63 int HGSMIHostHeapSetup(PHGSMIINSTANCE pIns, HGSMIOFFSET offHeap, HGSMISIZE cbHeap); 74 64 75 65 /* … … 78 68 79 69 /* Guests passes a new command buffer to the host. */ 80 void HGSMIGuestWrite (PHGSMIINSTANCE pIns, 81 HGSMIOFFSET offBuffer); 70 void HGSMIGuestWrite(PHGSMIINSTANCE pIns, HGSMIOFFSET offBuffer); 82 71 83 72 /* Guest reads information about guest buffers. */ 84 HGSMIOFFSET HGSMIGuestRead 73 HGSMIOFFSET HGSMIGuestRead(PHGSMIINSTANCE pIns); 85 74 86 75 /* Guest reads the host FIFO to get a command. */ 87 HGSMIOFFSET HGSMIHostRead 76 HGSMIOFFSET HGSMIHostRead(PHGSMIINSTANCE pIns); 88 77 89 78 /* Guest reports that the command at this offset has been processed. */ 90 void HGSMIHostWrite (PHGSMIINSTANCE pIns, 91 HGSMIOFFSET offBuffer); 79 void HGSMIHostWrite(PHGSMIINSTANCE pIns, HGSMIOFFSET offBuffer); 92 80 93 81 void HGSMISetHostGuestFlags(PHGSMIINSTANCE pIns, uint32_t flags); … … 104 92 105 93 /* Allocate a buffer in the host heap. */ 106 int HGSMIHostCommandAlloc(PHGSMIINSTANCE pIns, 107 void **ppvData, 108 HGSMISIZE cbData, 109 uint8_t u8Channel, 110 uint16_t u16ChannelInfo); 94 int HGSMIHostCommandAlloc(PHGSMIINSTANCE pIns, void RT_UNTRUSTED_VOLATILE_GUEST **ppvData, HGSMISIZE cbData, 95 uint8_t u8Channel, uint16_t u16ChannelInfo); 96 int HGSMIHostCommandSubmitAndFreeAsynch(PHGSMIINSTANCE pIns, void RT_UNTRUSTED_VOLATILE_GUEST *pvData, bool fDoIrq); 97 int HGSMIHostCommandFree(PHGSMIINSTANCE pIns, void RT_UNTRUSTED_VOLATILE_GUEST *pvData); 111 98 112 int HGSMIHostCommandSubmitAndFreeAsynch(PHGSMIINSTANCE pIns, 113 void *pvData, 114 bool fDoIrq); 115 116 int HGSMIHostCommandFree(PHGSMIINSTANCE pIns, 117 void *pvData); 118 119 int HGSMIHostLoadStateExec (PHGSMIINSTANCE pIns, PSSMHANDLE pSSM, uint32_t u32Version); 120 121 int HGSMIHostSaveStateExec (PHGSMIINSTANCE pIns, PSSMHANDLE pSSM); 99 int HGSMIHostLoadStateExec(PHGSMIINSTANCE pIns, PSSMHANDLE pSSM, uint32_t u32Version); 100 int HGSMIHostSaveStateExec(PHGSMIINSTANCE pIns, PSSMHANDLE pSSM); 122 101 123 102 #ifdef VBOX_WITH_WDDM 124 int HGSMICompleteGuestCommand(PHGSMIINSTANCE pIns, void *pvMem, bool bDoIrq);103 int HGSMICompleteGuestCommand(PHGSMIINSTANCE pIns, void RT_UNTRUSTED_VOLATILE_GUEST *pvMem, bool fDoIrq); 125 104 #endif 126 105 -
trunk/src/VBox/Devices/Graphics/HGSMI/SHGSMIHost.cpp
r69500 r71590 23 23 * about G->H command completion 24 24 */ 25 static bool vboxSHGSMICommandCanCompleteSynch (PVBOXSHGSMIHEADER pHdr) 25 26 static int vboxSHGSMICommandCompleteAsynch (PHGSMIINSTANCE pIns, VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_GUEST *pHdr) 26 27 { 27 return !(pHdr->fFlags & VBOXSHGSMI_FLAG_GH_ASYNCH_FORCE); 28 bool fDoIrq = !!(pHdr->fFlags & VBOXSHGSMI_FLAG_GH_ASYNCH_IRQ) 29 || !!(pHdr->fFlags & VBOXSHGSMI_FLAG_GH_ASYNCH_IRQ_FORCE); 30 return HGSMICompleteGuestCommand(pIns, pHdr, fDoIrq); 28 31 } 29 32 30 static int vboxSHGSMICommandCompleteAsynch (PHGSMIINSTANCE pIns, PVBOXSHGSMIHEADER pHdr)33 void VBoxSHGSMICommandMarkAsynchCompletion(void RT_UNTRUSTED_VOLATILE_GUEST *pvData) 31 34 { 32 bool bDoIrq = !!(pHdr->fFlags & VBOXSHGSMI_FLAG_GH_ASYNCH_IRQ) 33 || !!(pHdr->fFlags & VBOXSHGSMI_FLAG_GH_ASYNCH_IRQ_FORCE); 34 return HGSMICompleteGuestCommand(pIns, pHdr, bDoIrq); 35 } 36 37 void VBoxSHGSMICommandMarkAsynchCompletion (void *pvData) 38 { 39 PVBOXSHGSMIHEADER pHdr = VBoxSHGSMIBufferHeader (pvData); 35 VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_GUEST *pHdr = VBoxSHGSMIBufferHeader(pvData); 40 36 Assert(!(pHdr->fFlags & VBOXSHGSMI_FLAG_HG_ASYNCH)); 41 37 pHdr->fFlags |= VBOXSHGSMI_FLAG_HG_ASYNCH; 42 38 } 43 39 44 int VBoxSHGSMICommandComplete (PHGSMIINSTANCE pIns, void*pvData)40 int VBoxSHGSMICommandComplete(PHGSMIINSTANCE pIns, void RT_UNTRUSTED_VOLATILE_GUEST *pvData) 45 41 { 46 PVBOXSHGSMIHEADER pHdr = VBoxSHGSMIBufferHeader (pvData); 47 if (!(pHdr->fFlags & VBOXSHGSMI_FLAG_HG_ASYNCH) /* <- check if synchronous completion */ 48 && vboxSHGSMICommandCanCompleteSynch(pHdr)) /* <- check if can complete synchronously */ 42 VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_GUEST *pHdr = VBoxSHGSMIBufferHeader(pvData); 43 uint32_t fFlags = pHdr->fFlags; 44 ASMCompilerBarrier(); 45 if ( !(fFlags & VBOXSHGSMI_FLAG_HG_ASYNCH) /* <- check if synchronous completion */ 46 && !(fFlags & VBOXSHGSMI_FLAG_GH_ASYNCH_FORCE)) /* <- check if can complete synchronously */ 49 47 return VINF_SUCCESS; 50 pHdr->fFlags |= VBOXSHGSMI_FLAG_HG_ASYNCH; 48 49 pHdr->fFlags = fFlags | VBOXSHGSMI_FLAG_HG_ASYNCH; 51 50 return vboxSHGSMICommandCompleteAsynch(pIns, pHdr); 52 51 } -
trunk/src/VBox/Devices/Graphics/HGSMI/SHGSMIHost.h
r69500 r71590 21 21 #include "HGSMIHost.h" 22 22 23 int VBoxSHGSMICommandComplete (PHGSMIINSTANCE pIns, void *pvData); 24 25 void VBoxSHGSMICommandMarkAsynchCompletion (void *pvData); 23 int VBoxSHGSMICommandComplete(PHGSMIINSTANCE pIns, void RT_UNTRUSTED_VOLATILE_GUEST *pvData); 24 void VBoxSHGSMICommandMarkAsynchCompletion(void RT_UNTRUSTED_VOLATILE_GUEST *pvData); 26 25 27 26 #endif -
trunk/src/VBox/Main/include/DisplayImpl.h
r70563 r71590 169 169 void i_handleUpdateVBVAInputMapping(int32_t xOrigin, int32_t yOrigin, uint32_t cx, uint32_t cy); 170 170 #ifdef VBOX_WITH_VIDEOHWACCEL 171 int i_handleVHWACommandProcess( PVBOXVHWACMDpCommand);171 int i_handleVHWACommandProcess(int enmCmd, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCommand); 172 172 #endif 173 173 #ifdef VBOX_WITH_CRHGSMI … … 339 339 340 340 #ifdef VBOX_WITH_VIDEOHWACCEL 341 static DECLCALLBACK(int) i_displayVHWACommandProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVHWACMD pCommand); 341 static DECLCALLBACK(int) i_displayVHWACommandProcess(PPDMIDISPLAYCONNECTOR pInterface, int enmCmd, 342 VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCommand); 342 343 #endif 343 344 -
trunk/src/VBox/Main/src-client/DisplayImpl.cpp
r70644 r71590 2981 2981 { 2982 2982 #ifdef VBOX_WITH_VIDEOHWACCEL 2983 mpDrv->pVBVACallbacks->pfnVHWACommandCompleteAsync(mpDrv->pVBVACallbacks, ( PVBOXVHWACMD)aCommand);2983 mpDrv->pVBVACallbacks->pfnVHWACommandCompleteAsync(mpDrv->pVBVACallbacks, (VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *)aCommand); 2984 2984 return S_OK; 2985 2985 #else … … 3531 3531 #endif 3532 3532 3533 int Display::i_handleVHWACommandProcess( PVBOXVHWACMDpCommand)3533 int Display::i_handleVHWACommandProcess(int enmCmd, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCommand) 3534 3534 { 3535 3535 unsigned id = (unsigned)pCommand->iDisplay; … … 3546 3546 return VERR_NOT_IMPLEMENTED; /* Implementation is not available. */ 3547 3547 3548 NOREF(enmCmd); 3548 3549 HRESULT hr = pFramebuffer->ProcessVHWACommand((BYTE*)pCommand); 3549 3550 if (hr == S_FALSE) … … 3558 3559 } 3559 3560 3560 DECLCALLBACK(int) Display::i_displayVHWACommandProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVHWACMD pCommand) 3561 DECLCALLBACK(int) Display::i_displayVHWACommandProcess(PPDMIDISPLAYCONNECTOR pInterface, int enmCmd, 3562 VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCommand) 3561 3563 { 3562 3564 PDRVMAINDISPLAY pDrv = PDMIDISPLAYCONNECTOR_2_MAINDISPLAY(pInterface); 3563 3565 3564 return pDrv->pDisplay->i_handleVHWACommandProcess( pCommand);3566 return pDrv->pDisplay->i_handleVHWACommandProcess(enmCmd, pCommand); 3565 3567 } 3566 3568 #endif
Note:
See TracChangeset
for help on using the changeset viewer.