- Timestamp:
- Jan 26, 2007 12:49:23 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/posix/alloc-posix.cpp
r1 r341 47 47 RTDECL(void *) RTMemExecAlloc(size_t cb) 48 48 { 49 AssertMsg(cb, ("Allocating ZERO bytes is really not a good idea! Good luck with the next assertion!\n")); 50 51 #if defined(__AMD64__) && defined(__LINUX__) 52 /* 53 * Use mmap to get low memory. 54 */ 55 void *pv = mmap(NULL, RT_ALIGN_Z(cb, PAGE_SIZE), PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS | MAP_32BIT, -1, 0); 56 AssertMsgReturn(pv != MAP_FAILED, ("errno=%d cb=%#zx\n", errno, cb), NULL); 57 58 #else 49 59 /* 50 60 * Allocate first. 51 61 */ 52 AssertMsg(cb, ("Allocating ZERO bytes is really not a good idea! Good luck with the next assertion!\n"));53 62 cb = RT_ALIGN_Z(cb, 32); 54 63 void *pv = NULL; … … 75 84 } 76 85 } 86 #endif 77 87 return pv; 78 88 } … … 87 97 { 88 98 if (pv) 99 { 100 #if defined(__AMD64__) && defined(__LINUX__) 101 int rc = munmap(pv, 0);/** @todo fix me! */ 102 AssertMsg(!rc, ("munmap -> %d errno=%d\n", rc, errno)); 103 #else 89 104 free(pv); 105 #endif 106 } 90 107 } 91 108
Note:
See TracChangeset
for help on using the changeset viewer.