VirtualBox

Changeset 191 in vbox for trunk/src/VBox/Runtime/r0drv/linux


Ignore:
Timestamp:
Jan 19, 2007 6:39:04 PM (18 years ago)
Author:
vboxsync
Message:

just some sketches on how to solve the memory area problem on linux.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c

    r1 r191  
    4343    {
    4444#if defined(__AMD64__)
     45#if 0
     46        /*
     47         * We need memory in the module range (~2GB to ~0) this can only be obtained
     48         * thru APIs that are not exported (see module_alloc()).
     49         *
     50         * So, we'll have to create a quick and dirty heap here using BSS memory.
     51         * Very annoying and it's going to restrict us!
     52         */
     53        static uint8_t      s_abMemory[_2M];
     54        static uint8_t     *s_pbMemory = NULL; /**< NULL if not initialized. */
     55        static RTSPINLOCK   s_Spinlock = NIL_RTSPINLOCK;
     56        static struct RTMEMRECLNXEXEC
     57        {
     58            PRTMEMHDR   pHdr;   /**< NULL if no free range. */
     59            uint32_t    off;    /**< Offset into s_pbMemory. */
     60            uint32_t    cb;     
     61        }                   s_aMemRecs[64];
     62        RTSPINLOCKTMP       SpinlockTmp = RTSPINLOCKTMP_INITIALIZER;
     63
     64        if (!s_pbMemory)
     65        {
     66            /* serialize */
     67        }
     68
     69        RTSpinlockAcquireNoInts(s_Spinlock, &SpinlockTmp);
     70        /* find free area and split it... */
     71
     72        RTSpinlockReleaseNoInts(s_Spinlock, &SpinlockTmp);
     73
     74# else
    4575        pHdr = (PRTMEMHDR)__vmalloc(cb + sizeof(*pHdr), GFP_KERNEL | __GFP_HIGHMEM, PAGE_KERNEL_EXEC);
     76# endif
     77
     78
    4679#elif defined(PAGE_KERNEL_EXEC) && defined(CONFIG_X86_PAE)
    4780        pHdr = (PRTMEMHDR)__vmalloc(cb + sizeof(*pHdr), GFP_KERNEL | __GFP_HIGHMEM,
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