VirtualBox

Changeset 71590 in vbox


Ignore:
Timestamp:
Mar 31, 2018 6:34:28 PM (7 years ago)
Author:
vboxsync
Message:

DevVGA,HGSMI,++: Code cleanup in progress. bugref:9094

Location:
trunk
Files:
37 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/Graphics/HGSMI.h

    r71585 r71590  
    9494 * @thread  EMT on the host side.
    9595 */
    96 typedef DECLCALLBACK(int) FNHGSMICHANNELHANDLER(void *pvHandler, uint16_t u16ChannelInfo, void *pvBuffer, HGSMISIZE cbBuffer);
     96typedef DECLCALLBACK(int) FNHGSMICHANNELHANDLER(void *pvHandler, uint16_t u16ChannelInfo,
     97                                                RT_UNTRUSTED_VOLATILE_HSTGST void *pvBuffer, HGSMISIZE cbBuffer);
    9798/** Pointer to a channel handler callback. */
    9899typedef FNHGSMICHANNELHANDLER *PFNHGSMICHANNELHANDLER;
     
    124125RT_C_DECLS_BEGIN
    125126
    126 DECLINLINE(HGSMIBUFFERHEADER *) HGSMIBufferHeaderFromPtr(void *pvBuffer)
     127DECLINLINE(HGSMIBUFFERHEADER *) HGSMIBufferHeaderFromPtr(void RT_UNTRUSTED_VOLATILE_HSTGST *pvBuffer)
    127128{
    128129    return (HGSMIBUFFERHEADER *)pvBuffer;
    129130}
    130131
    131 DECLINLINE(uint8_t *) HGSMIBufferDataFromPtr(void *pvBuffer)
    132 {
    133     return (uint8_t *)pvBuffer + sizeof(HGSMIBUFFERHEADER);
    134 }
    135 
    136 DECLINLINE(HGSMIBUFFERTAIL *) HGSMIBufferTailFromPtr(void *pvBuffer,
    137                                                     uint32_t u32DataSize)
    138 {
    139     return (HGSMIBUFFERTAIL *)(HGSMIBufferDataFromPtr(pvBuffer) + u32DataSize);
     132DECLINLINE(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
     137DECLINLINE(HGSMIBUFFERTAIL RT_UNTRUSTED_VOLATILE_HSTGST *)
     138HGSMIBufferTailFromPtr(void RT_UNTRUSTED_VOLATILE_HSTGST *pvBuffer, uint32_t u32DataSize)
     139{
     140    return (HGSMIBUFFERTAIL RT_UNTRUSTED_VOLATILE_HSTGST *)(HGSMIBufferDataFromPtr(pvBuffer) + u32DataSize);
    140141}
    141142
     
    145146}
    146147
    147 DECLINLINE(HGSMIBUFFERHEADER *) HGSMIBufferHeaderFromData(const void *pvData)
    148 {
    149     return (HGSMIBUFFERHEADER *)((uint8_t *)pvData - sizeof(HGSMIBUFFERHEADER));
     148DECLINLINE(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));
    150151}
    151152
     
    155156}
    156157
    157 DECLINLINE(HGSMIOFFSET) HGSMIPointerToOffset(const HGSMIAREA *pArea,
    158                                              const void *pv)
     158DECLINLINE(HGSMIOFFSET) HGSMIPointerToOffset(const HGSMIAREA *pArea, const void RT_UNTRUSTED_VOLATILE_HSTGST *pv)
    159159{
    160160    return pArea->offBase + (HGSMIOFFSET)((uint8_t *)pv - pArea->pu8Base);
    161161}
    162162
    163 DECLINLINE(void *) HGSMIOffsetToPointer(const HGSMIAREA *pArea,
    164                                         HGSMIOFFSET offBuffer)
     163DECLINLINE(void RT_UNTRUSTED_VOLATILE_HSTGST *) HGSMIOffsetToPointer(const HGSMIAREA *pArea, HGSMIOFFSET offBuffer)
    165164{
    166165    return pArea->pu8Base + (offBuffer - pArea->offBase);
    167166}
    168167
    169 DECLINLINE(uint8_t *) HGSMIBufferDataFromOffset(const HGSMIAREA *pArea,
    170                                                 HGSMIOFFSET offBuffer)
    171 {
    172     void *pvBuffer = HGSMIOffsetToPointer(pArea, offBuffer);
     168DECLINLINE(uint8_t RT_UNTRUSTED_VOLATILE_HSTGST*) HGSMIBufferDataFromOffset(const HGSMIAREA *pArea, HGSMIOFFSET offBuffer)
     169{
     170    void RT_UNTRUSTED_VOLATILE_HSTGST *pvBuffer = HGSMIOffsetToPointer(pArea, offBuffer);
    173171    return HGSMIBufferDataFromPtr(pvBuffer);
    174172}
    175173
    176 DECLINLINE(HGSMIOFFSET) HGSMIBufferOffsetFromData(const HGSMIAREA *pArea,
    177                                                   void *pvData)
    178 {
    179     HGSMIBUFFERHEADER *pHeader = HGSMIBufferHeaderFromData(pvData);
     174DECLINLINE(HGSMIOFFSET) HGSMIBufferOffsetFromData(const HGSMIAREA *pArea, void RT_UNTRUSTED_VOLATILE_HSTGST *pvData)
     175{
     176    HGSMIBUFFERHEADER RT_UNTRUSTED_VOLATILE_HSTGST *pHeader = HGSMIBufferHeaderFromData(pvData);
    180177    return HGSMIPointerToOffset(pArea, pHeader);
    181178}
    182179
    183 DECLINLINE(uint8_t *) HGSMIBufferDataAndChInfoFromOffset(const HGSMIAREA *pArea,
    184                                                          HGSMIOFFSET offBuffer,
    185                                                          uint16_t *pu16ChannelInfo)
    186 {
    187     HGSMIBUFFERHEADER *pHeader = (HGSMIBUFFERHEADER *)HGSMIOffsetToPointer(pArea, offBuffer);
     180DECLINLINE(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);
    188186    *pu16ChannelInfo = pHeader->u16ChannelInfo;
    189187    return HGSMIBufferDataFromPtr(pHeader);
    190188}
    191189
    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 
     190uint32_t HGSMIChecksum(HGSMIOFFSET offBuffer, const HGSMIBUFFERHEADER RT_UNTRUSTED_VOLATILE_HSTGST *pHeader,
     191                       const HGSMIBUFFERTAIL RT_UNTRUSTED_VOLATILE_HSTGST *pTail);
     192
     193int  HGSMIAreaInitialize(HGSMIAREA *pArea, void *pvBase, HGSMISIZE cbArea, HGSMIOFFSET offBase);
    201194void HGSMIAreaClear(HGSMIAREA *pArea);
    202195
     
    206199}
    207200
    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 
     201DECLINLINE(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
     206HGSMIOFFSET HGSMIBufferInitializeSingle(const HGSMIAREA *pArea, HGSMIBUFFERHEADER *pHeader, HGSMISIZE cbBuffer,
     207                                        uint8_t u8Channel, uint16_t u16ChannelInfo);
     208
     209int  HGSMIHeapSetup(HGSMIHEAP *pHeap, void *pvBase, HGSMISIZE cbArea, HGSMIOFFSET offBase, const HGSMIENV *pEnv);
    225210void 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);
     211void RT_UNTRUSTED_VOLATILE_HSTGST *HGSMIHeapBufferAlloc(HGSMIHEAP *pHeap, HGSMISIZE cbBuffer);
     212void HGSMIHeapBufferFree(HGSMIHEAP *pHeap, void RT_UNTRUSTED_VOLATILE_HSTGST *pvBuf);
     213
     214void RT_UNTRUSTED_VOLATILE_HOST *HGSMIHeapAlloc(HGSMIHEAP *pHeap,
     215                                                HGSMISIZE cbData,
     216                                                uint8_t u8Channel,
     217                                                uint16_t u16ChannelInfo);
     218
     219void HGSMIHeapFree(HGSMIHEAP *pHeap, void RT_UNTRUSTED_VOLATILE_HSTGST *pvData);
    240220
    241221DECLINLINE(const HGSMIAREA *) HGSMIHeapArea(HGSMIHEAP *pHeap)
     
    254234}
    255235
    256 DECLINLINE(HGSMIOFFSET) HGSMIHeapBufferOffset(HGSMIHEAP *pHeap,
    257                                               void *pvData)
     236DECLINLINE(HGSMIOFFSET) HGSMIHeapBufferOffset(HGSMIHEAP *pHeap, void RT_UNTRUSTED_VOLATILE_HOST *pvData)
    258237{
    259238    return HGSMIBufferOffsetFromData(HGSMIHeapArea(pHeap), pvData);
    260239}
    261240
    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);
     241HGSMICHANNEL *HGSMIChannelFindById(HGSMICHANNELINFO *pChannelInfo, uint8_t u8Channel);
     242
     243int HGSMIChannelRegister(HGSMICHANNELINFO *pChannelInfo, uint8_t u8Channel, const char *pszName,
     244                         PFNHGSMICHANNELHANDLER pfnChannelHandler, void *pvChannelHandler);
     245int HGSMIBufferProcess(const HGSMIAREA *pArea, HGSMICHANNELINFO *pChannelInfo, HGSMIOFFSET offBuffer);
    274246RT_C_DECLS_END
    275247
  • trunk/include/VBox/Graphics/HGSMIBase.h

    r69307 r71590  
    4848}
    4949
    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);
     50DECLHIDDEN(void RT_UNTRUSTED_VOLATILE_HOST *) VBoxHGSMIBufferAlloc(PHGSMIGUESTCOMMANDCONTEXT pCtx, HGSMISIZE cbData,
     51                                                                   uint8_t u8Ch, uint16_t u16Op);
     52DECLHIDDEN(void) VBoxHGSMIBufferFree(PHGSMIGUESTCOMMANDCONTEXT pCtx, void RT_UNTRUSTED_VOLATILE_HOST *pvBuffer);
     53DECLHIDDEN(int)  VBoxHGSMIBufferSubmit(PHGSMIGUESTCOMMANDCONTEXT pCtx, void RT_UNTRUSTED_VOLATILE_HOST *pvBuffer);
    5854/** @}  */
    5955
  • trunk/include/VBox/Graphics/HGSMIHostCmd.h

    r69015 r71590  
    3838 * @{ */
    3939
    40 DECLHIDDEN(void)     VBoxHGSMIHostCmdComplete(PHGSMIHOSTCOMMANDCONTEXT pCtx,
    41                                               void *pvMem);
     40DECLHIDDEN(void)     VBoxHGSMIHostCmdComplete(PHGSMIHOSTCOMMANDCONTEXT pCtx, void RT_UNTRUSTED_VOLATILE_HOST *pvMem);
    4241DECLHIDDEN(void)     VBoxHGSMIProcessHostQueue(PHGSMIHOSTCOMMANDCONTEXT pCtx);
    4342
  • trunk/include/VBox/Graphics/HGSMIMemAlloc.h

    r69107 r71590  
    7676void HGSMIMAUninit(HGSMIMADATA *pMA);
    7777
    78 void *HGSMIMAAlloc(HGSMIMADATA *pMA, HGSMISIZE cb);
    79 void HGSMIMAFree(HGSMIMADATA *pMA, void *pv);
     78void RT_UNTRUSTED_VOLATILE_HSTGST *HGSMIMAAlloc(HGSMIMADATA *pMA, HGSMISIZE cb);
     79void HGSMIMAFree(HGSMIMADATA *pMA, void RT_UNTRUSTED_VOLATILE_GUEST *pv);
    8080
    8181HGSMIMABLOCK *HGSMIMASearchOffset(HGSMIMADATA *pMA, HGSMIOFFSET off);
  • trunk/include/VBox/Graphics/VBoxVideo.h

    r70075 r71590  
    13581358
    13591359
    1360 DECLINLINE(uint8_t *) VBoxSHGSMIBufferData (const VBOXSHGSMIHEADER* pHeader)
    1361 {
    1362     return (uint8_t *)pHeader + sizeof (VBOXSHGSMIHEADER);
     1360DECLINLINE(uint8_t RT_UNTRUSTED_VOLATILE_GUEST *)
     1361VBoxSHGSMIBufferData(const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_GUEST *pHeader)
     1362{
     1363    return (uint8_t RT_UNTRUSTED_VOLATILE_GUEST *)pHeader + sizeof(VBOXSHGSMIHEADER);
    13631364}
    13641365
    1365 #define VBoxSHGSMIBufferHeaderSize() (sizeof (VBOXSHGSMIHEADER))
    1366 
    1367 DECLINLINE(PVBOXSHGSMIHEADER) VBoxSHGSMIBufferHeader (const void *pvData)
    1368 {
    1369     return (PVBOXSHGSMIHEADER)((uint8_t *)pvData - sizeof (VBOXSHGSMIHEADER));
     1366#define VBoxSHGSMIBufferHeaderSize() (sizeof(VBOXSHGSMIHEADER))
     1367
     1368DECLINLINE(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));
    13701371}
    13711372
     
    13911392    uint32_t u32Offset;
    13921393    int32_t  i32Result;
    1393 } VBOXVDMA_CTL, *PVBOXVDMA_CTL;
     1394} VBOXVDMA_CTL;
    13941395
    13951396typedef struct VBOXVDMA_RECTL
  • trunk/include/VBox/vmm/pdmifs.h

    r70596 r71590  
    715715
    716716/** Pointer to a 2D graphics acceleration command. */
    717 typedef struct VBOXVHWACMD *PVBOXVHWACMD;
     717typedef struct VBOXVHWACMD VBOXVHWACMD;
    718718/** Pointer to a VBVA command header. */
    719719typedef struct VBVACMDHDR *PVBVACMDHDR;
     
    842842     *
    843843     * @param   pInterface          Pointer to this interface.
     844     * @param   enmCmd              The command type (don't re-read from pCmd).
    844845     * @param   pCmd                Video HW Acceleration Command to be processed.
    845846     * @returns VINF_SUCCESS - command is completed,
     
    848849     * @thread  The emulation thread.
    849850     */
    850     DECLR3CALLBACKMEMBER(int, pfnVHWACommandProcess,(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVHWACMD pCmd));
     851    DECLR3CALLBACKMEMBER(int, pfnVHWACommandProcess,(PPDMIDISPLAYCONNECTOR pInterface, int enmCmd,
     852                                                     VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCmd));
    851853
    852854    /**
     
    22692271     *                              completed.
    22702272     */
    2271     DECLR3CALLBACKMEMBER(int, pfnVHWACommandCompleteAsync,(PPDMIDISPLAYVBVACALLBACKS pInterface, PVBOXVHWACMD pCmd));
     2273    DECLR3CALLBACKMEMBER(int, pfnVHWACommandCompleteAsync,(PPDMIDISPLAYVBVACALLBACKS pInterface,
     2274                                                           VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCmd));
    22722275
    22732276    DECLR3CALLBACKMEMBER(int, pfnCrHgsmiCommandCompleteAsync,(PPDMIDISPLAYVBVACALLBACKS pInterface,
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPCr.cpp

    r69500 r71590  
    1515 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
    1616 */
     17
    1718#ifdef VBOX_WITH_CROGL
    1819
     
    3738}
    3839
    39 static void* vboxMpCrShgsmiBufferAlloc(PVBOXMP_DEVEXT pDevExt, HGSMISIZE cbData)
     40static void RT_UNTRUSTED_VOLATILE_HOST *vboxMpCrShgsmiBufferAlloc(PVBOXMP_DEVEXT pDevExt, HGSMISIZE cbData)
    4041{
    4142    return VBoxSHGSMIHeapBufferAlloc(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx.heapCtx, cbData);
    4243}
    4344
    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)
     45static 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
     50static void RT_UNTRUSTED_VOLATILE_HOST *vboxMpCrShgsmiBufferFromOffset(PVBOXMP_DEVEXT pDevExt, VBOXVIDEOOFFSET offBuffer)
    5151{
    5252    return HGSMIOffsetToPointer(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx.heapCtx.Heap.area, (HGSMIOFFSET)offBuffer);
    5353}
    5454
    55 static void vboxMpCrShgsmiBufferFree(PVBOXMP_DEVEXT pDevExt, void *pvBuffer)
     55static void vboxMpCrShgsmiBufferFree(PVBOXMP_DEVEXT pDevExt, void RT_UNTRUSTED_VOLATILE_HOST *pvBuffer)
    5656{
    5757    VBoxSHGSMIHeapBufferFree(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx.heapCtx, pvBuffer);
    5858}
    5959
    60 static VBOXVIDEOOFFSET vboxMpCrShgsmiTransportBufOffset(PVBOXMP_CRSHGSMITRANSPORT pCon, void* pvBuffer)
     60static VBOXVIDEOOFFSET vboxMpCrShgsmiTransportBufOffset(PVBOXMP_CRSHGSMITRANSPORT pCon, void RT_UNTRUSTED_VOLATILE_HOST *pvBuffer)
    6161{
    6262    return vboxMpCrShgsmiBufferOffset(pCon->pDevExt, pvBuffer);
    6363}
    6464
    65 static void* vboxMpCrShgsmiTransportBufFromOffset(PVBOXMP_CRSHGSMITRANSPORT pCon, VBOXVIDEOOFFSET offBuffer)
     65static void RT_UNTRUSTED_VOLATILE_HOST *vboxMpCrShgsmiTransportBufFromOffset(PVBOXMP_CRSHGSMITRANSPORT pCon, VBOXVIDEOOFFSET offBuffer)
    6666{
    6767    return vboxMpCrShgsmiBufferFromOffset(pCon->pDevExt, offBuffer);
    6868}
    6969
    70 void* VBoxMpCrShgsmiTransportBufAlloc(PVBOXMP_CRSHGSMITRANSPORT pCon, uint32_t cbBuffer)
     70void RT_UNTRUSTED_VOLATILE_HOST *VBoxMpCrShgsmiTransportBufAlloc(PVBOXMP_CRSHGSMITRANSPORT pCon, uint32_t cbBuffer)
    7171{
    7272    return vboxMpCrShgsmiBufferAlloc(pCon->pDevExt, cbBuffer);
    7373}
    7474
    75 void VBoxMpCrShgsmiTransportBufFree(PVBOXMP_CRSHGSMITRANSPORT pCon, void* pvBuffer)
     75void VBoxMpCrShgsmiTransportBufFree(PVBOXMP_CRSHGSMITRANSPORT pCon, void RT_UNTRUSTED_VOLATILE_HOST *pvBuffer)
    7676{
    7777    vboxMpCrShgsmiBufferFree(pCon->pDevExt, pvBuffer);
     
    297297
    298298typedef 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);
    300301typedef FNVBOXMP_CRSHGSMITRANSPORT_SENDREADASYNC_COMPLETION *PFNVBOXMP_CRSHGSMITRANSPORT_SENDREADASYNC_COMPLETION;
    301302
     
    321322    VBOXVDMACMD_CHROMIUM_BUFFER *pRxBuf = &pBody->aBuffers[1];
    322323    PVBOXMP_CRSHGSMICON_BUFDR pWbDr = (PVBOXMP_CRSHGSMICON_BUFDR)pRxBuf->u64GuestData;
    323     void *pvRx = NULL;
     324    void RT_UNTRUSTED_VOLATILE_HOST *pvRx = NULL;
    324325    uint32_t cbRx = 0;
    325326
     
    418419} VBOXMP_CRHGSMICON_WRR_COMPLETION_CTX, *PVBOXMP_CRHGSMICON_WRR_COMPLETION_CTX;
    419420
     421/** @callback_method_impl{FNVBOXMP_CRSHGSMITRANSPORT_SENDREADASYNC_COMPLETION} */
    420422static 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)
    422425{
    423426    PVBOXMP_CRHGSMICON_WRR_COMPLETION_CTX pData = (PVBOXMP_CRHGSMICON_WRR_COMPLETION_CTX)pvCtx;
     
    448451    PVBOXMP_CRSHGSMICON_BUFDR pWbDr = (PVBOXMP_CRSHGSMICON_BUFDR)pRxBuf->u64GuestData;
    449452    PFNVBOXMP_CRSHGSMITRANSPORT_SENDWRITEREADASYNC_COMPLETION pfnCompletion = (PFNVBOXMP_CRSHGSMITRANSPORT_SENDWRITEREADASYNC_COMPLETION)pBufCmd->u64GuestData;
    450     void *pvRx = NULL;
     453    void RT_UNTRUSTED_VOLATILE_HOST *pvRx = NULL;
    451454    uint32_t cbRx = 0;
    452455
     
    552555}
    553556
    554 static DECLCALLBACK(VOID) vboxMpCrShgsmiTransportVbvaSendWriteAsyncCompletion(PVBOXSHGSMI pHeap, void *pvCmd, void *pvContext)
     557/** @callback_method_impl{FNVBOXSHGSMICMDCOMPLETION}   */
     558static DECLCALLBACK(VOID)
     559vboxMpCrShgsmiTransportVbvaSendWriteAsyncCompletion(PVBOXSHGSMI pHeap, void RT_UNTRUSTED_VOLATILE_HOST *pvCmd, void *pvContext)
    555560{
    556561    RT_NOREF(pHeap);
     
    559564
    560565    PVBOXMP_CRSHGSMITRANSPORT pCon = (PVBOXMP_CRSHGSMITRANSPORT)pvContext;
    561     VBOXCMDVBVA_CRCMD_CMD *pCmd;
     566    VBOXCMDVBVA_CRCMD_CMD RT_UNTRUSTED_VOLATILE_HOST *pCmd = NULL;
    562567    int rc = VBoxCmdVbvaConCmdCompletionData(pvCmd, &pCmd);
    563568    const UINT cBuffers = 2;
     
    581586    const uint32_t cbCmd = VBOXMP_CRSHGSMICON_DR_SIZE(cBuffers, sizeof (VBOXMP_CRHGSMICMD_WRITEREAD), cbContextData);
    582587    PVBOXMP_DEVEXT pDevExt = pCon->pDevExt;
    583     PVBOXVDMACBUF_DR pDr = vboxVdmaCBufDrCreate(&pDevExt->u.primary.Vdma, cbCmd);
     588    VBOXVDMACBUF_DR RT_UNTRUSTED_VOLATILE_HOST *pDr = vboxVdmaCBufDrCreate(&pDevExt->u.primary.Vdma, cbCmd);
    584589    if (!pDr)
    585590    {
     
    686691    const uint32_t cBuffers = 2;
    687692    const uint32_t cbCmd = VBOXMP_CRSHGSMICON_DR_SIZE(cBuffers, sizeof (VBOXMP_CRHGSMICMD_WRITE), cbContextData);
    688     PVBOXVDMACBUF_DR pDr = vboxVdmaCBufDrCreate(&pDevExt->u.primary.Vdma, cbCmd);
     693    VBOXVDMACBUF_DR RT_UNTRUSTED_VOLATILE_HOST *pDr = vboxVdmaCBufDrCreate(&pDevExt->u.primary.Vdma, cbCmd);
    689694    if (!pDr)
    690695    {
     
    11031108}
    11041109
    1105 int VBoxMpCrCmdRxReadbackHandler(CRMessageReadback *pRx, uint32_t cbRx)
    1106 {
    1107     if (cbRx < sizeof (*pRx))
     1110int VBoxMpCrCmdRxReadbackHandler(CRMessageReadback RT_UNTRUSTED_VOLATILE_HOST *pRx, uint32_t cbRx)
     1111{
     1112    if (cbRx < sizeof(*pRx))
    11081113    {
    11091114        WARN(("invalid rx size %d", cbRx));
    11101115        return VERR_INVALID_PARAMETER;
    11111116    }
    1112     void* pvData = VBoxMpCrCmdRxReadbackData(pRx);
     1117    void    *pvSrc = VBoxMpCrCmdRxReadbackData(pRx);
    11131118    uint32_t cbData = VBoxMpCrCmdRxReadbackDataSize(pRx, cbRx);
    1114     void *pvDataPtr = *((void**)&pRx->readback_ptr);
    1115     memcpy(pvDataPtr, pvData, cbData);
     1119    void    *pvDst = *((void**)&pRx->readback_ptr);
     1120    memcpy(pvDst, pvSrc, cbData);
    11161121    return VINF_SUCCESS;
    11171122}
    11181123
    1119 int VBoxMpCrCmdRxHandler(CRMessageHeader *pRx, uint32_t cbRx)
    1120 {
    1121     if (cbRx < sizeof (*pRx))
     1124int VBoxMpCrCmdRxHandler(CRMessageHeader RT_UNTRUSTED_VOLATILE_HOST *pRx, uint32_t cbRx)
     1125{
     1126    if (cbRx < sizeof(*pRx))
    11221127    {
    11231128        WARN(("invalid rx size %d", cbRx));
    11241129        return VERR_INVALID_PARAMETER;
    11251130    }
    1126     CRMessageHeader *pHdr = (CRMessageHeader*)pRx;
    1127     switch (pHdr->type)
     1131    CRMessageType enmType = pRx->type;
     1132    switch (enmType)
    11281133    {
    11291134        case CR_MESSAGE_READBACK:
    1130             return VBoxMpCrCmdRxReadbackHandler((CRMessageReadback*)pRx, cbRx);
     1135            return VBoxMpCrCmdRxReadbackHandler((CRMessageReadback RT_UNTRUSTED_VOLATILE_HOST *)pRx, cbRx);
    11311136        default:
    1132             WARN(("unsupported rx message type: %d", pHdr->type));
     1137            WARN(("unsupported rx message type: %d", enmType));
    11331138            return VERR_INVALID_PARAMETER;
    11341139    }
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPCr.h

    r69500 r71590  
    4545{
    4646    uint32_t cbBuf;
    47     void *pvBuf;
     47    void RT_UNTRUSTED_VOLATILE_HOST *pvBuf;
    4848} VBOXMP_CRSHGSMICON_BUFDR, *PVBOXMP_CRSHGSMICON_BUFDR;
    4949
     
    6262 * the callee must NOT free it or use outside of the callback context.
    6363 * */
    64 typedef DECLCALLBACK(void) FNVBOXMP_CRSHGSMITRANSPORT_SENDWRITEREADASYNC_COMPLETION(PVBOXMP_CRSHGSMITRANSPORT pCon, int rc, void *pvRx, uint32_t cbRx, void *pvCtx);
     64typedef DECLCALLBACK(void) FNVBOXMP_CRSHGSMITRANSPORT_SENDWRITEREADASYNC_COMPLETION(PVBOXMP_CRSHGSMITRANSPORT pCon, int rc,
     65                                                                                    void RT_UNTRUSTED_VOLATILE_HOST *pvRx,
     66                                                                                    uint32_t cbRx, void *pvCtx);
    6567typedef FNVBOXMP_CRSHGSMITRANSPORT_SENDWRITEREADASYNC_COMPLETION *PFNVBOXMP_CRSHGSMITRANSPORT_SENDWRITEREADASYNC_COMPLETION;
    6668
     
    7981void VBoxMpCrShgsmiTransportCmdTermWriteAsync(PVBOXMP_CRSHGSMITRANSPORT pCon, void *pvContext);
    8082
    81 void* VBoxMpCrShgsmiTransportBufAlloc(PVBOXMP_CRSHGSMITRANSPORT pCon, uint32_t cbBuffer);
    82 void VBoxMpCrShgsmiTransportBufFree(PVBOXMP_CRSHGSMITRANSPORT pCon, void* pvBuffer);
     83void RT_UNTRUSTED_VOLATILE_HOST *VBoxMpCrShgsmiTransportBufAlloc(PVBOXMP_CRSHGSMITRANSPORT pCon, uint32_t cbBuffer);
     84void VBoxMpCrShgsmiTransportBufFree(PVBOXMP_CRSHGSMITRANSPORT pCon, void RT_UNTRUSTED_VOLATILE_HOST *pvBuffer);
    8385
    8486typedef struct VBOXMP_CRPACKER
     
    98100}
    99101
    100 DECLINLINE(void) VBoxMpCrPackerTxBufferInit(PVBOXMP_CRPACKER pPacker, void *pvBuffer, uint32_t cbBuffer, uint32_t cCommands)
    101 {
    102     crPackInitBuffer(&pPacker->CrBuffer, pvBuffer, cbBuffer, cbBuffer, cCommands);
     102DECLINLINE(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);
    103106    crPackSetBuffer(&pPacker->CrPacker, &pPacker->CrBuffer);
    104107}
     
    190193}
    191194
    192 DECLINLINE(void*) VBoxMpCrCmdRxReadbackData(CRMessageReadback *pRx)
    193 {
    194     return pRx + 1;
    195 }
    196 
    197 DECLINLINE(uint32_t) VBoxMpCrCmdRxReadbackDataSize(CRMessageReadback *pRx, uint32_t cbRx)
     195DECLINLINE(void *) VBoxMpCrCmdRxReadbackData(CRMessageReadback RT_UNTRUSTED_VOLATILE_HOST *pRx)
     196{
     197    return (void *)(pRx + 1);
     198}
     199
     200DECLINLINE(uint32_t) VBoxMpCrCmdRxReadbackDataSize(CRMessageReadback RT_UNTRUSTED_VOLATILE_HOST *pRx, uint32_t cbRx)
    198201{
    199202    RT_NOREF(pRx);
    200203    return cbRx - sizeof(*pRx);
    201204}
    202 int VBoxMpCrCmdRxReadbackHandler(CRMessageReadback *pRx, uint32_t cbRx);
    203 int VBoxMpCrCmdRxHandler(CRMessageHeader *pRx, uint32_t cbRx);
     205int VBoxMpCrCmdRxReadbackHandler(CRMessageReadback RT_UNTRUSTED_VOLATILE_HOST *pRx, uint32_t cbRx);
     206int VBoxMpCrCmdRxHandler(CRMessageHeader RT_UNTRUSTED_VOLATILE_HOST *pRx, uint32_t cbRx);
    204207
    205208/* must be called after calling VBoxMpCrCtlConIs3DSupported only */
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPMisc.cpp

    r71196 r71590  
    13921392    UINT cbCmd = VBOXVDMACMD_SIZE_FROMBODYSIZE(RT_OFFSETOF(VBOXVDMACMD_CHROMIUM_CMD, aBuffers[cBuffers]));
    13931393
    1394     PVBOXVDMACBUF_DR pDr = vboxVdmaCBufDrCreate(&pDevExt->u.primary.Vdma, cbCmd);
     1394    VBOXVDMACBUF_DR RT_UNTRUSTED_VOLATILE_HOST *pDr = vboxVdmaCBufDrCreate(&pDevExt->u.primary.Vdma, cbCmd);
    13951395    if (pDr)
    13961396    {
     
    14381438        {
    14391439            PVBOXVDMADDI_CMD pDdiCmd = VBOXVDMADDI_CMD_FROM_BUF_DR(pDr);
    1440             vboxVdmaDdiCmdInit(pDdiCmd, 0, 0, vboxVideoAMgrAllocSubmitCompletion, pDr);
     1440            vboxVdmaDdiCmdInit(pDdiCmd, 0, 0, vboxVideoAMgrAllocSubmitCompletion, (void *)pDr);
    14411441            /* mark command as submitted & invisible for the dx runtime since dx did not originate it */
    14421442            vboxVdmaDdiCmdSubmittedNotDx(pDdiCmd);
     
    18081808{
    18091809    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);
    18121813    if (pCmd)
    18131814    {
     
    18451846        }
    18461847
    1847         VBoxSHGSMICommandFree (&VBoxCommonFromDeviceExt(pDevExt)->guestCtx.heapCtx, pCmd);
     1848        VBoxSHGSMICommandFree(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx.heapCtx, pCmd);
    18481849    }
    18491850    else
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPShgsmi.cpp

    r69500 r71590  
    2020
    2121/* SHGSMI */
    22 DECLINLINE(void) vboxSHGSMICommandRetain(PVBOXSHGSMIHEADER pCmd)
     22DECLINLINE(void) vboxSHGSMICommandRetain(VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *pCmd)
    2323{
    2424    ASMAtomicIncU32(&pCmd->cRefs);
    2525}
    2626
    27 void vboxSHGSMICommandFree(PVBOXSHGSMI pHeap, PVBOXSHGSMIHEADER pCmd)
     27void vboxSHGSMICommandFree(PVBOXSHGSMI pHeap, VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *pCmd)
    2828{
    2929    VBoxSHGSMIHeapFree(pHeap, pCmd);
    3030}
    3131
    32 DECLINLINE(void) vboxSHGSMICommandRelease(PVBOXSHGSMI pHeap, PVBOXSHGSMIHEADER pCmd)
     32DECLINLINE(void) vboxSHGSMICommandRelease(PVBOXSHGSMI pHeap, VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *pCmd)
    3333{
    3434    uint32_t cRefs = ASMAtomicDecU32(&pCmd->cRefs);
    3535    Assert(cRefs < UINT32_MAX / 2);
    3636    if(!cRefs)
    37         vboxSHGSMICommandFree (pHeap, pCmd);
    38 }
    39 
    40 static DECLCALLBACK(void) vboxSHGSMICompletionSetEvent(PVBOXSHGSMI pHeap, void *pvCmd, void *pvContext)
     37        vboxSHGSMICommandFree(pHeap, pCmd);
     38}
     39
     40static DECLCALLBACK(void) vboxSHGSMICompletionSetEvent(PVBOXSHGSMI pHeap, void RT_UNTRUSTED_VOLATILE_HOST *pvCmd, void *pvContext)
    4141{
    4242    RT_NOREF(pHeap, pvCmd);
     
    4444}
    4545
    46 DECLCALLBACK(void) vboxSHGSMICompletionCommandRelease(PVBOXSHGSMI pHeap, void *pvCmd, void *pvContext)
     46DECLCALLBACK(void) vboxSHGSMICompletionCommandRelease(PVBOXSHGSMI pHeap, void RT_UNTRUSTED_VOLATILE_HOST *pvCmd, void *pvContext)
    4747{
    4848    RT_NOREF(pvContext);
     
    5151
    5252/* do not wait for completion */
    53 DECLINLINE(const VBOXSHGSMIHEADER *) vboxSHGSMICommandPrepAsynch(PVBOXSHGSMI pHeap, PVBOXSHGSMIHEADER pHeader)
     53DECLINLINE(const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *)
     54vboxSHGSMICommandPrepAsynch(PVBOXSHGSMI pHeap, VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *pHeader)
    5455{
    5556    RT_NOREF(pHeap);
     
    5960}
    6061
    61 DECLINLINE(void) vboxSHGSMICommandDoneAsynch(PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER* pHeader)
     62DECLINLINE(void) vboxSHGSMICommandDoneAsynch(PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *pHeader)
    6263{
    6364    if(!(ASMAtomicReadU32((volatile uint32_t *)&pHeader->fFlags) & VBOXSHGSMI_FLAG_HG_ASYNCH))
     
    7172}
    7273
    73 const VBOXSHGSMIHEADER* VBoxSHGSMICommandPrepAsynchEvent(PVBOXSHGSMI pHeap, PVOID pvBuff, RTSEMEVENT hEventSem)
    74 {
    75     PVBOXSHGSMIHEADER pHeader = VBoxSHGSMIBufferHeader(pvBuff);
     74const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *
     75VBoxSHGSMICommandPrepAsynchEvent(PVBOXSHGSMI pHeap, void RT_UNTRUSTED_VOLATILE_HOST *pvBuff, RTSEMEVENT hEventSem)
     76{
     77    VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *pHeader = VBoxSHGSMIBufferHeader(pvBuff);
    7678    pHeader->u64Info1 = (uint64_t)vboxSHGSMICompletionSetEvent;
    7779    pHeader->u64Info2 = (uintptr_t)hEventSem;
     
    8183}
    8284
    83 const VBOXSHGSMIHEADER* VBoxSHGSMICommandPrepSynch(PVBOXSHGSMI pHeap, PVOID pCmd)
     85const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *VBoxSHGSMICommandPrepSynch(PVBOXSHGSMI pHeap,
     86                                                                              void  RT_UNTRUSTED_VOLATILE_HOST *pCmd)
    8487{
    8588    RTSEMEVENT hEventSem;
     
    9396}
    9497
    95 void VBoxSHGSMICommandDoneAsynch(PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER * pHeader)
     98void VBoxSHGSMICommandDoneAsynch(PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *pHeader)
    9699{
    97100    vboxSHGSMICommandDoneAsynch(pHeap, pHeader);
    98101}
    99102
    100 int VBoxSHGSMICommandDoneSynch(PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER* pHeader)
     103int VBoxSHGSMICommandDoneSynch(PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *pHeader)
    101104{
    102105    VBoxSHGSMICommandDoneAsynch(pHeap, pHeader);
     
    109112}
    110113
    111 void VBoxSHGSMICommandCancelAsynch(PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER* pHeader)
     114void VBoxSHGSMICommandCancelAsynch(PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *pHeader)
    112115{
    113116    vboxSHGSMICommandRelease(pHeap, (PVBOXSHGSMIHEADER)pHeader);
    114117}
    115118
    116 void VBoxSHGSMICommandCancelSynch (PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER* pHeader)
    117 {
    118     VBoxSHGSMICommandCancelAsynch (pHeap, pHeader);
     119void VBoxSHGSMICommandCancelSynch(PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *pHeader)
     120{
     121    VBoxSHGSMICommandCancelAsynch(pHeap, pHeader);
    119122    RTSEMEVENT hEventSem = (RTSEMEVENT)pHeader->u64Info2;
    120123    RTSemEventDestroy(hEventSem);
    121124}
    122125
    123 const VBOXSHGSMIHEADER* VBoxSHGSMICommandPrepAsynch(PVBOXSHGSMI pHeap, PVOID pvBuff, PFNVBOXSHGSMICMDCOMPLETION pfnCompletion,
    124                                                     PVOID pvCompletion, uint32_t fFlags)
     126const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *
     127VBoxSHGSMICommandPrepAsynch(PVBOXSHGSMI pHeap, void RT_UNTRUSTED_VOLATILE_HOST *pvBuff,
     128                            PFNVBOXSHGSMICMDCOMPLETION pfnCompletion, PVOID pvCompletion, uint32_t fFlags)
    125129{
    126130    fFlags &= ~VBOXSHGSMI_FLAG_GH_ASYNCH_CALLBACK_IRQ;
    127     PVBOXSHGSMIHEADER pHeader = VBoxSHGSMIBufferHeader (pvBuff);
     131    VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *pHeader = VBoxSHGSMIBufferHeader(pvBuff);
    128132    pHeader->u64Info1 = (uintptr_t)pfnCompletion;
    129133    pHeader->u64Info2 = (uintptr_t)pvCompletion;
    130134    pHeader->fFlags = fFlags;
    131135
    132     return vboxSHGSMICommandPrepAsynch (pHeap, pHeader);
    133 }
    134 
    135 const VBOXSHGSMIHEADER* VBoxSHGSMICommandPrepAsynchIrq(PVBOXSHGSMI pHeap, PVOID pvBuff,
    136                                                        PFNVBOXSHGSMICMDCOMPLETION_IRQ pfnCompletion, PVOID pvCompletion,
    137                                                        uint32_t fFlags)
     136    return vboxSHGSMICommandPrepAsynch(pHeap, pHeader);
     137}
     138
     139const VBOXSHGSMIHEADER  RT_UNTRUSTED_VOLATILE_HOST *
     140VBoxSHGSMICommandPrepAsynchIrq(PVBOXSHGSMI pHeap, void RT_UNTRUSTED_VOLATILE_HOST *pvBuff,
     141                               PFNVBOXSHGSMICMDCOMPLETION_IRQ pfnCompletion, PVOID pvCompletion, uint32_t fFlags)
    138142{
    139143    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);
    141145    pHeader->u64Info1 = (uintptr_t)pfnCompletion;
    142146    pHeader->u64Info2 = (uintptr_t)pvCompletion;
     
    144148    pHeader->fFlags = fFlags;
    145149
    146     return vboxSHGSMICommandPrepAsynch (pHeap, pHeader);
    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
     153void 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;
    153157    Assert(KeGetCurrentIrql() <= DISPATCH_LEVEL);
    154158    KeAcquireSpinLock(&pHeap->HeapLock, &OldIrql);
     
    160164}
    161165
    162 void VBoxSHGSMIHeapFree(PVBOXSHGSMI pHeap, void *pvBuffer)
     166void VBoxSHGSMIHeapFree(PVBOXSHGSMI pHeap, void RT_UNTRUSTED_VOLATILE_HOST *pvBuffer)
    163167{
    164168    KIRQL OldIrql;
     
    169173}
    170174
    171 void* VBoxSHGSMIHeapBufferAlloc(PVBOXSHGSMI pHeap, HGSMISIZE cbData)
    172 {
    173     KIRQL OldIrql;
    174     void* pvData;
     175void RT_UNTRUSTED_VOLATILE_HOST *VBoxSHGSMIHeapBufferAlloc(PVBOXSHGSMI pHeap, HGSMISIZE cbData)
     176{
     177    KIRQL OldIrql;
     178    void RT_UNTRUSTED_VOLATILE_HOST * pvData;
    175179    Assert(KeGetCurrentIrql() <= DISPATCH_LEVEL);
    176180    KeAcquireSpinLock(&pHeap->HeapLock, &OldIrql);
     
    182186}
    183187
    184 void VBoxSHGSMIHeapBufferFree(PVBOXSHGSMI pHeap, void *pvBuffer)
     188void VBoxSHGSMIHeapBufferFree(PVBOXSHGSMI pHeap, void RT_UNTRUSTED_VOLATILE_HOST *pvBuffer)
    185189{
    186190    KIRQL OldIrql;
     
    203207}
    204208
    205 void* VBoxSHGSMICommandAlloc(PVBOXSHGSMI pHeap, HGSMISIZE cbData, uint8_t u8Channel, uint16_t u16ChannelInfo)
     209void RT_UNTRUSTED_VOLATILE_HOST *VBoxSHGSMICommandAlloc(PVBOXSHGSMI pHeap, HGSMISIZE cbData, uint8_t u8Channel,
     210                                                        uint16_t u16ChannelInfo)
    206211{
    207212    /* 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);
    210216    Assert(pHeader);
    211217    if (pHeader)
     
    217223}
    218224
    219 void VBoxSHGSMICommandFree(PVBOXSHGSMI pHeap, void *pvBuffer)
    220 {
    221     PVBOXSHGSMIHEADER pHeader = VBoxSHGSMIBufferHeader(pvBuffer);
    222     vboxSHGSMICommandRelease (pHeap, pHeader);
     225void VBoxSHGSMICommandFree(PVBOXSHGSMI pHeap, void RT_UNTRUSTED_VOLATILE_HOST *pvBuffer)
     226{
     227    VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *pHeader = VBoxSHGSMIBufferHeader(pvBuffer);
     228    vboxSHGSMICommandRelease(pHeap, pHeader);
    223229}
    224230
     
    226232#define VBOXSHGSMI_LISTENTRY2CMD(_pEntry) ( (PVBOXSHGSMIHEADER)((uint8_t *)(_pEntry) - RT_OFFSETOF(VBOXSHGSMIHEADER, pvNext)) )
    227233
    228 int VBoxSHGSMICommandProcessCompletion (PVBOXSHGSMI pHeap, VBOXSHGSMIHEADER* pCur, bool bIrq, PVBOXVTLIST pPostProcessList)
     234int VBoxSHGSMICommandProcessCompletion(PVBOXSHGSMI pHeap, VBOXSHGSMIHEADER *pCur, bool bIrq, PVBOXVTLIST pPostProcessList)
    229235{
    230236    int rc = VINF_SUCCESS;
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPShgsmi.h

    r69500 r71590  
    3030} VBOXSHGSMI, *PVBOXSHGSMI;
    3131
    32 typedef DECLCALLBACK(void) FNVBOXSHGSMICMDCOMPLETION(PVBOXSHGSMI pHeap, void *pvCmd, void *pvContext);
     32typedef DECLCALLBACK(void) FNVBOXSHGSMICMDCOMPLETION(PVBOXSHGSMI pHeap, void RT_UNTRUSTED_VOLATILE_HOST *pvCmd, void *pvContext);
    3333typedef FNVBOXSHGSMICMDCOMPLETION *PFNVBOXSHGSMICMDCOMPLETION;
    3434
    35 typedef DECLCALLBACK(PFNVBOXSHGSMICMDCOMPLETION) FNVBOXSHGSMICMDCOMPLETION_IRQ(PVBOXSHGSMI pHeap, void *pvCmd, void *pvContext, void **ppvCompletion);
     35typedef DECLCALLBACK(PFNVBOXSHGSMICMDCOMPLETION) FNVBOXSHGSMICMDCOMPLETION_IRQ(PVBOXSHGSMI pHeap,
     36                                                                               void RT_UNTRUSTED_VOLATILE_HOST *pvCmd,
     37                                                                               void *pvContext, void **ppvCompletion);
    3638typedef FNVBOXSHGSMICMDCOMPLETION_IRQ *PFNVBOXSHGSMICMDCOMPLETION_IRQ;
    3739
    3840
    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);
     41const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *
     42    VBoxSHGSMICommandPrepAsynchEvent(PVBOXSHGSMI pHeap, PVOID pvBuff, RTSEMEVENT hEventSem);
     43const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *
     44    VBoxSHGSMICommandPrepSynch(PVBOXSHGSMI pHeap, void RT_UNTRUSTED_VOLATILE_HOST *pvCmd);
     45const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *
     46    VBoxSHGSMICommandPrepAsynch(PVBOXSHGSMI pHeap, void RT_UNTRUSTED_VOLATILE_HOST *pvBuff,
     47                                PFNVBOXSHGSMICMDCOMPLETION pfnCompletion,  PVOID pvCompletion, uint32_t fFlags);
     48const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *
     49    VBoxSHGSMICommandPrepAsynchIrq(PVBOXSHGSMI pHeap, void RT_UNTRUSTED_VOLATILE_HOST *pvBuff,
     50                                   PFNVBOXSHGSMICMDCOMPLETION_IRQ pfnCompletion, PVOID pvCompletion, uint32_t fFlags);
    4351
    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);
     52void VBoxSHGSMICommandDoneAsynch(PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *pHeader);
     53int  VBoxSHGSMICommandDoneSynch(PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *pHeader);
     54void VBoxSHGSMICommandCancelAsynch(PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *pHeader);
     55void VBoxSHGSMICommandCancelSynch(PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *pHeader);
    4856
    49 DECLINLINE(HGSMIOFFSET) VBoxSHGSMICommandOffset(const PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER* pHeader)
     57DECLINLINE(HGSMIOFFSET) VBoxSHGSMICommandOffset(const PVBOXSHGSMI pHeap, const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *pHeader)
    5058{
    5159    return HGSMIHeapBufferOffset(&pHeap->Heap, (void*)pHeader);
     
    6169int VBoxSHGSMIInit(PVBOXSHGSMI pHeap, void *pvBase, HGSMISIZE cbArea, HGSMIOFFSET offBase, const HGSMIENV *pEnv);
    6270void 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);
     71void RT_UNTRUSTED_VOLATILE_HOST *VBoxSHGSMIHeapAlloc(PVBOXSHGSMI pHeap, HGSMISIZE cbData, uint8_t u8Channel, uint16_t u16ChannelInfo);
     72void VBoxSHGSMIHeapFree(PVBOXSHGSMI pHeap, void RT_UNTRUSTED_VOLATILE_HOST *pvBuffer);
     73void RT_UNTRUSTED_VOLATILE_HOST *VBoxSHGSMIHeapBufferAlloc(PVBOXSHGSMI pHeap, HGSMISIZE cbData);
     74void VBoxSHGSMIHeapBufferFree(PVBOXSHGSMI pHeap, void RT_UNTRUSTED_VOLATILE_HOST *pvBuffer);
     75void RT_UNTRUSTED_VOLATILE_HOST *VBoxSHGSMICommandAlloc(PVBOXSHGSMI pHeap, HGSMISIZE cbData, uint8_t u8Channel, uint16_t u16ChannelInfo);
     76void VBoxSHGSMICommandFree(PVBOXSHGSMI pHeap, void RT_UNTRUSTED_VOLATILE_HOST *pvBuffer);
    6977int VBoxSHGSMICommandProcessCompletion(PVBOXSHGSMI pHeap, VBOXSHGSMIHEADER* pCmd, bool bIrq, struct VBOXVTLIST * pPostProcessList);
    7078int VBoxSHGSMICommandPostprocessCompletion(PVBOXSHGSMI pHeap, struct VBOXVTLIST * pPostProcessList);
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVbva.cpp

    r69500 r71590  
    123123#define vboxCmdVbvaSubmit vboxCmdVbvaSubmitHgsmi
    124124
    125 static VBOXCMDVBVA_CTL * vboxCmdVbvaCtlCreate(PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, uint32_t cbCtl)
     125static VBOXCMDVBVA_CTL RT_UNTRUSTED_VOLATILE_HOST *vboxCmdVbvaCtlCreate(PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, uint32_t cbCtl)
    126126{
    127127    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
     132static void vboxCmdVbvaCtlFree(PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, VBOXCMDVBVA_CTL RT_UNTRUSTED_VOLATILE_HOST *pCtl)
    132133{
    133134    VBoxSHGSMICommandFree(&pHGSMICtx->heapCtx, pCtl);
    134135}
    135136
    136 static int vboxCmdVbvaCtlSubmitSync(PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, VBOXCMDVBVA_CTL * pCtl)
    137 {
    138     const VBOXSHGSMIHEADER* pHdr = VBoxSHGSMICommandPrepSynch(&pHGSMICtx->heapCtx, pCtl);
     137static int vboxCmdVbvaCtlSubmitSync(PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, VBOXCMDVBVA_CTL RT_UNTRUSTED_VOLATILE_HOST *pCtl)
     138{
     139    const VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_HOST *pHdr = VBoxSHGSMICommandPrepSynch(&pHGSMICtx->heapCtx, pCtl);
    139140    if (!pHdr)
    140141    {
     
    176177static int vboxCmdVbvaCtlSubmitAsync(PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, VBOXCMDVBVA_CTL * pCtl, FNVBOXSHGSMICMDCOMPLETION pfnCompletion, void *pvCompletion)
    177178{
    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);
    179181    HGSMIOFFSET offCmd = VBoxSHGSMICommandOffset(&pHGSMICtx->heapCtx, pHdr);
    180182    if (offCmd == HGSMIOFFSET_VOID)
     
    191193        return rc;
    192194    }
    193     else
    194         WARN(("vboxCmdVbvaSubmit returnd %d", rc));
    195 
     195
     196    WARN(("vboxCmdVbvaSubmit returnd %d", rc));
    196197    VBoxSHGSMICommandCancelAsynch(&pHGSMICtx->heapCtx, pHdr);
    197 
    198198    return rc;
    199199}
     
    201201static int vboxVBVAExCtlSubmitEnableDisable(PVBVAEXBUFFERCONTEXT pCtx, PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, bool fEnable)
    202202{
    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));
    204205    if (!pCtl)
    205206    {
     
    210211    pCtl->Hdr.u32Type = VBOXCMDVBVACTL_TYPE_ENABLE;
    211212    pCtl->Hdr.i32Result = VERR_NOT_IMPLEMENTED;
    212     memset(&pCtl->Enable, 0, sizeof (pCtl->Enable));
     213    memset((void *)&pCtl->Enable, 0, sizeof(pCtl->Enable));
    213214    pCtl->Enable.u32Flags  = fEnable? VBVA_F_ENABLE: VBVA_F_DISABLE;
    214215    pCtl->Enable.u32Offset = pCtx->offVRAMBuffer;
     
    12321233        uint32_t *pu32ClientID)
    12331234{
    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));
    12351238    if (!pConnect)
    12361239    {
     
    12681271int vboxCmdVbvaConDisconnect(PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, uint32_t u32ClientID)
    12691272{
    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));
    12711275    if (!pDisconnect)
    12721276    {
     
    13311335void vboxCmdVbvaConCmdFree(PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, VBOXCMDVBVA_CRCMD_CMD *pCmd)
    13321336{
    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;
    13341338    vboxCmdVbvaCtlFree(pHGSMICtx, &pHdr->Hdr);
    13351339}
     
    13511355}
    13521356
    1353 int VBoxCmdVbvaConCmdSubmitAsync(PVBOXMP_DEVEXT pDevExt, VBOXCMDVBVA_CRCMD_CMD* pCmd, FNVBOXSHGSMICMDCOMPLETION pfnCompletion, void *pvCompletion)
     1357int VBoxCmdVbvaConCmdSubmitAsync(PVBOXMP_DEVEXT pDevExt, VBOXCMDVBVA_CRCMD_CMD* pCmd,
     1358                                 PFNVBOXSHGSMICMDCOMPLETION pfnCompletion, void *pvCompletion)
    13541359{
    13551360    return vboxCmdVbvaConSubmitAsync(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, pCmd, pfnCompletion, pvCompletion);
    13561361}
    13571362
    1358 int VBoxCmdVbvaConCmdCompletionData(void *pvCmd, VBOXCMDVBVA_CRCMD_CMD **ppCmd)
    1359 {
    1360     VBOXCMDVBVA_CTL_3DCTL_CMD *pCmd = (VBOXCMDVBVA_CTL_3DCTL_CMD*)pvCmd;
     1363int 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;
    13611366    if (ppCmd)
    1362         *ppCmd = (VBOXCMDVBVA_CRCMD_CMD*)(pCmd+1);
     1367        *ppCmd = (VBOXCMDVBVA_CRCMD_CMD RT_UNTRUSTED_VOLATILE_HOST *)(pCmd + 1);
    13631368    return pCmd->Hdr.i32Result;
    13641369}
     
    13681373    Assert(KeGetCurrentIrql() < DISPATCH_LEVEL);
    13691374
    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));
    13711378    if (!pResize)
    13721379    {
     
    13811388    if (RT_SUCCESS(rc))
    13821389    {
    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));
    13851392        LOG(("[%d] %dx%d, TargetMap0 0x%x, flags 0x%x",
    13861393            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  
    239239VBOXCMDVBVA_CRCMD_CMD* VBoxCmdVbvaConCmdAlloc(PVBOXMP_DEVEXT pDevExt, uint32_t cbCmd);
    240240void 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);
     241int VBoxCmdVbvaConCmdSubmitAsync(PVBOXMP_DEVEXT pDevExt, VBOXCMDVBVA_CRCMD_CMD* pCmd,
     242                                 PFNVBOXSHGSMICMDCOMPLETION pfnCompletion, void *pvCompletion);
     243int VBoxCmdVbvaConCmdCompletionData(void RT_UNTRUSTED_VOLATILE_HOST *pvCmd, VBOXCMDVBVA_CRCMD_CMD RT_UNTRUSTED_VOLATILE_HOST **ppCmd);
    243244int VBoxCmdVbvaConCmdResize(PVBOXMP_DEVEXT pDevExt, const VBOXWDDM_ALLOC_DATA *pAllocData, const uint32_t *pTargetMap, const POINT * pVScreenPos, uint16_t fFlags);
    244245#endif /* #ifdef VBOX_WITH_CROGL */
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVdma.cpp

    r69500 r71590  
    342342}
    343343
    344 NTSTATUS vboxVdmaCrSubmitWriteReadAsync(PVBOXMP_DEVEXT pDevExt, VBOXMP_CRPACKER *pCrPacker, uint32_t u32CrConClientID, PFNVBOXMP_CRSHGSMITRANSPORT_SENDWRITEREADASYNC_COMPLETION pfnCompletion, void *pvCompletion)
     344NTSTATUS vboxVdmaCrSubmitWriteReadAsync(PVBOXMP_DEVEXT pDevExt, VBOXMP_CRPACKER *pCrPacker, uint32_t u32CrConClientID,
     345                                        PFNVBOXMP_CRSHGSMITRANSPORT_SENDWRITEREADASYNC_COMPLETION pfnCompletion, void *pvCompletion)
    345346{
    346347    Assert(u32CrConClientID);
     
    547548            }
    548549
    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);
    554555            if (!pvCommandBuffer)
    555556            {
     
    603604    }
    604605
    605     void *pvCommandBuffer = VBoxMpCrShgsmiTransportBufAlloc(&pDevExt->CrHgsmiTransport, cbCommandBuffer);
     606    void RT_UNTRUSTED_VOLATILE_HOST *pvCommandBuffer = VBoxMpCrShgsmiTransportBufAlloc(&pDevExt->CrHgsmiTransport, cbCommandBuffer);
    606607    if (!pvCommandBuffer)
    607608    {
     
    878879} VBOXVDMA_CRRXGENERICSYNC, *PVBOXVDMA_CRRXGENERICSYNC;
    879880
    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}   */
     882static DECLCALLBACK(void) vboxVdmaCrRxGenericSyncCompletion(PVBOXMP_CRSHGSMITRANSPORT pCon, int rc,
     883                                                            void RT_UNTRUSTED_VOLATILE_HOST *pvRx, uint32_t cbRx, void *pvCtx)
    881884{
    882885    PVBOXMP_VDMACR_WRITEREADCOMPLETION pvCompletionData = (PVBOXMP_VDMACR_WRITEREADCOMPLETION)pvCtx;
     
    884887    if (RT_SUCCESS(rc))
    885888    {
    886         rc = VBoxMpCrCmdRxHandler((CRMessageHeader*)pvRx, cbRx);
     889        rc = VBoxMpCrCmdRxHandler((CRMessageHeader *)pvRx, cbRx);
    887890        if (!RT_SUCCESS(rc))
    888891        {
     
    927930{
    928931    VBOXMP_CRPACKER CrPacker;
    929     void *pvCommandBuffer;
     932    void RT_UNTRUSTED_VOLATILE_HOST *pvCommandBuffer;
    930933} VBOXMP_CRHGSMIMGR;
    931934
     
    10951098    uint32_t cbCommandBuffer = VBOXMP_CRCMD_HEADER_SIZE + VBOXMP_CRCMD_SIZE_VBOXTEXPRESENT(cRects);
    10961099    uint32_t cCommands = 1;
    1097     void *pvCommandBuffer = VBoxMpCrShgsmiTransportBufAlloc(&pDevExt->CrHgsmiTransport, cbCommandBuffer);
     1100    void RT_UNTRUSTED_VOLATILE_HOST *pvCommandBuffer = VBoxMpCrShgsmiTransportBufAlloc(&pDevExt->CrHgsmiTransport, cbCommandBuffer);
    10981101    if (!pvCommandBuffer)
    10991102    {
     
    11251128    uint32_t cbCommandBuffer = VBOXMP_CRCMD_HEADER_SIZE + VBOXMP_CRCMD_SIZE_CHROMIUMPARAMETERICR;
    11261129    uint32_t cCommands = 1;
    1127     void *pvCommandBuffer = VBoxMpCrShgsmiTransportBufAlloc(&pDevExt->CrHgsmiTransport, cbCommandBuffer);
     1130    void RT_UNTRUSTED_VOLATILE_HOST *pvCommandBuffer = VBoxMpCrShgsmiTransportBufAlloc(&pDevExt->CrHgsmiTransport, cbCommandBuffer);
    11281131    if (!pvCommandBuffer)
    11291132    {
     
    15281531    int rc = VINF_SUCCESS;
    15291532
    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);
    15311536    if (pCmd)
    15321537    {
     
    15351540        pCmd->i32Result = VERR_NOT_SUPPORTED;
    15361541
    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);
    15381544        Assert(pHdr);
    15391545        if (pHdr)
     
    15661572        }
    15671573
    1568         VBoxSHGSMICommandFree (&VBoxCommonFromDeviceExt(pDevExt)->guestCtx.heapCtx, pCmd);
     1574        VBoxSHGSMICommandFree(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx.heapCtx, pCmd);
    15691575    }
    15701576    else
     
    17141720
    17151721#ifdef VBOX_WITH_VDMA
    1716 void vboxVdmaCBufDrFree (PVBOXVDMAINFO pInfo, PVBOXVDMACBUF_DR pDr)
    1717 {
    1718     VBoxSHGSMICommandFree (&pInfo->CmdHeap, pDr);
    1719 }
    1720 
    1721 PVBOXVDMACBUF_DR vboxVdmaCBufDrCreate (PVBOXVDMAINFO pInfo, uint32_t cbTrailingData)
     1722void vboxVdmaCBufDrFree(PVBOXVDMAINFO pInfo, VBOXVDMACBUF_DR RT_UNTRUSTED_VOLATILE_HOST *pDr)
     1723{
     1724    VBoxSHGSMICommandFree(&pInfo->CmdHeap, pDr);
     1725}
     1726
     1727VBOXVDMACBUF_DR RT_UNTRUSTED_VOLATILE_HOST *vboxVdmaCBufDrCreate(PVBOXVDMAINFO pInfo, uint32_t cbTrailingData)
    17221728{
    17231729    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);
    17251732    Assert(pDr);
    17261733    if (pDr)
    1727         memset (pDr, 0, cbDr);
     1734        memset((void *)pDr, 0, cbDr);
    17281735    else
    17291736        LOGREL(("VBoxSHGSMICommandAlloc returned NULL"));
     
    17411748}
    17421749
    1743 static DECLCALLBACK(PFNVBOXSHGSMICMDCOMPLETION) vboxVdmaCBufDrCompletionIrq(PVBOXSHGSMI pHeap, void *pvCmd,
    1744                                                                             void *pvContext, void **ppvCompletion)
     1750/** @callback_method_impl{FNVBOXSHGSMICMDCOMPLETION_IRQ} */
     1751static DECLCALLBACK(PFNVBOXSHGSMICMDCOMPLETION)
     1752vboxVdmaCBufDrCompletionIrq(PVBOXSHGSMI pHeap, void RT_UNTRUSTED_VOLATILE_HOST *pvCmd, void *pvContext, void **ppvCompletion)
    17451753{
    17461754    RT_NOREF(pHeap, ppvCompletion);
    17471755    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;
    17491757
    17501758    DXGK_INTERRUPT_TYPE enmComplType;
     
    17561764    else if (pDr->rc == VERR_INTERRUPTED)
    17571765    {
    1758         Assert(0);
     1766        AssertFailed();
    17591767        enmComplType = DXGK_INTERRUPT_DMA_PREEMPTED;
    17601768    }
    17611769    else
    17621770    {
    1763         Assert(0);
     1771        AssertFailed();
    17641772        enmComplType = DXGK_INTERRUPT_DMA_FAULTED;
    17651773    }
     
    17751783}
    17761784
    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);
     1785int 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);
    17801789    Assert(pHdr);
    17811790    int rc = VERR_GENERAL_FAILURE;
     
    18081817}
    18091818
    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);
     1819int 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);
    18131823    Assert(pHdr);
    18141824    int rc = VERR_GENERAL_FAILURE;
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVdma.h

    r69500 r71590  
    7171NTSTATUS vboxVdmaDdiCmdSubmitted(PVBOXMP_DEVEXT pDevExt, PVBOXVDMADDI_CMD pCmd);
    7272
    73 DECLINLINE(VOID) vboxVdmaDdiCmdInit(PVBOXVDMADDI_CMD pCmd,
    74         uint32_t u32NodeOrdinal, uint32_t u32FenceId,
    75         PFNVBOXVDMADDICMDCOMPLETE_DPC pfnComplete, PVOID pvComplete)
     73DECLINLINE(VOID) vboxVdmaDdiCmdInit(PVBOXVDMADDI_CMD pCmd, uint32_t u32NodeOrdinal, uint32_t u32FenceId,
     74                                    PFNVBOXVDMADDICMDCOMPLETE_DPC pfnComplete, PVOID pvComplete)
    7675{
    7776    pCmd->QueueEntry.Blink = NULL;
     
    283282    return VBoxSHGSMICommandPtrOffset(&pInfo->CmdHeap, pvPtr);
    284283}
    285 int vboxVdmaCBufDrSubmit(PVBOXMP_DEVEXT pDevExt, PVBOXVDMAINFO pInfo, PVBOXVDMACBUF_DR pDr);
    286 int vboxVdmaCBufDrSubmitSynch(PVBOXMP_DEVEXT pDevExt, PVBOXVDMAINFO pInfo, PVBOXVDMACBUF_DR pDr);
    287 struct VBOXVDMACBUF_DR* vboxVdmaCBufDrCreate(PVBOXVDMAINFO pInfo, uint32_t cbTrailingData);
    288 void vboxVdmaCBufDrFree(PVBOXVDMAINFO pInfo, struct VBOXVDMACBUF_DR* pDr);
     284int vboxVdmaCBufDrSubmit(PVBOXMP_DEVEXT pDevExt, PVBOXVDMAINFO pInfo, VBOXVDMACBUF_DR RT_UNTRUSTED_VOLATILE_HOST *pDr);
     285int vboxVdmaCBufDrSubmitSynch(PVBOXMP_DEVEXT pDevExt, PVBOXVDMAINFO pInfo, VBOXVDMACBUF_DR RT_UNTRUSTED_VOLATILE_HOST *pDr);
     286struct VBOXVDMACBUF_DR RT_UNTRUSTED_VOLATILE_HOST *vboxVdmaCBufDrCreate(PVBOXVDMAINFO pInfo, uint32_t cbTrailingData);
     287void vboxVdmaCBufDrFree(PVBOXVDMAINFO pInfo, struct VBOXVDMACBUF_DR RT_UNTRUSTED_VOLATILE_HOST *pDr);
    289288
    290289#define VBOXVDMACBUF_DR_DATA_OFFSET() (sizeof (VBOXVDMACBUF_DR))
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVhwa.cpp

    r69500 r71590  
    2727
    2828
    29 DECLINLINE(void) vboxVhwaHdrInit(VBOXVHWACMD* pHdr, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId, VBOXVHWACMD_TYPE enmCmd)
    30 {
    31     memset(pHdr, 0, sizeof(VBOXVHWACMD));
     29DECLINLINE(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));
    3233    pHdr->iDisplay = srcId;
    3334    pHdr->rc = VERR_GENERAL_FAILURE;
     
    3940
    4041#ifdef VBOXVHWA_WITH_SHGSMI
    41 static int vboxVhwaCommandSubmitHgsmi(struct _DEVICE_EXTENSION* pDevExt, HGSMIOFFSET offDr)
     42static int vboxVhwaCommandSubmitHgsmi(struct _DEVICE_EXTENSION *pDevExt, HGSMIOFFSET offDr)
    4243{
    4344    VBoxHGSMIGuestWrite(pDevExt, offDr);
     
    4546}
    4647#else
    47 DECLINLINE(void) vbvaVhwaCommandRelease(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD* pCmd)
     48DECLINLINE(void) vbvaVhwaCommandRelease(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *pCmd)
    4849{
    4950    uint32_t cRefs = ASMAtomicDecU32(&pCmd->cRefs);
     
    5556}
    5657
    57 DECLINLINE(void) vbvaVhwaCommandRetain(VBOXVHWACMD *pCmd)
     58DECLINLINE(void) vbvaVhwaCommandRetain(VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *pCmd)
    5859{
    5960    ASMAtomicIncU32(&pCmd->cRefs);
     
    6162
    6263/* do not wait for completion */
    63 void vboxVhwaCommandSubmitAsynch(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD* pCmd, PFNVBOXVHWACMDCOMPLETION pfnCompletion, void *pContext)
     64void vboxVhwaCommandSubmitAsynch(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *pCmd,
     65                                 PFNVBOXVHWACMDCOMPLETION pfnCompletion, void *pContext)
    6466{
    6567    pCmd->GuestVBVAReserved1 = (uintptr_t)pfnCompletion;
     
    6971    VBoxHGSMIBufferSubmit(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, pCmd);
    7072
    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) ) )
    7477    {
    7578        /* the command is completed */
     
    8083}
    8184
    82 static DECLCALLBACK(void) vboxVhwaCompletionSetEvent(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD * pCmd, void * pvContext)
    83 {
    84     RT_NOREF(pDevExt,  pCmd);
     85/** @callback_method_impl{FNVBOXVHWACMDCOMPLETION} */
     86static DECLCALLBACK(void)
     87vboxVhwaCompletionSetEvent(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *pCmd, void *pvContext)
     88{
     89    RT_NOREF(pDevExt, pCmd);
    8590    RTSemEventSignal((RTSEMEVENT)pvContext);
    8691}
    8792
    88 void vboxVhwaCommandSubmitAsynchByEvent(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD* pCmd, RTSEMEVENT hEvent)
     93void vboxVhwaCommandSubmitAsynchByEvent(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *pCmd, RTSEMEVENT hEvent)
    8994{
    9095    vboxVhwaCommandSubmitAsynch(pDevExt, pCmd, vboxVhwaCompletionSetEvent, hEvent);
     
    98103}
    99104
    100 VBOXVHWACMD* vboxVhwaCommandCreate(PVBOXMP_DEVEXT pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId, VBOXVHWACMD_TYPE enmCmd, VBOXVHWACMD_LENGTH cbCmd)
     105VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *vboxVhwaCommandCreate(PVBOXMP_DEVEXT pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId,
     106                                                              VBOXVHWACMD_TYPE enmCmd, VBOXVHWACMD_LENGTH cbCmd)
    101107{
    102108    vboxVhwaCommandCheckCompletion(pDevExt);
     109    VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *pHdr;
    103110#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);
    108115#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);
    113120#endif
    114121    Assert(pHdr);
    115122    if (!pHdr)
    116     {
    117123        LOGREL(("VBoxHGSMIBufferAlloc failed"));
    118     }
    119124    else
    120     {
    121125        vboxVhwaHdrInit(pHdr, srcId, enmCmd);
    122     }
    123126
    124127    return pHdr;
    125128}
    126129
    127 void vboxVhwaCommandFree(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD* pCmd)
     130void vboxVhwaCommandFree(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *pCmd)
    128131{
    129132#ifdef VBOXVHWA_WITH_SHGSMI
     
    134137}
    135138
    136 int vboxVhwaCommandSubmit(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD* pCmd)
     139int vboxVhwaCommandSubmit(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *pCmd)
    137140{
    138141#ifdef VBOXVHWA_WITH_SHGSMI
     
    184187
    185188#ifndef VBOXVHWA_WITH_SHGSMI
    186 static DECLCALLBACK(void) vboxVhwaCompletionFreeCmd(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD *pCmd, void *pvContext)
     189/** @callback_method_impl{FNVBOXVHWACMDCOMPLETION} */
     190static DECLCALLBACK(void)
     191vboxVhwaCompletionFreeCmd(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *pCmd, void *pvContext)
    187192{
    188193    RT_NOREF(pvContext);
     
    197202        /* need to save next since the command may be released in a pfnCallback and thus its data might be invalid */
    198203        pNext = pCur->pNext;
    199         VBOXVHWACMD *pCmd = VBOXVHWA_LISTENTRY2CMD(pCur);
     204        VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *pCmd = VBOXVHWA_LISTENTRY2CMD(pCur);
    200205        PFNVBOXVHWACMDCOMPLETION pfnCallback = (PFNVBOXVHWACMDCOMPLETION)pCmd->GuestVBVAReserved1;
    201206        void *pvCallback = (void*)pCmd->GuestVBVAReserved2;
     
    206211#endif
    207212
    208 void vboxVhwaCommandSubmitAsynchAndComplete(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD* pCmd)
     213void vboxVhwaCommandSubmitAsynchAndComplete(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *pCmd)
    209214{
    210215#ifdef VBOXVHWA_WITH_SHGSMI
     
    231236VBOXVHWACMD_QUERYINFO1* vboxVhwaQueryHostInfo1(PVBOXMP_DEVEXT pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId)
    232237{
    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);
    244243    pInfo1->u.in.guestVersion.maj = VBOXVHWA_VERSION_MAJ;
    245244    pInfo1->u.in.guestVersion.min = VBOXVHWA_VERSION_MIN;
     
    249248    int rc = vboxVhwaCommandSubmit(pDevExt, pCmd);
    250249    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))
    255252            return VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_QUERYINFO1);
    256         }
    257     }
    258253
    259254    vboxVhwaCommandFree(pDevExt, pCmd);
     
    263258VBOXVHWACMD_QUERYINFO2* vboxVhwaQueryHostInfo2(PVBOXMP_DEVEXT pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId, uint32_t numFourCC)
    264259{
    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);
    275265    pInfo2->numFourCC = numFourCC;
    276266
     
    295285int vboxVhwaEnable(PVBOXMP_DEVEXT pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId)
    296286{
    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);
    309291    AssertRC(rc);
    310292    if(RT_SUCCESS(rc))
     
    325307    vboxVhwaCommandCheckCompletion(pDevExt);
    326308
    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);
    339313    AssertRC(rc);
    340     if(RT_SUCCESS(rc))
     314    if (RT_SUCCESS(rc))
    341315    {
    342316        if(RT_SUCCESS(pCmd->rc))
     
    511485        return VERR_INVALID_STATE;
    512486
    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));
    515489    Assert(pCmd);
    516     if(pCmd)
     490    if (pCmd)
    517491    {
    518492        VBOXVHWACMD_SURF_DESTROY * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_DESTROY);
     
    636610{
    637611    /* 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));
    640614    Assert(pCmd);
    641615    if (pCmd)
     
    671645{
    672646    /* 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));
    675649    Assert(pCmd);
    676650    if (pCmd)
     
    844818        PVBOXWDDM_OVERLAYFLIP_INFO pOurInfo = (PVBOXWDDM_OVERLAYFLIP_INFO)pFlipInfo->pPrivateDriverData;
    845819
    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));
    848823        Assert(pCmd);
    849         if(pCmd)
     824        if (pCmd)
    850825        {
    851826            VBOXVHWACMD_SURF_FLIP * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_FLIP);
     
    915890
    916891    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]));
    919895    Assert(pCmd);
    920896    if(pCmd)
     
    1003979        PVBOXWDDM_OVERLAY_INFO pOurInfo = (PVBOXWDDM_OVERLAY_INFO)pOverlayInfo->pPrivateDriverData;
    1004980
    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));
    1007984        Assert(pCmd);
    1008         if(pCmd)
     985        if (pCmd)
    1009986        {
    1010987            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  
    2323#include "VBoxMPShgsmi.h"
    2424
    25 VBOXVHWACMD* vboxVhwaCommandCreate(PVBOXMP_DEVEXT pDevExt,
    26         D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId,
    27         VBOXVHWACMD_TYPE enmCmd,
    28         VBOXVHWACMD_LENGTH cbCmd);
     25VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST * vboxVhwaCommandCreate(PVBOXMP_DEVEXT pDevExt,
     26                                                               D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId,
     27                                                               VBOXVHWACMD_TYPE enmCmd,
     28                                                               VBOXVHWACMD_LENGTH cbCmd);
    2929
    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);
     30void vboxVhwaCommandFree(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *pCmd);
     31int  vboxVhwaCommandSubmit(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST * pCmd);
     32void vboxVhwaCommandSubmitAsynchAndComplete(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *pCmd);
    3433
    3534#ifndef VBOXVHWA_WITH_SHGSMI
    36 typedef DECLCALLBACK(void) FNVBOXVHWACMDCOMPLETION(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD * pCmd, void * pContext);
     35typedef DECLCALLBACK(void) FNVBOXVHWACMDCOMPLETION(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST * pCmd,
     36                                                   void *pvContext);
    3737typedef FNVBOXVHWACMDCOMPLETION *PFNVBOXVHWACMDCOMPLETION;
    3838
    39 void vboxVhwaCommandSubmitAsynch(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD* pCmd, PFNVBOXVHWACMDCOMPLETION pfnCompletion, void * pContext);
    40 void vboxVhwaCommandSubmitAsynchByEvent(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD* pCmd, RTSEMEVENT hEvent);
     39void vboxVhwaCommandSubmitAsynch(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *pCmd,
     40                                 PFNVBOXVHWACMDCOMPLETION pfnCompletion, void * pContext);
     41void vboxVhwaCommandSubmitAsynchByEvent(PVBOXMP_DEVEXT pDevExt, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *pCmd, RTSEMEVENT hEvent);
    4142
    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)) )
    4445
    45 DECLINLINE(void) vboxVhwaPutList(VBOXVTLIST *pList, VBOXVHWACMD* pCmd)
     46DECLINLINE(void) vboxVhwaPutList(VBOXVTLIST *pList, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_HOST *pCmd)
    4647{
    4748    vboxVtListPut(pList, VBOXVHWA_CMD2LISTENTRY(pCmd), VBOXVHWA_CMD2LISTENTRY(pCmd));
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.cpp

    r71514 r71590  
    211211int vboxWddmGhDisplayPostInfoScreen(PVBOXMP_DEVEXT pDevExt, const VBOXWDDM_ALLOC_DATA *pAllocData, const POINT * pVScreenPos, uint16_t fFlags)
    212212{
    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)
    218219    {
    219220        WARN(("VBoxHGSMIBufferAlloc failed"));
    220 
    221221        return VERR_OUT_OF_RESOURCES;
    222222    }
    223 
    224     VBVAINFOSCREEN *pScreen = (VBVAINFOSCREEN *)p;
    225223
    226224    int rc = vboxWddmScreenInfoInit(pScreen, pAllocData, pVScreenPos, fFlags);
    227225    if (RT_SUCCESS(rc))
    228226    {
    229         pScreen->u32StartOffset  = 0; //(uint32_t)offVram; /* we pretend the view is located at the start of each framebuffer */
    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);
    232230        if (RT_FAILURE(rc))
    233231            WARN(("VBoxHGSMIBufferSubmit failed %d", rc));
     
    236234        WARN(("VBoxHGSMIBufferSubmit failed %d", rc));
    237235
    238     VBoxHGSMIBufferFree (&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, p);
     236    VBoxHGSMIBufferFree(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, pScreen);
    239237
    240238    return rc;
     
    251249
    252250    /* 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)
    258255    {
    259256        WARN(("VBoxHGSMIBufferAlloc failed"));
    260257        return VERR_OUT_OF_RESOURCES;
    261258    }
    262 
    263     VBVAINFOVIEW *pView = (VBVAINFOVIEW *)p;
    264 
    265259    pView->u32ViewIndex     = pAllocData->SurfDesc.VidPnSourceId;
    266260    pView->u32ViewOffset    = (uint32_t)offVram; /* we pretend the view is located at the start of each framebuffer */
    267261    pView->u32ViewSize      = vboxWddmVramCpuVisibleSegmentSize(pDevExt)/VBoxCommonFromDeviceExt(pDevExt)->cDisplays;
    268 
    269262    pView->u32MaxScreenSize = pView->u32ViewSize;
    270263
    271     int rc = VBoxHGSMIBufferSubmit (&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, p);
     264    int rc = VBoxHGSMIBufferSubmit (&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, pView);
    272265    if (RT_FAILURE(rc))
    273266        WARN(("VBoxHGSMIBufferSubmit failed %d", rc));
    274267
    275     VBoxHGSMIBufferFree (&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, p);
    276 
     268    VBoxHGSMIBufferFree(&VBoxCommonFromDeviceExt(pDevExt)->guestCtx, pView);
    277269    return rc;
    278270}
     
    15611553
    15621554            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);
    15641557            if (!pvCmd)
    15651558            {
     
    15721565                case VBVA_CMDVBVA_CTL:
    15731566                {
    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);
    15751569                    AssertRC(rc);
    15761570                    break;
     
    17181712                    {
    17191713                        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);
    17211716                        Assert(pvCmd);
    17221717                        if (pvCmd)
     
    39623957            }
    39633958            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);
    39653960            Assert(pDr);
    39663961            if (pDr)
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.h

    r71323 r71590  
    164164}
    165165
    166 DECLINLINE(int) vboxWddmScreenInfoInit(VBVAINFOSCREEN *pScreen, const VBOXWDDM_ALLOC_DATA *pAllocData, const POINT * pVScreenPos, uint16_t fFlags)
     166DECLINLINE(int) vboxWddmScreenInfoInit(VBVAINFOSCREEN RT_UNTRUSTED_VOLATILE_HOST *pScreen,
     167                                       const VBOXWDDM_ALLOC_DATA *pAllocData, const POINT * pVScreenPos, uint16_t fFlags)
    167168{
    168169    VBOXVIDEOOFFSET offVram = vboxWddmAddrFramOffset(&pAllocData->Addr);
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/xpdm/VBoxMPInternal.cpp

    r69500 r71590  
    452452
    453453static DECLCALLBACK(int)
    454 VBoxVbvaChannelGenericHandlerCB(void *pvHandler, uint16_t u16ChannelInfo, void *pvBuffer, HGSMISIZE cbBuffer)
     454VBoxVbvaChannelGenericHandlerCB(void *pvHandler, uint16_t u16ChannelInfo,
     455                                void RT_UNTRUSTED_VOLATILE_HOST *pvBuffer, HGSMISIZE cbBuffer)
    455456{
    456457    VBVA_CHANNELCONTEXTS *pCallbacks = (VBVA_CHANNELCONTEXTS*)pvHandler;
  • trunk/src/VBox/Additions/common/VBoxVideo/HGSMIBase.cpp

    r69309 r71590  
    6060DECLHIDDEN(int) VBoxHGSMIReportFlagsLocation(PHGSMIGUESTCOMMANDCONTEXT pCtx, HGSMIOFFSET offLocation)
    6161{
    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);
    6767    if (!p)
    6868        return VERR_NO_MEMORY;
     
    9090DECLHIDDEN(int) VBoxHGSMISendCapsInfo(PHGSMIGUESTCOMMANDCONTEXT pCtx, uint32_t fCaps)
    9191{
    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);
    9696
    9797    if (!p)
  • trunk/src/VBox/Additions/common/VBoxVideo/HGSMIBuffers.cpp

    r69309 r71590  
    7272 * @param  u16Op    the HGSMI command to be sent, set to the descriptor
    7373 */
    74 DECLHIDDEN(void *) VBoxHGSMIBufferAlloc(PHGSMIGUESTCOMMANDCONTEXT pCtx,
    75                                         HGSMISIZE cbData,
    76                                         uint8_t u8Ch,
    77                                         uint16_t u16Op)
     74DECLHIDDEN(void RT_UNTRUSTED_VOLATILE_HOST *) VBoxHGSMIBufferAlloc(PHGSMIGUESTCOMMANDCONTEXT pCtx,
     75                                                                   HGSMISIZE cbData,
     76                                                                   uint8_t u8Ch,
     77                                                                   uint16_t u16Op)
    7878{
    7979#ifdef VBOX_WDDM_MINIPORT
    80     return VBoxSHGSMIHeapAlloc (&pCtx->heapCtx, cbData, u8Ch, u16Op);
     80    return VBoxSHGSMIHeapAlloc(&pCtx->heapCtx, cbData, u8Ch, u16Op);
    8181#else
    82     return HGSMIHeapAlloc (&pCtx->heapCtx, cbData, u8Ch, u16Op);
     82    return HGSMIHeapAlloc(&pCtx->heapCtx, cbData, u8Ch, u16Op);
    8383#endif
    8484}
     
    9191 * @param  pvBuffer  the pointer returned by @a VBoxHGSMIBufferAlloc
    9292 */
    93 DECLHIDDEN(void) VBoxHGSMIBufferFree(PHGSMIGUESTCOMMANDCONTEXT pCtx,
    94                                      void *pvBuffer)
     93DECLHIDDEN(void) VBoxHGSMIBufferFree(PHGSMIGUESTCOMMANDCONTEXT pCtx, void  RT_UNTRUSTED_VOLATILE_HOST *pvBuffer)
    9594{
    9695#ifdef VBOX_WDDM_MINIPORT
    97     VBoxSHGSMIHeapFree (&pCtx->heapCtx, pvBuffer);
     96    VBoxSHGSMIHeapFree(&pCtx->heapCtx, pvBuffer);
    9897#else
    99     HGSMIHeapFree (&pCtx->heapCtx, pvBuffer);
     98    HGSMIHeapFree(&pCtx->heapCtx, pvBuffer);
    10099#endif
    101100}
     
    107106 * @param  pvBuffer  the pointer returned by @a VBoxHGSMIBufferAlloc
    108107 */
    109 DECLHIDDEN(int) VBoxHGSMIBufferSubmit(PHGSMIGUESTCOMMANDCONTEXT pCtx,
    110                                       void *pvBuffer)
     108DECLHIDDEN(int) VBoxHGSMIBufferSubmit(PHGSMIGUESTCOMMANDCONTEXT pCtx, void RT_UNTRUSTED_VOLATILE_HOST *pvBuffer)
    111109{
    112110    /* Initialize the buffer and get the offset for port IO. */
    113     HGSMIOFFSET offBuffer = HGSMIHeapBufferOffset (HGSMIGUESTCMDHEAP_GET(&pCtx->heapCtx), pvBuffer);
     111    HGSMIOFFSET offBuffer = HGSMIHeapBufferOffset(HGSMIGUESTCMDHEAP_GET(&pCtx->heapCtx), pvBuffer);
    114112
    115113    Assert(offBuffer != HGSMIOFFSET_VOID);
  • trunk/src/VBox/Additions/common/VBoxVideo/HGSMIHostCmd.cpp

    r69309 r71590  
    7676 *                be completed
    7777 */
    78 DECLHIDDEN(void) VBoxHGSMIHostCmdComplete(PHGSMIHOSTCOMMANDCONTEXT pCtx,
    79                                           void *pvMem)
    80 {
    81     HGSMIBUFFERHEADER *pHdr = HGSMIBufferHeaderFromData(pvMem);
     78DECLHIDDEN(void) VBoxHGSMIHostCmdComplete(PHGSMIHOSTCOMMANDCONTEXT pCtx, void RT_UNTRUSTED_VOLATILE_HOST *pvMem)
     79{
     80    HGSMIBUFFERHEADER RT_UNTRUSTED_VOLATILE_GUEST *pHdr = HGSMIBufferHeaderFromData(pvMem);
    8281    HGSMIOFFSET offMem = HGSMIPointerToOffset(&pCtx->areaCtx, pHdr);
    8382    Assert(offMem != HGSMIOFFSET_VOID);
    84     if(offMem != HGSMIOFFSET_VOID)
    85     {
     83    if (offMem != HGSMIOFFSET_VOID)
    8684        HGSMINotifyHostCmdComplete(pCtx, offMem);
    87     }
    8885}
    8986
  • trunk/src/VBox/Additions/common/VBoxVideo/Modesetting.cpp

    r71488 r71590  
    152152    int rc;
    153153    /* 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);
    160160        if (RT_SUCCESS(rc))
    161             VBoxHGSMIBufferSubmit (pCtx, p);
    162         VBoxHGSMIBufferFree(pCtx, p);
     161            VBoxHGSMIBufferSubmit(pCtx, pInfo);
     162        VBoxHGSMIBufferFree(pCtx, pInfo);
    163163    }
    164164    else
     
    294294{
    295295    /* 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    {
    308301        pScreen->u32ViewIndex    = cDisplay;
    309302        pScreen->i32OriginX      = cOriginX;
     
    316309        pScreen->u16Flags        = fFlags;
    317310
    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"));
    321318    }
    322319}
     
    338335                                                 uint32_t cWidth, uint32_t cHeight)
    339336{
    340     int rc = VINF_SUCCESS;
     337    int rc;
    341338    VBVAREPORTINPUTMAPPING *p;
    342339    // Log(("%s: cOriginX=%d, cOriginY=%d, cWidth=%u, cHeight=%u\n", __PRETTY_FUNCTION__, (int)cOriginX, (int)cOriginX,
     
    377374{
    378375    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    {
    397385        pQuery->cHintsQueried        = cScreens;
    398386        pQuery->cbHintStructureGuest = sizeof(VBVAMODEHINT);
    399387        pQuery->rc                   = VERR_NOT_SUPPORTED;
    400388
    401         VBoxHGSMIBufferSubmit(pCtx, p);
     389        VBoxHGSMIBufferSubmit(pCtx, pQuery);
    402390        rc = pQuery->rc;
    403391        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;
    408400    }
    409401    return rc;
  • trunk/src/VBox/Additions/common/VBoxVideo/VBVABase.cpp

    r69309 r71590  
    5656
    5757
    58 static bool vboxVBVAInformHost(PVBVABUFFERCONTEXT pCtx,
    59                                PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx,
    60                                int32_t cScreen, bool bEnable)
    61 {
    62     bool bRc = false;
     58static bool vboxVBVAInformHost(PVBVABUFFERCONTEXT pCtx, PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, int32_t cScreen, bool fEnable)
     59{
     60    bool fRc = false;
    6361
    6462#if 0  /* All callers check this */
     
    6664#endif
    6765    {
    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;
    8172            pEnable->Base.u32Offset = pCtx->offVRAMBuffer;
    8273            pEnable->Base.i32Result = VERR_NOT_SUPPORTED;
     
    8778            }
    8879
    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);
    9584            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;
    10596}
    10697
     
    112103                                VBVABUFFER *pVBVA, int32_t cScreen)
    113104{
    114     bool bRc = false;
     105    bool fRc = false;
    115106
    116107    // LogFlowFunc(("pVBVA %p\n", pVBVA));
     
    136127        pCtx->pVBVA      = pVBVA;
    137128
    138         bRc = vboxVBVAInformHost(pCtx, pHGSMICtx, cScreen, true);
    139     }
    140 
    141     if (!bRc)
     129        fRc = vboxVBVAInformHost(pCtx, pHGSMICtx, cScreen, true);
     130    }
     131
     132    if (!fRc)
    142133    {
    143134        VBoxVBVADisable(pCtx, pHGSMICtx, cScreen);
    144135    }
    145136
    146     return bRc;
     137    return fRc;
    147138}
    148139
     
    158149
    159150    vboxVBVAInformHost(pCtx, pHGSMICtx, cScreen, false);
    160 
    161     return;
    162151}
    163152
     
    165154                                           PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx)
    166155{
    167     bool bRc = false;
     156    bool fRc = false;
    168157
    169158    // LogFunc(("flags = 0x%08X\n", pCtx->pVBVA? pCtx->pVBVA->u32HostEvents: -1));
     
    205194            pCtx->pRecord = pRecord;
    206195
    207             bRc = true;
    208         }
    209     }
    210 
    211     return bRc;
     196            fRc = true;
     197        }
     198    }
     199
     200    return fRc;
    212201}
    213202
     
    228217    pCtx->fHwBufferOverflow = false;
    229218    pCtx->pRecord = NULL;
    230 
    231     return;
    232219}
    233220
     
    245232{
    246233    /* 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
    252245    {
    253246        // LogFunc(("HGSMIHeapAlloc failed\n"));
    254247    }
    255     else
    256     {
    257         VBVAFLUSH *pFlush = (VBVAFLUSH *)p;
    258 
    259         pFlush->u32Reserved = 0;
    260 
    261         VBoxHGSMIBufferSubmit(pCtx, p);
    262 
    263         VBoxHGSMIBufferFree(pCtx, p);
    264     }
    265 
    266     return;
    267248}
    268249
     
    286267        memcpy (&pVBVA->au8Data[0], (uint8_t *)p + u32BytesTillBoundary, i32Diff);
    287268    }
    288 
    289     return;
    290269}
    291270
  • trunk/src/VBox/Additions/x11/vboxvideo/HGSMIMemAlloc.h

    r69346 r71590  
    4848
    4949int 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);
    5252void HGSMIMAUninit(HGSMIMADATA *pMA);
    5353
    54 void *HGSMIMAAlloc(HGSMIMADATA *pMA, HGSMISIZE cb);
    55 void HGSMIMAFree(HGSMIMADATA *pMA, void *pv);
     54void RT_UNTRUSTED_VOLATILE_GUEST *HGSMIMAAlloc(HGSMIMADATA *pMA, HGSMISIZE cb);
     55void HGSMIMAFree(HGSMIMADATA *pMA, void RT_UNTRUSTED_VOLATILE_GUEST *pv);
    5656
    5757RT_C_DECLS_END
  • trunk/src/VBox/Additions/x11/vboxvideo/VBoxVideoIPRT.h

    r69346 r71590  
    9494  } while (0)
    9595# define AssertPtr assert
     96# define AssertPtrReturn(pv, rcRet) do { assert(pv); if (pv) {} else return(rcRet); } while(0)
    9697# define AssertRC(expr) assert (!expr)
    9798#else
     
    99100# define AssertFailed() do { } while(0)
    100101# 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)
    102104# define AssertRC(expr) do { } while(0)
    103105#endif
     
    136138# define UINT32_C(Value) (Value ## U)
    137139#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
    138146
    139147#define likely _X_LIKELY
  • trunk/src/VBox/Additions/x11/vboxvideo/hgsmimemalloc.c

    r69346 r71590  
    3535 * submit and free pattern, we replace the generic allocator with a simple
    3636 * Boolean.  Need more be said?
     37 *
     38 * bird> Yes, it's buggy. You never set fAllocated. See HGSMIMAAlloc().
    3739 */
    3840
     
    6466}
    6567
    66 static HGSMIOFFSET HGSMIMAPointerToOffset(const HGSMIMADATA *pMA, const void *pv)
     68static HGSMIOFFSET HGSMIMAPointerToOffset(const HGSMIMADATA *pMA, const void RT_UNTRUSTED_VOLATILE_GUEST *pv)
    6769{
    6870    if (HGSMIAreaContainsPointer(&pMA->area, pv))
    69     {
    7071        return HGSMIPointerToOffset(&pMA->area, pv);
    71     }
    7272
    7373    AssertFailed();
     
    7575}
    7676
    77 static void *HGSMIMAOffsetToPointer(const HGSMIMADATA *pMA, HGSMIOFFSET off)
     77static void RT_UNTRUSTED_VOLATILE_GUEST *HGSMIMAOffsetToPointer(const HGSMIMADATA *pMA, HGSMIOFFSET off)
    7878{
    7979    if (HGSMIAreaContainsOffset(&pMA->area, off))
    80     {
    8180        return HGSMIOffsetToPointer(&pMA->area, off);
    82     }
    8381
    8482    AssertFailed();
     
    8684}
    8785
    88 void *HGSMIMAAlloc(HGSMIMADATA *pMA, HGSMISIZE cb)
     86void RT_UNTRUSTED_VOLATILE_GUEST *HGSMIMAAlloc(HGSMIMADATA *pMA, HGSMISIZE cb)
    8987{
    9088    (void)cb;
     
    9391    HGSMIOFFSET off = pMA->area.offBase;
    9492    return HGSMIMAOffsetToPointer(pMA, off);
    95     pMA->fAllocated = true;
     93    pMA->fAllocated = true; /** @todo r=bird: Errr. what's this doing *after* the return statement? */
    9694}
    9795
    98 void HGSMIMAFree(HGSMIMADATA *pMA, void *pv)
     96void HGSMIMAFree(HGSMIMADATA *pMA, void RT_UNTRUSTED_VOLATILE_GUEST *pv)
    9997{
    10098    HGSMIOFFSET off = HGSMIMAPointerToOffset(pMA, pv);
    10199    if (off != HGSMIOFFSET_VOID)
    102     {
    103100        pMA->fAllocated = false;
    104     }
    105101    else
    106     {
    107102        AssertFailed();
    108     }
    109103}
     104
  • trunk/src/VBox/Devices/Graphics/DevVGA.h

    r71146 r71590  
    204204{
    205205    RTLISTNODE Node;
    206     PVBOXVHWACMD pCommand;
     206    VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCommand;
    207207} VBOX_VHWA_PENDINGCMD;
    208208#endif
     
    521521void VBVARaiseIrq(PVGASTATE pVGAState, uint32_t fFlags);
    522522
    523 int VBVAInfoView(PVGASTATE pVGAState, const VBVAINFOVIEW *pView);
    524 int VBVAInfoScreen(PVGASTATE pVGAState, const VBVAINFOSCREEN *pScreen);
     523int VBVAInfoView(PVGASTATE pVGAState, const VBVAINFOVIEW RT_UNTRUSTED_VOLATILE_HOST *pView);
     524int VBVAInfoScreen(PVGASTATE pVGAState, const VBVAINFOSCREEN RT_UNTRUSTED_VOLATILE_HOST *pScreen);
    525525int VBVAGetInfoViewAndScreen(PVGASTATE pVGAState, uint32_t u32ViewIndex, VBVAINFOVIEW *pView, VBVAINFOSCREEN *pScreen);
    526526
     
    531531
    532532# ifdef VBOX_WITH_VIDEOHWACCEL
    533 DECLCALLBACK(int) vbvaVHWACommandCompleteAsync(PPDMIDISPLAYVBVACALLBACKS pInterface, PVBOXVHWACMD pCmd);
     533DECLCALLBACK(int) vbvaVHWACommandCompleteAsync(PPDMIDISPLAYVBVACALLBACKS pInterface, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCmd);
    534534int vbvaVHWAConstruct(PVGASTATE pVGAState);
    535535int vbvaVHWAReset(PVGASTATE pVGAState);
     
    577577void vboxVDMADestruct(PVBOXVDMAHOST pVdma);
    578578void vboxVDMAReset(PVBOXVDMAHOST pVdma);
    579 void vboxVDMAControl(PVBOXVDMAHOST pVdma, PVBOXVDMA_CTL pCmd, uint32_t cbCmd);
    580 void vboxVDMACommand(PVBOXVDMAHOST pVdma, PVBOXVDMACBUF_DR pCmd, uint32_t cbCmd);
     579void vboxVDMAControl(PVBOXVDMAHOST pVdma, VBOXVDMA_CTL RT_UNTRUSTED_VOLATILE_GUEST *pCmd, uint32_t cbCmd);
     580void vboxVDMACommand(PVBOXVDMAHOST pVdma, VBOXVDMACBUF_DR RT_UNTRUSTED_VOLATILE_GUEST *pCmd, uint32_t cbCmd);
    581581int vboxVDMASaveStateExecPrep(struct VBOXVDMAHOST *pVdma);
    582582int vboxVDMASaveStateExecDone(struct VBOXVDMAHOST *pVdma);
     
    589589int vboxCmdVBVACmdSubmit(PVGASTATE pVGAState);
    590590int vboxCmdVBVACmdFlush(PVGASTATE pVGAState);
    591 int vboxCmdVBVACmdCtl(PVGASTATE pVGAState, VBOXCMDVBVA_CTL *pCtl, uint32_t cbCtl);
     591int vboxCmdVBVACmdCtl(PVGASTATE pVGAState, VBOXCMDVBVA_CTL RT_UNTRUSTED_VOLATILE_GUEST *pCtl, uint32_t cbCtl);
    592592void vboxCmdVBVATimerRefresh(PVGASTATE pVGAState);
    593593bool vboxCmdVBVAIsEnabled(PVGASTATE pVGAState);
  • trunk/src/VBox/Devices/Graphics/DevVGA_VBVA.cpp

    r70604 r71590  
    726726}
    727727
    728 static int vbvaMousePointerShape(PVGASTATE pVGAState, VBVACONTEXT *pCtx, const VBVAMOUSEPOINTERSHAPE *pShape, HGSMISIZE cbShape)
    729 {
    730     const VBVAMOUSEPOINTERSHAPE parms = *pShape;
     728static 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));
    731733    ASMCompilerBarrier();
    732734
     
    794796        if (pCtx->mouseShapeInfo.pu8Shape)
    795797        {
    796             memcpy(pCtx->mouseShapeInfo.pu8Shape, &pShape->au8Data[0], cbPointerData);
     798            memcpy(pCtx->mouseShapeInfo.pu8Shape, (void *)&pShape->au8Data[0], cbPointerData);
    797799            pCtx->mouseShapeInfo.cbShape = cbPointerData;
    798800        }
     
    804806}
    805807
    806 static uint32_t vbvaViewFromBufferPtr(PHGSMIINSTANCE pIns, const VBVACONTEXT *pCtx, const void *pvBuffer)
     808static uint32_t vbvaViewFromBufferPtr(PHGSMIINSTANCE pIns, const VBVACONTEXT *pCtx,
     809                                      const void RT_UNTRUSTED_VOLATILE_GUEST *pvBuffer)
    807810{
    808811    /* Check which view contains the buffer. */
     
    904907}
    905908
    906 static void vbvaVHWACommandComplete(PVGASTATE pVGAState, PVBOXVHWACMD pCommand, bool fAsyncCommand)
     909static void vbvaVHWACommandComplete(PVGASTATE pVGAState, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCommand, bool fAsyncCommand)
    907910{
    908911    if (fAsyncCommand)
     
    959962}
    960963
    961 static void vbvaVHWACommandPend(PVGASTATE pVGAState, PVBOXVHWACMD pCommand)
     964static void vbvaVHWACommandPend(PVGASTATE pVGAState, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCommand)
    962965{
    963966    int rc = VERR_BUFFER_OVERFLOW;
     
    995998}
    996999
    997 static bool vbvaVHWACommandCanPend(PVBOXVHWACMD pCommand)
    998 {
    999     switch (pCommand->enmCmd)
     1000static bool vbvaVHWACommandCanPend(VBOXVHWACMD_TYPE enmCmd)
     1001{
     1002    switch (enmCmd)
    10001003    {
    10011004        case VBOXVHWACMD_TYPE_HH_CONSTRUCT:
     
    10371040        rc = SSMR3GetU32(pSSM, &off32);
    10381041        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);
    10401044        vbvaVHWACommandPend(pVGAState, pCommand);
    10411045    }
     
    10441048
    10451049
    1046 static bool vbvaVHWACommandSubmit(PVGASTATE pVGAState, PVBOXVHWACMD pCommand, bool fAsyncCommand)
    1047 {
     1050static bool vbvaVHWACommandSubmit(PVGASTATE pVGAState, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCommand, bool fAsyncCommand)
     1051{
     1052    VBOXVHWACMD_TYPE enmCmd = pCommand->enmCmd;
     1053    ASMCompilerBarrier();
     1054
    10481055    bool fPend = false;
    1049 
    10501056    if (pVGAState->pDrv->pfnVHWACommandProcess)
    10511057    {
    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);
    10541060        if (rc == VINF_CALLBACK_RETURN)
    10551061        {
    1056             Log(("VGA Command --- Going Async %#p, %d\n", pCommand, pCommand->enmCmd));
     1062            Log(("VGA Command --- Going Async %#p, %d\n", pCommand, enmCmd));
    10571063            return true; /* command will be completed asynchronously, return right away */
    10581064        }
    10591065        if (rc == VERR_INVALID_STATE)
    10601066        {
    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);
    10631069            if (!fPend)
    10641070            {
    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));
    10661072                pCommand->rc = rc;
    10671073            }
    10681074            else
    1069                 Log(("VGA Command --- Can Pend %#p, %d\n", pCommand, pCommand->enmCmd));
     1075                Log(("VGA Command --- Can Pend %#p, %d\n", pCommand, enmCmd));
    10701076        }
    10711077        else
    10721078        {
    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));
    10741080            pCommand->rc = rc;
    10751081        }
     
    11221128    vbvaVHWACheckPendingCommands(pVGAState);
    11231129}
    1124 static void vbvaVHWAHandleCommand(PVGASTATE pVGAState, PVBOXVHWACMD pCmd)
     1130static void vbvaVHWAHandleCommand(PVGASTATE pVGAState, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCmd)
    11251131{
    11261132    if (vbvaVHWACheckPendingCommands(pVGAState))
     
    13421348}
    13431349
    1344 DECLCALLBACK(int) vbvaVHWACommandCompleteAsync(PPDMIDISPLAYVBVACALLBACKS pInterface, PVBOXVHWACMD pCmd)
     1350DECLCALLBACK(int) vbvaVHWACommandCompleteAsync(PPDMIDISPLAYVBVACALLBACKS pInterface, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCmd)
    13451351{
    13461352    int rc;
     
    13621368#endif
    13631369        {
    1364             VBVAHOSTCMD *pHostCmd = NULL; /* Shut up MSC. */
     1370            VBVAHOSTCMD RT_UNTRUSTED_VOLATILE_GUEST *pHostCmd = NULL; /* Shut up MSC. */
    13651371            if (pCmd->Flags & VBOXVHWACMD_FLAG_GH_ASYNCH_EVENT)
    13661372            {
    13671373                rc = HGSMIHostCommandAlloc(pIns,
    1368                                            (void **)&pHostCmd,
     1374                                           (void RT_UNTRUSTED_VOLATILE_GUEST **)&pHostCmd,
    13691375                                           VBVAHOSTCMD_SIZE(sizeof(VBVAHOSTCMDEVENT)),
    13701376                                           HGSMI_CH_VBVA,
     
    13731379                if (RT_SUCCESS(rc))
    13741380                {
    1375                     memset(pHostCmd, 0 , VBVAHOSTCMD_SIZE(sizeof(VBVAHOSTCMDEVENT)));
     1381                    memset((void *)pHostCmd, 0 , VBVAHOSTCMD_SIZE(sizeof(VBVAHOSTCMDEVENT)));
    13761382                    pHostCmd->iDstID = pCmd->iDisplay;
    13771383                    pHostCmd->customOpCode = 0;
     
    13871393                {
    13881394                    rc = HGSMIHostCommandAlloc(pIns,
    1389                                                (void **)&pHostCmd,
     1395                                               (void RT_UNTRUSTED_VOLATILE_GUEST **)&pHostCmd,
    13901396                                               VBVAHOSTCMD_SIZE(sizeof(VBVAHOSTCMDVHWACMDCOMPLETE)),
    13911397                                               HGSMI_CH_VBVA,
     
    13941400                    if (RT_SUCCESS(rc))
    13951401                    {
    1396                         memset(pHostCmd, 0 , VBVAHOSTCMD_SIZE(sizeof(VBVAHOSTCMDVHWACMDCOMPLETE)));
     1402                        memset((void *)pHostCmd, 0 , VBVAHOSTCMD_SIZE(sizeof(VBVAHOSTCMDVHWACMDCOMPLETE)));
    13971403                        pHostCmd->iDstID = pCmd->iDisplay;
    13981404                        pHostCmd->customOpCode = VBVAHG_DCUSTOM_VHWA_CMDCOMPLETE;
     
    21052111}
    21062112
    2107 static int vbvaHandleQueryConf32(PVGASTATE pVGAState, VBVACONF32 volatile *pConf32)
     2113static int vbvaHandleQueryConf32(PVGASTATE pVGAState, VBVACONF32 RT_UNTRUSTED_VOLATILE_GUEST *pConf32)
    21082114{
    21092115    int rc = VINF_SUCCESS;
     
    21122118
    21132119    const uint32_t u32Index = pConf32->u32Index;
     2120    ASMCompilerBarrier();
    21142121
    21152122    LogFlowFunc(("VBVA_QUERY_CONF32: u32Index %d, u32Value 0x%x\n",
     
    21552162}
    21562163
    2157 static int vbvaHandleSetConf32(PVGASTATE pVGAState, VBVACONF32 *pConf32)
     2164static int vbvaHandleSetConf32(PVGASTATE pVGAState, VBVACONF32 RT_UNTRUSTED_VOLATILE_GUEST *pConf32)
    21582165{
    21592166    NOREF(pVGAState);
    21602167
    2161     int rc = VINF_SUCCESS;
    2162     const VBVACONF32 parms = *pConf32;
     2168    VBVACONF32 parms;
     2169    parms.u32Index = pConf32->u32Index;
     2170    parms.u32Value = pConf32->u32Value;
    21632171    ASMCompilerBarrier();
    21642172
     
    21662174                 parms.u32Index, parms.u32Value));
    21672175
     2176    int rc = VINF_SUCCESS;
    21682177    if (parms.u32Index == VBOX_VBVA_CONF32_MONITOR_COUNT)
    21692178    {
     
    21842193}
    21852194
    2186 static int vbvaHandleInfoHeap(PVGASTATE pVGAState, const VBVAINFOHEAP *pInfoHeap)
    2187 {
    2188     const VBVAINFOHEAP parms = *pInfoHeap;
     2195static 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;
    21892200    ASMCompilerBarrier();
    21902201    LogFlowFunc(("VBVA_INFO_HEAP: offset 0x%x, size 0x%x\n",
     
    21942205}
    21952206
    2196 int VBVAInfoView(PVGASTATE pVGAState, const VBVAINFOVIEW *pView)
    2197 {
    2198     const VBVAINFOVIEW view = *pView;
     2207int 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;
    21992214    ASMCompilerBarrier();
    22002215
     
    22212236}
    22222237
    2223 int VBVAInfoScreen(PVGASTATE pVGAState, const VBVAINFOSCREEN *pScreen)
    2224 {
    2225     const VBVAINFOSCREEN screen = *pScreen;
    2226 
     2238int VBVAInfoScreen(PVGASTATE pVGAState, const VBVAINFOSCREEN RT_UNTRUSTED_VOLATILE_GUEST *pScreen)
     2239{
     2240    VBVAINFOSCREEN screen;
     2241    memcpy(&screen, (void *)pScreen, sizeof(screen));
     2242    ASMCompilerBarrier();
    22272243    LogRel(("VBVA: InfoScreen: [%d] @%d,%d %dx%d, line 0x%x, BPP %d, flags 0x%x\n",
    22282244            screen.u32ViewIndex, screen.i32OriginX, screen.i32OriginY,
     
    24252441 * @thread EMT
    24262442 */
    2427 static DECLCALLBACK(int) vbvaChannelHandler(void *pvHandler, uint16_t u16ChannelInfo, void *pvBuffer, HGSMISIZE cbBuffer)
     2443static DECLCALLBACK(int) vbvaChannelHandler(void *pvHandler, uint16_t u16ChannelInfo,
     2444                                            void RT_UNTRUSTED_VOLATILE_GUEST *pvBuffer, HGSMISIZE cbBuffer)
    24282445{
    24292446    int rc = VINF_SUCCESS;
     
    24492466            if (cbBuffer >= VBoxSHGSMIBufferHeaderSize() + sizeof(VBOXCMDVBVA_CTL))
    24502467            {
    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);
    24522470                rc = vboxCmdVBVACmdCtl(pVGAState, pCtl, cbBuffer - VBoxSHGSMIBufferHeaderSize());
    24532471            }
     
    24612479            if (cbBuffer >= VBoxSHGSMIBufferHeaderSize() + sizeof(VBOXVDMACBUF_DR))
    24622480            {
    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);
    24642483                vboxVDMACommand(pVGAState->pVdma, pCmd, cbBuffer - VBoxSHGSMIBufferHeaderSize());
    24652484                rc = VINF_SUCCESS;
     
    24722491            if (cbBuffer >= VBoxSHGSMIBufferHeaderSize() + sizeof(VBOXVDMA_CTL))
    24732492            {
    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);
    24752495                vboxVDMAControl(pVGAState->pVdma, pCmd, cbBuffer - VBoxSHGSMIBufferHeaderSize());
    24762496            }
     
    24822502        case VBVA_QUERY_CONF32:
    24832503            if (cbBuffer >= sizeof(VBVACONF32))
    2484                 rc = vbvaHandleQueryConf32(pVGAState, (VBVACONF32 *)pvBuffer);
     2504                rc = vbvaHandleQueryConf32(pVGAState, (VBVACONF32 RT_UNTRUSTED_VOLATILE_GUEST *)pvBuffer);
    24852505            else
    24862506                rc = VERR_INVALID_PARAMETER;
     
    24892509        case VBVA_SET_CONF32:
    24902510            if (cbBuffer >= sizeof(VBVACONF32))
    2491                 rc = vbvaHandleSetConf32(pVGAState, (VBVACONF32 *)pvBuffer);
     2511                rc = vbvaHandleSetConf32(pVGAState, (VBVACONF32 RT_UNTRUSTED_VOLATILE_GUEST *)pvBuffer);
    24922512            else
    24932513                rc = VERR_INVALID_PARAMETER;
     
    25032523#endif
    25042524                /* 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;
    25062526                for (;
    25072527                     cbBuffer >= sizeof(VBVAINFOVIEW);
     
    25172537        case VBVA_INFO_HEAP:
    25182538            if (cbBuffer >= sizeof(VBVAINFOHEAP))
    2519                 rc = vbvaHandleInfoHeap(pVGAState, (VBVAINFOHEAP *)pvBuffer);
     2539                rc = vbvaHandleInfoHeap(pVGAState, (VBVAINFOHEAP RT_UNTRUSTED_VOLATILE_GUEST *)pvBuffer);
    25202540            else
    25212541                rc = VERR_INVALID_PARAMETER;
     
    25352555#endif
    25362556            if (cbBuffer >= sizeof(VBVAINFOSCREEN))
    2537                 rc = VBVAInfoScreen(pVGAState, (VBVAINFOSCREEN *)pvBuffer);
     2557                rc = VBVAInfoScreen(pVGAState, (VBVAINFOSCREEN RT_UNTRUSTED_VOLATILE_GUEST *)pvBuffer);
    25382558            break;
    25392559
     
    25452565            if (cbBuffer >= sizeof(VBVAENABLE))
    25462566            {
    2547                 VBVAENABLE volatile *pVbvaEnable = (VBVAENABLE volatile *)pvBuffer;
     2567                VBVAENABLE RT_UNTRUSTED_VOLATILE_GUEST *pVbvaEnable = (VBVAENABLE RT_UNTRUSTED_VOLATILE_GUEST *)pvBuffer;
    25482568
    25492569                uint32_t       u32ScreenId;
     
    25522572                {
    25532573                    if (cbBuffer >= sizeof(VBVAENABLE_EX))
    2554                         u32ScreenId = ((VBVAENABLE_EX volatile *)pvBuffer)->u32ScreenId;
     2574                        u32ScreenId = ((VBVAENABLE_EX RT_UNTRUSTED_VOLATILE_GUEST *)pvBuffer)->u32ScreenId;
    25552575                    else
    25562576                    {
     
    25702590            if (cbBuffer >= sizeof(VBVAMOUSEPOINTERSHAPE))
    25712591            {
    2572                 VBVAMOUSEPOINTERSHAPE *pShape = (VBVAMOUSEPOINTERSHAPE *)pvBuffer;
     2592                VBVAMOUSEPOINTERSHAPE RT_UNTRUSTED_VOLATILE_GUEST *pShape;
     2593                pShape = (VBVAMOUSEPOINTERSHAPE RT_UNTRUSTED_VOLATILE_GUEST *)pvBuffer;
    25732594                rc = vbvaMousePointerShape(pVGAState, pCtx, pShape, cbBuffer);
    25742595                pShape->i32Result = rc;
     
    25832604            if (cbBuffer >= VBOXVHWACMD_HEADSIZE())
    25842605            {
    2585                 vbvaVHWAHandleCommand(pVGAState, (PVBOXVHWACMD)pvBuffer);
     2606                vbvaVHWAHandleCommand(pVGAState, (VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *)pvBuffer);
    25862607                rc = VINF_SUCCESS;
    25872608            }
     
    25952616            if (cbBuffer >= sizeof(VBVACAPS))
    25962617            {
    2597                 VBVACAPS volatile *pCaps = (VBVACAPS volatile *)pvBuffer;
     2618                VBVACAPS RT_UNTRUSTED_VOLATILE_GUEST *pCaps = (VBVACAPS RT_UNTRUSTED_VOLATILE_GUEST *)pvBuffer;
    25982619                pVGAState->fGuestCaps = pCaps->fCaps;
    25992620                pVGAState->pDrv->pfnVBVAGuestCapabilityUpdate(pVGAState->pDrv, pVGAState->fGuestCaps);
     
    26082629            if (cbBuffer >= sizeof(VBVASCANLINECFG))
    26092630            {
    2610                 VBVASCANLINECFG volatile *pCfg = (VBVASCANLINECFG volatile *)pvBuffer;
     2631                VBVASCANLINECFG RT_UNTRUSTED_VOLATILE_GUEST *pCfg = (VBVASCANLINECFG RT_UNTRUSTED_VOLATILE_GUEST *)pvBuffer;
    26112632                pVGAState->fScanLineCfg = pCfg->fFlags;
    26122633                pCfg->rc = rc = VINF_SUCCESS;
     
    26192640            if (cbBuffer >= sizeof(VBVAQUERYMODEHINTS))
    26202641            {
    2621                 VBVAQUERYMODEHINTS volatile *pQueryModeHints = (VBVAQUERYMODEHINTS volatile *)pvBuffer;
     2642                VBVAQUERYMODEHINTS RT_UNTRUSTED_VOLATILE_GUEST *pQueryModeHints;
     2643                pQueryModeHints = (VBVAQUERYMODEHINTS RT_UNTRUSTED_VOLATILE_GUEST *)pvBuffer;
    26222644                rc = vbvaHandleQueryModeHints(pVGAState, pQueryModeHints, cbBuffer);
    26232645                pQueryModeHints->rc = rc;
     
    26302652            if (cbBuffer >= sizeof(VBVAREPORTINPUTMAPPING))
    26312653            {
    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                }
    26332663                ASMCompilerBarrier();
     2664
    26342665                LogRelFlowFunc(("VBVA: ChannelHandler: VBVA_REPORT_INPUT_MAPPING: x=%RI32, y=%RI32, cx=%RU32, cy=%RU32\n",
    26352666                                inputMapping.x, inputMapping.y, inputMapping.cx, inputMapping.cy));
     
    26462677            if (cbBuffer >= sizeof(VBVACURSORPOSITION))
    26472678            {
    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();
    26492685
    26502686                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);
    26552690                pReport->x = pCtx->xCursor;
    26562691                pReport->y = pCtx->yCursor;
  • trunk/src/VBox/Devices/Graphics/DevVGA_VDMA.cpp

    r71588 r71590  
    23982398 * @note    cbCmdDr is at least sizeof(VBOXVDMACBUF_DR).
    23992399 */
    2400 static int vboxVDMACmdCheckCrCmd(struct VBOXVDMAHOST *pVdma, PVBOXVDMACBUF_DR pCmdDr, uint32_t cbCmdDr)
     2400static int vboxVDMACmdCheckCrCmd(struct VBOXVDMAHOST *pVdma, VBOXVDMACBUF_DR RT_UNTRUSTED_VOLATILE_GUEST *pCmdDr, uint32_t cbCmdDr)
    24012401{
    24022402    uint32_t cbDmaCmd = 0;
     
    29482948 * @thread  VDMA
    29492949 */
    2950 static void vboxVDMACommandProcess(PVBOXVDMAHOST pVdma, PVBOXVDMACBUF_DR pCmd, uint32_t cbCmd)
     2950static void vboxVDMACommandProcess(PVBOXVDMAHOST pVdma, VBOXVDMACBUF_DR RT_UNTRUSTED_VOLATILE_GUEST *pCmd, uint32_t cbCmd)
    29512951{
    29522952    PHGSMIINSTANCE pHgsmi = pVdma->pHgsmi;
     
    29582958         * Get the command buffer (volatile).
    29592959         */
    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 */
    29622963        PGMPAGEMAPLOCK  Lock;
    29632964        bool            bReleaseLocked = false;
    2964         if (pCmd->fFlags & VBOXVDMACBUF_FLAG_BUF_FOLLOWS_DR)
     2965        if (fCmdFlags & VBOXVDMACBUF_FLAG_BUF_FOLLOWS_DR)
    29652966        {
    29662967            pbCmdBuf = VBOXVDMACBUF_DR_TAIL(pCmd, const uint8_t);
     
    29692970                            rc = VERR_INVALID_PARAMETER);
    29702971        }
    2971         else if (pCmd->fFlags & VBOXVDMACBUF_FLAG_BUF_VRAM_OFFSET)
     2972        else if (fCmdFlags & VBOXVDMACBUF_FLAG_BUF_VRAM_OFFSET)
    29722973        {
    29732974            uint64_t offVRam = pCmd->Location.offVramBuf;
     
    31653166 * @param   cbCmd   The size of the command.  At least sizeof(VBOXVDMA_CTL).
    31663167 */
    3167 void vboxVDMAControl(struct VBOXVDMAHOST *pVdma, PVBOXVDMA_CTL pCmd, uint32_t cbCmd)
     3168void vboxVDMAControl(struct VBOXVDMAHOST *pVdma, VBOXVDMA_CTL RT_UNTRUSTED_VOLATILE_GUEST *pCmd, uint32_t cbCmd)
    31683169{
    31693170    RT_NOREF(cbCmd);
     
    31713172
    31723173    VBOXVDMA_CTL_TYPE enmCtl = pCmd->enmCtl;
     3174    ASMCompilerBarrier();
    31733175    switch (enmCtl)
    31743176    {
     
    32043206 * @param   cbCmd   The size of the command.  At least sizeof(VBOXVDMACBUF_DR).
    32053207 */
    3206 void vboxVDMACommand(struct VBOXVDMAHOST *pVdma, PVBOXVDMACBUF_DR pCmd, uint32_t cbCmd)
     3208void vboxVDMACommand(struct VBOXVDMAHOST *pVdma, VBOXVDMACBUF_DR RT_UNTRUSTED_VOLATILE_GUEST *pCmd, uint32_t cbCmd)
    32073209{
    32083210#ifdef VBOX_WITH_CRHGSMI
     
    32823284 * Handler for vboxCmdVBVACmdCtl()/VBOXCMDVBVACTL_TYPE_3DCTL.
    32833285 */
    3284 static int vdmaVBVACtlGenericGuestSubmit(PVBOXVDMAHOST pVdma, VBVAEXHOSTCTL_TYPE enmType, VBOXCMDVBVA_CTL *pCtl, uint32_t cbCtl)
     3286static int vdmaVBVACtlGenericGuestSubmit(PVBOXVDMAHOST pVdma, VBVAEXHOSTCTL_TYPE enmType,
     3287                                         VBOXCMDVBVA_CTL RT_UNTRUSTED_VOLATILE_GUEST *pCtl, uint32_t cbCtl)
    32853288{
    32863289    Assert(cbCtl >= sizeof(VBOXCMDVBVA_CTL)); /* Checked by callers caller, vbvaChannelHandler(). */
     
    37913794 *                              sizeof(VBOXCMDVBVA_CTL).
    37923795 */
    3793 int vboxCmdVBVACmdCtl(PVGASTATE pVGAState, VBOXCMDVBVA_CTL *pCtl, uint32_t cbCtl)
     3796int vboxCmdVBVACmdCtl(PVGASTATE pVGAState, VBOXCMDVBVA_CTL RT_UNTRUSTED_VOLATILE_GUEST *pCtl, uint32_t cbCtl)
    37943797{
    37953798    struct VBOXVDMAHOST *pVdma = pVGAState->pVdma;
  • trunk/src/VBox/Devices/Graphics/HGSMI/HGSMIHost.cpp

    r70596 r71590  
    514514}
    515515
    516 static void *hgsmiHostHeapBufferAlloc(HGSMIHOSTHEAP *pHeap,
    517                                       HGSMISIZE cbBuffer)
    518 {
    519     void *pvBuf = NULL;
     516static void RT_UNTRUSTED_VOLATILE_GUEST *hgsmiHostHeapBufferAlloc(HGSMIHOSTHEAP *pHeap, HGSMISIZE cbBuffer)
     517{
     518    void RT_UNTRUSTED_VOLATILE_GUEST *pvBuf = NULL;
    520519
    521520    if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_MA)
    522     {
    523521        pvBuf = HGSMIMAAlloc(&pHeap->u.ma, cbBuffer);
    524     }
    525522    else if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_POINTER)
    526     {
    527523        pvBuf = RTHeapSimpleAlloc(pHeap->u.legacy.u.hPtr, cbBuffer, 0);
    528     }
    529524    else if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_OFFSET)
    530     {
    531525        pvBuf = RTHeapOffsetAlloc(pHeap->u.legacy.u.hOff, cbBuffer, 0);
    532     }
    533 
    534526    if (pvBuf)
    535     {
    536         ++pHeap->cRefs;
    537     }
     527        ASMAtomicIncS32(&pHeap->cRefs);
    538528
    539529    return pvBuf;
    540530}
    541531
    542 static void hgsmiHostHeapBufferFree(HGSMIHOSTHEAP *pHeap,
    543                                     void *pvBuf)
     532static void hgsmiHostHeapBufferFree(HGSMIHOSTHEAP *pHeap, void RT_UNTRUSTED_VOLATILE_GUEST *pvBuf)
    544533{
    545534    if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_MA)
    546     {
    547535        HGSMIMAFree(&pHeap->u.ma, pvBuf);
    548     }
    549536    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);
    553538    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
     543static void RT_UNTRUSTED_VOLATILE_GUEST *hgsmiHostHeapDataAlloc(HGSMIHOSTHEAP *pHeap, HGSMISIZE cbData,
     544                                                                uint8_t u8Channel, uint16_t u16ChannelInfo)
    564545{
    565546    HGSMISIZE cbAlloc = HGSMIBufferRequiredSize(cbData);
     
    573554}
    574555
    575 static void hgsmiHostHeapDataFree(HGSMIHOSTHEAP *pHeap,
    576                                   void *pvData)
     556static void hgsmiHostHeapDataFree(HGSMIHOSTHEAP *pHeap, void RT_UNTRUSTED_VOLATILE_GUEST *pvData)
    577557{
    578558    if (   pvData
    579559        && pHeap->u32HeapType != HGSMI_HEAP_TYPE_NULL)
    580560    {
    581         HGSMIBUFFERHEADER *pHeader = HGSMIBufferHeaderFromData(pvData);
     561        HGSMIBUFFERHEADER RT_UNTRUSTED_VOLATILE_GUEST *pHeader = HGSMIBufferHeaderFromData(pvData);
    582562        hgsmiHostHeapBufferFree(pHeap, pHeader);
    583563    }
     
    726706        hgsmiFIFOUnlock (pIns);
    727707
    728         void *pvData = HGSMIBufferDataFromOffset(&pIns->hostHeap.area, pEntry->offBuffer);
     708        void RT_UNTRUSTED_VOLATILE_GUEST *pvData = HGSMIBufferDataFromOffset(&pIns->hostHeap.area, pEntry->offBuffer);
    729709
    730710        rc = hgsmiHostHeapLock (pIns);
     
    744724}
    745725
    746 static int hgsmiHostCommandFree(HGSMIINSTANCE *pIns,
    747                                 void *pvData)
     726static int hgsmiHostCommandFree(HGSMIINSTANCE *pIns, void RT_UNTRUSTED_VOLATILE_GUEST *pvData)
    748727{
    749728    HGSMIOFFSET offBuffer = HGSMIBufferOffsetFromData(&pIns->hostHeap.area, pvData);
     
    852831 * @thread EMT
    853832 */
    854 static int hgsmiHostCommandSubmit(HGSMIINSTANCE *pIns,
    855                                   void *pvData,
    856                                   bool fDoIrq)
     833static int hgsmiHostCommandSubmit(HGSMIINSTANCE *pIns, void RT_UNTRUSTED_VOLATILE_GUEST *pvData, bool fDoIrq)
    857834{
    858835    /* Append the command to FIFO. */
     
    883860 * @param u16ChannelInfo Command parameter.
    884861 */
    885 int HGSMIHostCommandAlloc(HGSMIINSTANCE *pIns,
    886                           void **ppvData,
    887                           HGSMISIZE cbData,
    888                           uint8_t u8Channel,
    889                           uint16_t u16ChannelInfo)
     862int HGSMIHostCommandAlloc(HGSMIINSTANCE *pIns, void RT_UNTRUSTED_VOLATILE_GUEST **ppvData, HGSMISIZE cbData,
     863                          uint8_t u8Channel, uint16_t u16ChannelInfo)
    890864{
    891865    LogFlowFunc(("pIns = %p, cbData = %d, u8Channel %d, u16ChannelInfo 0x%04X\n",
     
    895869    if (RT_SUCCESS(rc))
    896870    {
    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);
    901872        hgsmiHostHeapUnlock(pIns);
    902873
     
    929900 *               the command could be posted without raising an irq.
    930901 */
    931 int HGSMIHostCommandSubmitAndFreeAsynch(PHGSMIINSTANCE pIns,
    932                                         void *pvData,
    933                                         bool fDoIrq)
     902int HGSMIHostCommandSubmitAndFreeAsynch(PHGSMIINSTANCE pIns, void RT_UNTRUSTED_VOLATILE_GUEST *pvData, bool fDoIrq)
    934903{
    935904    LogFlowFunc(("pIns = %p, pvData = %p, fDoIrq = %d\n", pIns, pvData, fDoIrq));
     
    937906    int rc;
    938907    if (HGSMIAreaContainsPointer(&pIns->hostHeap.area, pvData))
    939     {
    940908        rc = hgsmiHostCommandSubmit(pIns, pvData, fDoIrq);
    941     }
    942909    else
    943910    {
     
    957924 * @param pvData The pointer returned by 'HGSMIHostCommandAlloc'.
    958925 */
    959 int HGSMIHostCommandFree(HGSMIINSTANCE *pIns,
    960                          void *pvData)
     926int HGSMIHostCommandFree(HGSMIINSTANCE *pIns, void RT_UNTRUSTED_VOLATILE_GUEST *pvData)
    961927{
    962928    LogFlowFunc(("pIns = %p, pvData = %p\n", pIns, pvData));
     
    964930    int rc;
    965931    if (HGSMIAreaContainsPointer(&pIns->hostHeap.area, pvData))
    966     {
    967932        rc = hgsmiHostCommandFree(pIns, pvData);
    968     }
    969933    else
    970934    {
     
    14371401 */
    14381402
    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 
    14461403/* Register a new HGSMI channel by a predefined index.
    14471404 */
     
    14721429}
    14731430
    1474 /* Register a new HGSMI channel by name.
     1431#if 0 /* unused */
     1432
     1433static 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.
    14751444 */
    14761445int HGSMIChannelRegisterName(PHGSMIINSTANCE pIns,
     
    15231492    return rc;
    15241493}
    1525 
    1526 void *HGSMIOffsetToPointerHost (PHGSMIINSTANCE pIns,
    1527                                 HGSMIOFFSET offBuffer)
     1494#endif
     1495
     1496void RT_UNTRUSTED_VOLATILE_GUEST *HGSMIOffsetToPointerHost(PHGSMIINSTANCE pIns, HGSMIOFFSET offBuffer)
    15281497{
    15291498    const HGSMIAREA *pArea = &pIns->area;
     
    15361505    }
    15371506
    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
     1511HGSMIOFFSET HGSMIPointerToOffsetHost(PHGSMIINSTANCE pIns, const void RT_UNTRUSTED_VOLATILE_GUEST *pv)
    15441512{
    15451513    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;
    15591520}
    15601521
     
    15671528
    15681529/* The guest submitted a buffer. */
    1569 static DECLCALLBACK(int) hgsmiChannelHandler (void *pvHandler, uint16_t u16ChannelInfo, void *pvBuffer, HGSMISIZE cbBuffer)
     1530static DECLCALLBACK(int) hgsmiChannelHandler (void *pvHandler, uint16_t u16ChannelInfo,
     1531                                              RT_UNTRUSTED_VOLATILE_GUEST void *pvBuffer, HGSMISIZE cbBuffer)
    15701532{
    15711533    int rc = VINF_SUCCESS;
     
    17861748}
    17871749
    1788 int hgsmiCompleteGuestCommand(PHGSMIINSTANCE pIns,
    1789         HGSMIOFFSET offBuffer,
    1790         bool bDoIrq)
     1750int hgsmiCompleteGuestCommand(PHGSMIINSTANCE pIns, HGSMIOFFSET offBuffer, bool fDoIrq)
    17911751{
    17921752    int rc = hgsmiGuestCommandComplete (pIns, offBuffer);
    17931753    if (RT_SUCCESS (rc))
    17941754    {
    1795         if (bDoIrq)
     1755        if (fDoIrq)
    17961756        {
    17971757            /* Now guest can read the FIFO, the notification is informational. */
     
    18081768}
    18091769
    1810 int HGSMICompleteGuestCommand(PHGSMIINSTANCE pIns,
    1811         void *pvMem,
    1812         bool bDoIrq)
     1770int HGSMICompleteGuestCommand(PHGSMIINSTANCE pIns, void RT_UNTRUSTED_VOLATILE_GUEST *pvMem, bool fDoIrq)
    18131771{
    18141772    LogFlowFunc(("pIns = %p, pvMem = %p\n", pIns, pvMem));
     
    18161774    int rc = VINF_SUCCESS;
    18171775
    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);
    18201778
    18211779    Assert(offBuffer != HGSMIOFFSET_VOID);
    18221780    if (offBuffer != HGSMIOFFSET_VOID)
    18231781    {
    1824         rc = hgsmiCompleteGuestCommand (pIns, offBuffer, bDoIrq);
     1782        rc = hgsmiCompleteGuestCommand(pIns, offBuffer, fDoIrq);
    18251783        AssertRC (rc);
    18261784    }
  • trunk/src/VBox/Devices/Graphics/HGSMI/HGSMIHost.h

    r69500 r71590  
    11/* $Id$ */
    22/** @file
    3  *
    4  * VBox Host Guest Shared Memory Interface (HGSMI).
    5  * Host part.
     3 * VBox Host Guest Shared Memory Interface (HGSMI), host part.
    64 */
    75
     
    3836 */
    3937
    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);
     38int   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);
     47void  HGSMIDestroy(PHGSMIINSTANCE pIns);
     48void *HGSMIContext(PHGSMIINSTANCE pIns);
    4949
    50 void HGSMIDestroy (PHGSMIINSTANCE pIns);
     50void RT_UNTRUSTED_VOLATILE_GUEST *HGSMIOffsetToPointerHost(PHGSMIINSTANCE pIns, HGSMIOFFSET offBuffer);
     51HGSMIOFFSET HGSMIPointerToOffsetHost(PHGSMIINSTANCE pIns, const void RT_UNTRUSTED_VOLATILE_GUEST *pv);
    5152
    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 
     53int   HGSMIHostChannelRegister(PHGSMIINSTANCE pIns, uint8_t u8Channel,
     54                               PFNHGSMICHANNELHANDLER pfnChannelHandler, void *pvChannelHandler);
     55#if 0 /* unused */
    6556int HGSMIChannelRegisterName (PHGSMIINSTANCE pIns,
    6657                              const char *pszChannel,
     
    6859                              void *pvChannelHandler,
    6960                              uint8_t *pu8Channel);
     61#endif
    7062
    71 int HGSMIHostHeapSetup(PHGSMIINSTANCE pIns,
    72                        HGSMIOFFSET    offHeap,
    73                        HGSMISIZE      cbHeap);
     63int HGSMIHostHeapSetup(PHGSMIINSTANCE pIns, HGSMIOFFSET offHeap, HGSMISIZE cbHeap);
    7464
    7565/*
     
    7868
    7969/* Guests passes a new command buffer to the host. */
    80 void HGSMIGuestWrite (PHGSMIINSTANCE pIns,
    81                       HGSMIOFFSET offBuffer);
     70void HGSMIGuestWrite(PHGSMIINSTANCE pIns, HGSMIOFFSET offBuffer);
    8271
    8372/* Guest reads information about guest buffers. */
    84 HGSMIOFFSET HGSMIGuestRead (PHGSMIINSTANCE pIns);
     73HGSMIOFFSET HGSMIGuestRead(PHGSMIINSTANCE pIns);
    8574
    8675/* Guest reads the host FIFO to get a command. */
    87 HGSMIOFFSET HGSMIHostRead (PHGSMIINSTANCE pIns);
     76HGSMIOFFSET HGSMIHostRead(PHGSMIINSTANCE pIns);
    8877
    8978/* Guest reports that the command at this offset has been processed.  */
    90 void HGSMIHostWrite (PHGSMIINSTANCE pIns,
    91                      HGSMIOFFSET offBuffer);
     79void HGSMIHostWrite(PHGSMIINSTANCE pIns, HGSMIOFFSET offBuffer);
    9280
    9381void HGSMISetHostGuestFlags(PHGSMIINSTANCE pIns, uint32_t flags);
     
    10492
    10593/* 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);
     94int HGSMIHostCommandAlloc(PHGSMIINSTANCE pIns, void RT_UNTRUSTED_VOLATILE_GUEST **ppvData, HGSMISIZE cbData,
     95                          uint8_t u8Channel, uint16_t u16ChannelInfo);
     96int HGSMIHostCommandSubmitAndFreeAsynch(PHGSMIINSTANCE pIns, void RT_UNTRUSTED_VOLATILE_GUEST *pvData, bool fDoIrq);
     97int HGSMIHostCommandFree(PHGSMIINSTANCE pIns, void RT_UNTRUSTED_VOLATILE_GUEST *pvData);
    11198
    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);
     99int HGSMIHostLoadStateExec(PHGSMIINSTANCE pIns, PSSMHANDLE pSSM, uint32_t u32Version);
     100int HGSMIHostSaveStateExec(PHGSMIINSTANCE pIns, PSSMHANDLE pSSM);
    122101
    123102#ifdef VBOX_WITH_WDDM
    124 int HGSMICompleteGuestCommand(PHGSMIINSTANCE pIns, void *pvMem, bool bDoIrq);
     103int HGSMICompleteGuestCommand(PHGSMIINSTANCE pIns, void RT_UNTRUSTED_VOLATILE_GUEST *pvMem, bool fDoIrq);
    125104#endif
    126105
  • trunk/src/VBox/Devices/Graphics/HGSMI/SHGSMIHost.cpp

    r69500 r71590  
    2323 * about G->H command completion
    2424 */
    25 static bool vboxSHGSMICommandCanCompleteSynch (PVBOXSHGSMIHEADER pHdr)
     25
     26static int vboxSHGSMICommandCompleteAsynch (PHGSMIINSTANCE pIns, VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_GUEST *pHdr)
    2627{
    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);
    2831}
    2932
    30 static int vboxSHGSMICommandCompleteAsynch (PHGSMIINSTANCE pIns, PVBOXSHGSMIHEADER pHdr)
     33void VBoxSHGSMICommandMarkAsynchCompletion(void RT_UNTRUSTED_VOLATILE_GUEST *pvData)
    3134{
    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);
    4036    Assert(!(pHdr->fFlags & VBOXSHGSMI_FLAG_HG_ASYNCH));
    4137    pHdr->fFlags |= VBOXSHGSMI_FLAG_HG_ASYNCH;
    4238}
    4339
    44 int VBoxSHGSMICommandComplete (PHGSMIINSTANCE pIns, void *pvData)
     40int VBoxSHGSMICommandComplete(PHGSMIINSTANCE pIns, void RT_UNTRUSTED_VOLATILE_GUEST *pvData)
    4541{
    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 */
    4947        return VINF_SUCCESS;
    50     pHdr->fFlags |= VBOXSHGSMI_FLAG_HG_ASYNCH;
     48
     49    pHdr->fFlags = fFlags | VBOXSHGSMI_FLAG_HG_ASYNCH;
    5150    return vboxSHGSMICommandCompleteAsynch(pIns, pHdr);
    5251}
  • trunk/src/VBox/Devices/Graphics/HGSMI/SHGSMIHost.h

    r69500 r71590  
    2121#include "HGSMIHost.h"
    2222
    23 int VBoxSHGSMICommandComplete (PHGSMIINSTANCE pIns, void *pvData);
    24 
    25 void VBoxSHGSMICommandMarkAsynchCompletion (void *pvData);
     23int  VBoxSHGSMICommandComplete(PHGSMIINSTANCE pIns, void RT_UNTRUSTED_VOLATILE_GUEST *pvData);
     24void VBoxSHGSMICommandMarkAsynchCompletion(void RT_UNTRUSTED_VOLATILE_GUEST *pvData);
    2625
    2726#endif
  • trunk/src/VBox/Main/include/DisplayImpl.h

    r70563 r71590  
    169169    void i_handleUpdateVBVAInputMapping(int32_t xOrigin, int32_t yOrigin, uint32_t cx, uint32_t cy);
    170170#ifdef VBOX_WITH_VIDEOHWACCEL
    171     int  i_handleVHWACommandProcess(PVBOXVHWACMD pCommand);
     171    int  i_handleVHWACommandProcess(int enmCmd, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCommand);
    172172#endif
    173173#ifdef VBOX_WITH_CRHGSMI
     
    339339
    340340#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);
    342343#endif
    343344
  • trunk/src/VBox/Main/src-client/DisplayImpl.cpp

    r70644 r71590  
    29812981{
    29822982#ifdef VBOX_WITH_VIDEOHWACCEL
    2983     mpDrv->pVBVACallbacks->pfnVHWACommandCompleteAsync(mpDrv->pVBVACallbacks, (PVBOXVHWACMD)aCommand);
     2983    mpDrv->pVBVACallbacks->pfnVHWACommandCompleteAsync(mpDrv->pVBVACallbacks, (VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *)aCommand);
    29842984    return S_OK;
    29852985#else
     
    35313531#endif
    35323532
    3533 int Display::i_handleVHWACommandProcess(PVBOXVHWACMD pCommand)
     3533int Display::i_handleVHWACommandProcess(int enmCmd, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCommand)
    35343534{
    35353535    unsigned id = (unsigned)pCommand->iDisplay;
     
    35463546        return VERR_NOT_IMPLEMENTED; /* Implementation is not available. */
    35473547
     3548    NOREF(enmCmd);
    35483549    HRESULT hr = pFramebuffer->ProcessVHWACommand((BYTE*)pCommand);
    35493550    if (hr == S_FALSE)
     
    35583559}
    35593560
    3560 DECLCALLBACK(int) Display::i_displayVHWACommandProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVHWACMD pCommand)
     3561DECLCALLBACK(int) Display::i_displayVHWACommandProcess(PPDMIDISPLAYCONNECTOR pInterface, int enmCmd,
     3562                                                       VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCommand)
    35613563{
    35623564    PDRVMAINDISPLAY pDrv = PDMIDISPLAYCONNECTOR_2_MAINDISPLAY(pInterface);
    35633565
    3564     return pDrv->pDisplay->i_handleVHWACommandProcess(pCommand);
     3566    return pDrv->pDisplay->i_handleVHWACommandProcess(enmCmd, pCommand);
    35653567}
    35663568#endif
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette