VirtualBox

Changeset 97905 in vbox


Ignore:
Timestamp:
Dec 29, 2022 6:22:23 PM (2 years ago)
Author:
vboxsync
Message:

IPRT,SUPDrv: Dropping RTR0MemExecDonate and associated SUPDrv-linux code, it's not needed since linux started using RTR0MemObjAllocPage for r0 images. bugref:9801

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/mangling.h

    r97646 r97905  
    18661866# define RTR0Init                                       RT_MANGLER(RTR0Init)                   /* r0drv */
    18671867# define RTR0MemAreKrnlAndUsrDifferent                  RT_MANGLER(RTR0MemAreKrnlAndUsrDifferent) /* r0drv */
    1868 # define RTR0MemExecDonate                              RT_MANGLER(RTR0MemExecDonate)          /* r0drv */
    18691868# define RTR0MemKernelIsValidAddr                       RT_MANGLER(RTR0MemKernelIsValidAddr)   /* r0drv */
    18701869# define RTR0MemObjAddress                              RT_MANGLER(RTR0MemObjAddress)          /* r0drv */
  • trunk/include/iprt/mem.h

    r96407 r97905  
    467467RTDECL(void)    RTMemExecFree(void *pv, size_t cb) RT_NO_THROW_PROTO;
    468468
    469 #if defined(IN_RING0) && defined(RT_ARCH_AMD64) && defined(RT_OS_LINUX)
    470 /**
    471  * Donate read+write+execute memory to the exec heap.
    472  *
    473  * This API is specific to AMD64 and Linux/GNU. A kernel module that desires to
    474  * use RTMemExecAlloc on AMD64 Linux/GNU will have to donate some statically
    475  * allocated memory in the module if it wishes for GCC generated code to work.
    476  * GCC can only generate modules that work in the address range ~2GB to ~0
    477  * currently.
    478  *
    479  * The API only accept one single donation.
    480  *
    481  * @returns IPRT status code.
    482  * @param   pvMemory    Pointer to the memory block.
    483  * @param   cb          The size of the memory block.
    484  */
    485 RTR0DECL(int) RTR0MemExecDonate(void *pvMemory, size_t cb) RT_NO_THROW_PROTO;
    486 #endif /* R0+AMD64+LINUX */
    487 
    488469/**
    489470 * Allocate page aligned memory with default tag.
  • trunk/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c

    r96407 r97905  
    175175#define DEVICE_NAME_USR     "vboxdrvu"
    176176
    177 #if (defined(RT_ARCH_AMD64) && RTLNX_VER_MAX(2,6,23)) || defined(VBOX_WITH_TEXT_MODMEM_HACK)
    178 /**
    179  * Memory for the executable memory heap (in IPRT).
    180  */
    181 # ifdef DEBUG
    182 #  define EXEC_MEMORY_SIZE   10485760   /* 10 MB */
    183 # else
    184 #  define EXEC_MEMORY_SIZE   8388608    /* 8 MB */
    185 # endif
    186 extern uint8_t g_abExecMemory[EXEC_MEMORY_SIZE];
    187 # ifndef VBOX_WITH_TEXT_MODMEM_HACK
    188 __asm__(".section execmemory, \"awx\", @progbits\n\t"
    189         ".align 32\n\t"
    190         ".globl g_abExecMemory\n"
    191         "g_abExecMemory:\n\t"
    192         ".zero " RT_XSTR(EXEC_MEMORY_SIZE) "\n\t"
    193         ".type g_abExecMemory, @object\n\t"
    194         ".size g_abExecMemory, " RT_XSTR(EXEC_MEMORY_SIZE) "\n\t"
    195         ".text\n\t");
    196 # else
    197 __asm__(".text\n\t"
    198         ".align 4096\n\t"
    199         ".globl g_abExecMemory\n"
    200         "g_abExecMemory:\n\t"
    201         ".zero " RT_XSTR(EXEC_MEMORY_SIZE) "\n\t"
    202         ".type g_abExecMemory, @object\n\t"
    203         ".size g_abExecMemory, " RT_XSTR(EXEC_MEMORY_SIZE) "\n\t"
    204         ".text\n\t");
    205 # endif
    206 #endif
    207 
    208177/** The file_operations structure. */
    209178static struct file_operations gFileOpsVBoxDrvSys =
     
    395364        if (RT_SUCCESS(rc))
    396365        {
    397 #if (defined(RT_ARCH_AMD64) && RTLNX_VER_MAX(2,6,23)) || defined(VBOX_WITH_TEXT_MODMEM_HACK)
    398 # ifdef VBOX_WITH_TEXT_MODMEM_HACK
    399             set_memory_x(&g_abExecMemory[0], sizeof(g_abExecMemory) / PAGE_SIZE);
    400             set_memory_rw(&g_abExecMemory[0], sizeof(g_abExecMemory) / PAGE_SIZE);
    401 # endif
    402             rc = RTR0MemExecDonate(&g_abExecMemory[0], sizeof(g_abExecMemory));
    403             printk(KERN_DEBUG "VBoxDrv: dbg - g_abExecMemory=%p\n", (void *)&g_abExecMemory[0]);
    404 #endif
    405366            Log(("VBoxDrv::ModuleInit\n"));
    406367
     
    408369             * Initialize the device extension.
    409370             */
    410             if (RT_SUCCESS(rc))
    411                 rc = supdrvInitDevExt(&g_DevExt, sizeof(SUPDRVSESSION));
     371            rc = supdrvInitDevExt(&g_DevExt, sizeof(SUPDRVSESSION));
    412372            if (RT_SUCCESS(rc))
    413373            {
  • trunk/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c

    r97872 r97905  
    122122#endif
    123123}
    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 to
    130  * use RTMemExecAlloc on AMD64 Linux/GNU will have to donate some statically
    131  * 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 ~0
    133  * 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_HEAP
    145     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 #else
    157     RT_NOREF_PV(pvMemory); RT_NOREF_PV(cb);
    158     return VERR_NOT_SUPPORTED;
    159 #endif
    160 }
    161 RT_EXPORT_SYMBOL(RTR0MemExecDonate);
    162 
    163124
    164125
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