Changeset 97905 in vbox for trunk/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c
- Timestamp:
- Dec 29, 2022 6:22:23 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c
r97872 r97905 122 122 #endif 123 123 } 124 125 126 /**127 * Donate read+write+execute memory to the exec heap.128 *129 * This API is specific to AMD64 and Linux/GNU. A kernel module that desires to130 * use RTMemExecAlloc on AMD64 Linux/GNU will have to donate some statically131 * allocated memory in the module if it wishes for GCC generated code to work.132 * GCC can only generate modules that work in the address range ~2GB to ~0133 * currently.134 *135 * The API only accept one single donation.136 *137 * @returns IPRT status code.138 * @retval VERR_NOT_SUPPORTED if the code isn't enabled.139 * @param pvMemory Pointer to the memory block.140 * @param cb The size of the memory block.141 */142 RTR0DECL(int) RTR0MemExecDonate(void *pvMemory, size_t cb)143 {144 #ifdef RTMEMALLOC_EXEC_HEAP145 int rc;146 AssertReturn(g_HeapExec == NIL_RTHEAPSIMPLE, VERR_WRONG_ORDER);147 148 rc = RTSpinlockCreate(&g_HeapExecSpinlock, RTSPINLOCK_FLAGS_INTERRUPT_SAFE, "RTR0MemExecDonate");149 if (RT_SUCCESS(rc))150 {151 rc = RTHeapSimpleInit(&g_HeapExec, pvMemory, cb);152 if (RT_FAILURE(rc))153 rtR0MemExecCleanup();154 }155 return rc;156 #else157 RT_NOREF_PV(pvMemory); RT_NOREF_PV(cb);158 return VERR_NOT_SUPPORTED;159 #endif160 }161 RT_EXPORT_SYMBOL(RTR0MemExecDonate);162 163 124 164 125
Note:
See TracChangeset
for help on using the changeset viewer.