VirtualBox

Changeset 100321 in vbox


Ignore:
Timestamp:
Jun 28, 2023 10:55:34 AM (17 months ago)
Author:
vboxsync
Message:

Runtime/r0drv/linux/alloc-r0drv-linux.c: Make it work on ARM, bugref:10457

File:
1 edited

Legend:

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

    r98103 r100321  
    155155    int             cOrder;
    156156    unsigned        cPages;
     157    void           *pvRet;
     158#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
    157159    struct page    *paPages;
    158     void           *pvRet;
     160#endif
    159161    IPRT_LINUX_SAVE_EFL_AC();
    160162
     
    171173    cPages = cb >> PAGE_SHIFT;
    172174    cOrder = CalcPowerOf2Order(cPages);
    173 #if (defined(RT_ARCH_AMD64) || defined(CONFIG_X86_PAE)) && defined(GFP_DMA32)
     175#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
     176# if (defined(RT_ARCH_AMD64) || defined(CONFIG_X86_PAE)) && defined(GFP_DMA32)
    174177    /* ZONE_DMA32: 0-4GB */
    175178    paPages = alloc_pages(GFP_DMA32 | __GFP_NOWARN, cOrder);
    176179    if (!paPages)
    177 #endif
    178 #ifdef RT_ARCH_AMD64
     180# endif
     181# ifdef RT_ARCH_AMD64
    179182        /* ZONE_DMA; 0-16MB */
    180183        paPages = alloc_pages(GFP_DMA | __GFP_NOWARN, cOrder);
    181 #else
     184# else
    182185        /* ZONE_NORMAL: 0-896MB */
    183186        paPages = alloc_pages(GFP_USER | __GFP_NOWARN, cOrder);
    184 #endif
     187# endif
    185188    if (paPages)
    186189    {
     
    210213    else
    211214        pvRet = NULL;
     215#else
     216    pvRet = (void *)__get_free_pages(GFP_DMA32 | __GFP_NOWARN, cOrder);
     217    if (pvRet)
     218        *pPhys = virt_to_phys(pvRet);
     219#endif
    212220
    213221    IPRT_LINUX_RESTORE_EFL_AC();
     
    229237        int             cOrder;
    230238        unsigned        cPages;
     239#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
    231240        unsigned        iPage;
    232241        struct page    *paPages;
     242#endif
    233243        IPRT_LINUX_SAVE_EFL_AC();
    234244
     
    241251        cPages = cb >> PAGE_SHIFT;
    242252        cOrder = CalcPowerOf2Order(cPages);
     253#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
    243254        paPages = virt_to_page(pv);
    244255
     
    251262        }
    252263        __free_pages(paPages, cOrder);
     264#else
     265        free_pages((uintptr_t)pv, cOrder);
     266#endif
    253267        IPRT_LINUX_RESTORE_EFL_AC();
    254268    }
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