VirtualBox

Changeset 71590 in vbox for trunk/src/VBox/Additions/x11


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/src/VBox/Additions/x11/vboxvideo
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • 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
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