Changeset 71590 in vbox for trunk/src/VBox/Additions/x11
- Timestamp:
- Mar 31, 2018 6:34:28 PM (7 years ago)
- Location:
- trunk/src/VBox/Additions/x11/vboxvideo
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/x11/vboxvideo/HGSMIMemAlloc.h
r69346 r71590 48 48 49 49 int HGSMIMAInit(HGSMIMADATA *pMA, const HGSMIAREA *pArea, 50 HGSMIOFFSET *paDescriptors, uint32_t cDescriptors, HGSMISIZE cbMaxBlock,51 const HGSMIENV *pEnv);50 HGSMIOFFSET *paDescriptors, uint32_t cDescriptors, 51 HGSMISIZE cbMaxBlock, const HGSMIENV *pEnv); 52 52 void HGSMIMAUninit(HGSMIMADATA *pMA); 53 53 54 void *HGSMIMAAlloc(HGSMIMADATA *pMA, HGSMISIZE cb);55 void HGSMIMAFree(HGSMIMADATA *pMA, void *pv);54 void RT_UNTRUSTED_VOLATILE_GUEST *HGSMIMAAlloc(HGSMIMADATA *pMA, HGSMISIZE cb); 55 void HGSMIMAFree(HGSMIMADATA *pMA, void RT_UNTRUSTED_VOLATILE_GUEST *pv); 56 56 57 57 RT_C_DECLS_END -
trunk/src/VBox/Additions/x11/vboxvideo/VBoxVideoIPRT.h
r69346 r71590 94 94 } while (0) 95 95 # define AssertPtr assert 96 # define AssertPtrReturn(pv, rcRet) do { assert(pv); if (pv) {} else return(rcRet); } while(0) 96 97 # define AssertRC(expr) assert (!expr) 97 98 #else … … 99 100 # define AssertFailed() do { } while(0) 100 101 # define AssertMsg(expr, msg) do { } while(0) 101 # define AssertPtr(expr) do { } while(0) 102 # define AssertPtr(ptr) do { } while(0) 103 # define AssertPtrReturn(pv, rcRet) do { if (pv) {} else return(rcRet); } while(0) 102 104 # define AssertRC(expr) do { } while(0) 103 105 #endif … … 136 138 # define UINT32_C(Value) (Value ## U) 137 139 #endif 140 #define RT_UNTRUSTED_GUEST 141 #define RT_UNTRUSTED_VOLATILE_GUEST volatile 142 #define RT_UNTRUSTED_HOST 143 #define RT_UNTRUSTED_VOLATILE_HOST volatile 144 #define RT_UNTRUSTED_HSTGST 145 #define RT_UNTRUSTED_VOLATILE_HSTGST volatile 138 146 139 147 #define likely _X_LIKELY -
trunk/src/VBox/Additions/x11/vboxvideo/hgsmimemalloc.c
r69346 r71590 35 35 * submit and free pattern, we replace the generic allocator with a simple 36 36 * Boolean. Need more be said? 37 * 38 * bird> Yes, it's buggy. You never set fAllocated. See HGSMIMAAlloc(). 37 39 */ 38 40 … … 64 66 } 65 67 66 static HGSMIOFFSET HGSMIMAPointerToOffset(const HGSMIMADATA *pMA, const void *pv)68 static HGSMIOFFSET HGSMIMAPointerToOffset(const HGSMIMADATA *pMA, const void RT_UNTRUSTED_VOLATILE_GUEST *pv) 67 69 { 68 70 if (HGSMIAreaContainsPointer(&pMA->area, pv)) 69 {70 71 return HGSMIPointerToOffset(&pMA->area, pv); 71 }72 72 73 73 AssertFailed(); … … 75 75 } 76 76 77 static void *HGSMIMAOffsetToPointer(const HGSMIMADATA *pMA, HGSMIOFFSET off)77 static void RT_UNTRUSTED_VOLATILE_GUEST *HGSMIMAOffsetToPointer(const HGSMIMADATA *pMA, HGSMIOFFSET off) 78 78 { 79 79 if (HGSMIAreaContainsOffset(&pMA->area, off)) 80 {81 80 return HGSMIOffsetToPointer(&pMA->area, off); 82 }83 81 84 82 AssertFailed(); … … 86 84 } 87 85 88 void *HGSMIMAAlloc(HGSMIMADATA *pMA, HGSMISIZE cb)86 void RT_UNTRUSTED_VOLATILE_GUEST *HGSMIMAAlloc(HGSMIMADATA *pMA, HGSMISIZE cb) 89 87 { 90 88 (void)cb; … … 93 91 HGSMIOFFSET off = pMA->area.offBase; 94 92 return HGSMIMAOffsetToPointer(pMA, off); 95 pMA->fAllocated = true; 93 pMA->fAllocated = true; /** @todo r=bird: Errr. what's this doing *after* the return statement? */ 96 94 } 97 95 98 void HGSMIMAFree(HGSMIMADATA *pMA, void *pv)96 void HGSMIMAFree(HGSMIMADATA *pMA, void RT_UNTRUSTED_VOLATILE_GUEST *pv) 99 97 { 100 98 HGSMIOFFSET off = HGSMIMAPointerToOffset(pMA, pv); 101 99 if (off != HGSMIOFFSET_VOID) 102 {103 100 pMA->fAllocated = false; 104 }105 101 else 106 {107 102 AssertFailed(); 108 }109 103 } 104
Note:
See TracChangeset
for help on using the changeset viewer.