VirtualBox

Changeset 100355 in vbox


Ignore:
Timestamp:
Jul 4, 2023 6:37:35 AM (17 months ago)
Author:
vboxsync
Message:

Runtime/RTR0MemObj*: Add PhysHighest parameter to RTR0MemObjAllocCont to indicate the maximum allowed physical address for an allocation, bugref:10457

Location:
trunk
Files:
14 edited

Legend:

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

    r98103 r100355  
    281281/**
    282282 * Allocates page aligned virtual kernel memory with contiguous physical backing
    283  * below 4GB (default tag).
     283 * (default tag).
    284284 *
    285285 * The physical memory backing the allocation is fixed.
     
    288288 * @param   pMemObj         Where to store the ring-0 memory object handle.
    289289 * @param   cb              Number of bytes to allocate. This is rounded up to nearest page.
     290 * @param   PhysHighest     The highest permitable address (inclusive).
     291 *                          Pass NIL_RTHCPHYS if any address is acceptable.
    290292 * @param   fExecutable     Flag indicating whether it should be permitted to
    291293 *                          executed code in the memory object.  The user must
     
    293295 *                          allocation to actually make it executable.
    294296 */
    295 #define RTR0MemObjAllocCont(pMemObj, cb, fExecutable) \
    296     RTR0MemObjAllocContTag((pMemObj), (cb), (fExecutable), RTMEM_TAG)
    297 
    298 /**
    299  * Allocates page aligned virtual kernel memory with contiguous physical backing
    300  * below 4GB (custom tag).
     297#define RTR0MemObjAllocCont(pMemObj, cb, PhysHigest, fExecutable) \
     298    RTR0MemObjAllocContTag((pMemObj), (cb), (PhysHigest), (fExecutable), RTMEM_TAG)
     299
     300/**
     301 * Allocates page aligned virtual kernel memory with contiguous physical
     302 * backing (custom tag).
    301303 *
    302304 * The physical memory backing the allocation is fixed.
     
    305307 * @param   pMemObj         Where to store the ring-0 memory object handle.
    306308 * @param   cb              Number of bytes to allocate. This is rounded up to nearest page.
     309 * @param   PhysHighest     The highest permitable address (inclusive).
     310 *                          Pass NIL_RTHCPHYS if any address is acceptable.
    307311 * @param   fExecutable     Flag indicating whether it should be permitted to
    308312 *                          executed code in the memory object.  The user must
     
    311315 * @param   pszTag          Allocation tag used for statistics and such.
    312316 */
    313 RTR0DECL(int) RTR0MemObjAllocContTag(PRTR0MEMOBJ pMemObj, size_t cb, bool fExecutable, const char *pszTag);
     317RTR0DECL(int) RTR0MemObjAllocContTag(PRTR0MEMOBJ pMemObj, size_t cb, RTHCPHYS PhysHighest, bool fExecutable, const char *pszTag);
    314318
    315319/**
  • trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-haiku-stubs.c

    r98103 r100355  
    174174    return g_VBoxGuest->_RTR0MemObjAddressR3(MemObj);
    175175}
    176 RTR0DECL(int) RTR0MemObjAllocContTag(PRTR0MEMOBJ pMemObj, size_t cb, bool fExecutable, const char *pszTag)
    177 {
    178     return g_VBoxGuest->_RTR0MemObjAllocContTag(pMemObj, cb, fExecutable, pszTag);
     176RTR0DECL(int) RTR0MemObjAllocContTag(PRTR0MEMOBJ pMemObj, size_t cb, RTHCPHYS PhysHighest, bool fExecutable, const char *pszTag)
     177{
     178    return g_VBoxGuest->_RTR0MemObjAllocContTag(pMemObj, cb, PhysHighest, fExecutable, pszTag);
    179179}
    180180RTR0DECL(int) RTR0MemObjAllocLowTag(PRTR0MEMOBJ pMemObj, size_t cb, bool fExecutable, const char *pszTag)
  • trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-haiku.h

    r98103 r100355  
    150150    void* (*_RTR0MemObjAddress)(RTR0MEMOBJ MemObj);
    151151    RTR3PTR(*_RTR0MemObjAddressR3)(RTR0MEMOBJ MemObj);
    152     int (*_RTR0MemObjAllocContTag)(PRTR0MEMOBJ pMemObj, size_t cb, bool fExecutable, const char *pszTag);
     152    int (*_RTR0MemObjAllocContTag)(PRTR0MEMOBJ pMemObj, size_t cb, RTHCPHYS PhysHighest, bool fExecutable, const char *pszTag);
    153153    int (*_RTR0MemObjAllocLowTag)(PRTR0MEMOBJ pMemObj, size_t cb, bool fExecutable, const char *pszTag);
    154154    int (*_RTR0MemObjAllocPageTag)(PRTR0MEMOBJ pMemObj, size_t cb, bool fExecutable, const char *pszTag);
  • trunk/src/VBox/HostDrivers/Support/SUPDrv.cpp

    r99421 r100355  
    454454    SUPEXP_STK_OKAY(    1,  RTR0MemObjAddress),
    455455    SUPEXP_STK_OKAY(    1,  RTR0MemObjAddressR3),
    456     SUPEXP_STK_BACK(    4,  RTR0MemObjAllocContTag),
     456    SUPEXP_STK_BACK(    5,  RTR0MemObjAllocContTag),
    457457    SUPEXP_STK_BACK(    5,  RTR0MemObjAllocLargeTag),
    458458    SUPEXP_STK_BACK(    4,  RTR0MemObjAllocLowTag),
  • trunk/src/VBox/Runtime/include/internal/memobj.h

    r98103 r100355  
    361361 * @param   ppMem           Where to store the ring-0 memory object handle.
    362362 * @param   cb              Number of bytes to allocate, page aligned.
     363 * @param   PhysHighest     The highest permitable address (inclusive).
     364 *                          Pass NIL_RTHCPHYS if any address is acceptable.
    363365 * @param   fExecutable     Flag indicating whether it should be permitted to executed code in the memory object.
    364366 * @param   pszTag          Allocation tag used for statistics and such.
    365367 */
    366 DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable, const char *pszTag);
     368DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest,
     369                                          bool fExecutable, const char *pszTag);
    367370
    368371/**
  • trunk/src/VBox/Runtime/r0drv/darwin/memobj-r0drv-darwin.cpp

    r98103 r100355  
    885885
    886886
    887 DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable, const char *pszTag)
    888 {
     887/**
     888 * Translates the PhysHighest address into a mask.
     889 */
     890static mach_vm_address_t rtR0MemObjDarwinCalcPhysMask(RTHCPHYS PhysHighest, size_t uAlignment)
     891{
     892    if (PhysHighest == NIL_RTHCPHYS)
     893        return uAlignment <= PAGE_SIZE ? 0 : ~(mach_vm_address_t)(uAlignment - 1);
     894
     895    mach_vm_address_t PhysMask = ~(mach_vm_address_t)0;
     896    while (PhysMask > (PhysHighest | PAGE_OFFSET_MASK))
     897        PhysMask >>= 1;
     898    PhysMask &= ~(mach_vm_address_t)(uAlignment - 1);
     899
     900    return PhysMask;
     901}
     902
     903
     904DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest,
     905                                          bool fExecutable, const char *pszTag)
     906{
     907    mach_vm_address_t const PhysMask = rtR0MemObjDarwinCalcPhysMask(PhysHighest, PAGE_SIZE);
    889908    IPRT_DARWIN_SAVE_EFL_AC();
    890909
    891     int rc = rtR0MemObjNativeAllocWorker(ppMem, cb, fExecutable, true /* fContiguous */,
    892                                          ~(uint32_t)PAGE_OFFSET_MASK, _4G - PAGE_SIZE,
     910    int rc = rtR0MemObjNativeAllocWorker(ppMem, cb, fExecutable, true /* fContiguous */, PhysMask, PhysHighest,
    893911                                         RTR0MEMOBJTYPE_CONT, PAGE_SIZE, pszTag, false /*fOnKernelThread*/);
    894912
     
    898916     */
    899917    if (RT_FAILURE(rc) && cb <= PAGE_SIZE)
    900         rc = rtR0MemObjNativeAllocWorker(ppMem, cb + PAGE_SIZE, fExecutable, true /* fContiguous */,
    901                                          ~(uint32_t)PAGE_OFFSET_MASK, _4G - PAGE_SIZE,
     918        rc = rtR0MemObjNativeAllocWorker(ppMem, cb + PAGE_SIZE, fExecutable, true /* fContiguous */, PhysMask, PhysHighest,
    902919                                         RTR0MEMOBJTYPE_CONT, PAGE_SIZE, pszTag, false /*fOnKernelThread*/);
    903920    IPRT_DARWIN_RESTORE_EFL_AC();
     
    915932            return VERR_NOT_SUPPORTED;
    916933    }
     934    mach_vm_address_t const PhysMask = rtR0MemObjDarwinCalcPhysMask(PhysHighest, uAlignment);
    917935
    918936    IPRT_DARWIN_SAVE_EFL_AC();
     
    923941    int rc;
    924942    if (PhysHighest == NIL_RTHCPHYS)
    925         rc = rtR0MemObjNativeAllocWorker(ppMem, cb, false /* fExecutable */, true /* fContiguous */,
    926                                          uAlignment <= PAGE_SIZE ? 0 : ~(mach_vm_address_t)(uAlignment - 1) /* PhysMask*/,
    927                                          UINT64_MAX, RTR0MEMOBJTYPE_PHYS, uAlignment, pszTag, false /*fOnKernelThread*/);
     943        rc = rtR0MemObjNativeAllocWorker(ppMem, cb, false /* fExecutable */, true /* fContiguous */, PhysMask, UINT64_MAX,
     944                                         RTR0MEMOBJTYPE_PHYS, uAlignment, pszTag, false /*fOnKernelThread*/);
    928945    else
    929946    {
    930         mach_vm_address_t PhysMask = 0;
    931         PhysMask = ~(mach_vm_address_t)0;
    932         while (PhysMask > (PhysHighest | PAGE_OFFSET_MASK))
    933             PhysMask >>= 1;
    934947        AssertReturn(PhysMask + 1 <= cb, VERR_INVALID_PARAMETER);
    935         PhysMask &= ~(mach_vm_address_t)(uAlignment - 1);
    936 
    937         rc = rtR0MemObjNativeAllocWorker(ppMem, cb, false /* fExecutable */, true /* fContiguous */,
    938                                          PhysMask, PhysHighest,
     948        rc = rtR0MemObjNativeAllocWorker(ppMem, cb, false /* fExecutable */, true /* fContiguous */, PhysMask, PhysHighest,
    939949                                         RTR0MEMOBJTYPE_PHYS, uAlignment, pszTag, false /*fOnKernelThread*/);
    940950    }
  • trunk/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c

    r98103 r100355  
    410410
    411411
    412 DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable, const char *pszTag)
     412DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHigest,
     413                                          bool fExecutable, const char *pszTag)
    413414{
    414415    PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), RTR0MEMOBJTYPE_CONT,
     
    416417    if (pMemFreeBSD)
    417418    {
    418         int rc = rtR0MemObjFreeBSDAllocHelper(pMemFreeBSD, fExecutable, _4G - 1, true /*fContiguous*/, VERR_NO_CONT_MEMORY);
     419        int rc = rtR0MemObjFreeBSDAllocHelper(pMemFreeBSD, fExecutable, PhysHigest, true /*fContiguous*/, VERR_NO_CONT_MEMORY);
    419420        if (RT_SUCCESS(rc))
    420421        {
  • trunk/src/VBox/Runtime/r0drv/haiku/memobj-r0drv-haiku.c

    r98103 r100355  
    277277
    278278
    279 int rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable, const char *pszTag)
    280 {
    281     return rtR0MemObjNativeAllocArea(ppMem, cb, fExecutable, RTR0MEMOBJTYPE_CONT, 0 /* PhysHighest */, 0 /* uAlignment */, pszTag);
     279int rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest, bool fExecutable, const char *pszTag)
     280{
     281    return rtR0MemObjNativeAllocArea(ppMem, cb, fExecutable, RTR0MEMOBJTYPE_CONT, PhysHighest, 0 /* uAlignment */, pszTag);
    282282}
    283283
  • trunk/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c

    r100319 r100355  
    149149/** Pointer to the linux memory object. */
    150150typedef RTR0MEMOBJLNX *PRTR0MEMOBJLNX;
     151
     152
     153/*********************************************************************************************************************************
     154*   Global Variables                                                                                                             *
     155*********************************************************************************************************************************/
     156/*
     157 * Linux allows only a coarse selection of zones for
     158 * allocations matching a particular maximum physical address.
     159 *
     160 * Sorted from high to low physical address!
     161 */
     162static const struct
     163{
     164    RTHCPHYS    PhysHighest;
     165    gfp_t       fGfp;
     166} g_aZones[] =
     167{
     168    { NIL_RTHCPHYS,      GFP_KERNEL },
     169#if (defined(RT_ARCH_AMD64) || defined(CONFIG_X86_PAE)) && defined(GFP_DMA32)
     170    { _4G - 1,           GFP_DMA32  }, /* ZONE_DMA32: 0-4GB */
     171#elif defined(RT_ARCH_ARM32) || defined(RT_ARCH_ARM64)
     172    { _4G - 1,           GFP_DMA    }, /* ZONE_DMA: 0-4GB */
     173#endif
     174#if defined(RT_ARCH_AMD64)
     175    { _16M - 1,          GFP_DMA    }, /* ZONE_DMA: 0-16MB */
     176#elif defined(RT_ARCH_X86)
     177    { 896 * _1M - 1,     GFP_USER   }, /* ZONE_NORMAL (32-bit hosts): 0-896MB */
     178#endif
     179};
    151180
    152181
     
    9721001
    9731002
    974 DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable, const char *pszTag)
     1003DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest,
     1004                                          bool fExecutable, const char *pszTag)
    9751005{
    9761006    IPRT_LINUX_SAVE_EFL_AC();
    9771007    PRTR0MEMOBJLNX pMemLnx;
    9781008    int rc;
    979 
    980 #if (defined(RT_ARCH_AMD64) || defined(RT_ARCH_ARM64) || defined(CONFIG_X86_PAE)) && defined(GFP_DMA32)
    981     /* ZONE_DMA32: 0-4GB */
    982     rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_CONT, cb, PAGE_SIZE, GFP_DMA32,
    983                                    true /* contiguous */, fExecutable, VERR_NO_CONT_MEMORY, pszTag);
    984     if (RT_FAILURE(rc))
    985 #endif
    986 #if defined(RT_ARCH_AMD64) || defined(RT_ARCH_ARM64)
    987         /* ZONE_DMA: 0-16MB */
    988         rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_CONT, cb, PAGE_SIZE, GFP_DMA,
     1009    uint32_t idxZone;
     1010
     1011    /*
     1012     * The last zone must be able to satisfy the PhysHighest requirement or there
     1013     * will be no zone at all.
     1014     */
     1015    if (g_aZones[RT_ELEMENTS(g_aZones) - 1].PhysHighest > PhysHighest)
     1016    {
     1017        IPRT_LINUX_RESTORE_EFL_AC();
     1018        AssertMsgFailedReturn(("No zone can satisfy PhysHighest=%RHp!\n", PhysHighest),
     1019                              VERR_NO_CONT_MEMORY);
     1020    }
     1021
     1022    /* Find the first zone matching our PhysHighest requirement. */
     1023    idxZone = 0;
     1024    for (;;)
     1025    {
     1026        if (g_aZones[idxZone].PhysHighest <= PhysHighest)
     1027            break; /* We found a zone satisfying the requirement. */
     1028        idxZone++;
     1029    }
     1030
     1031    /* Now try to allocate pages from all the left zones until one succeeds. */
     1032    for (;;)
     1033    {
     1034        rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_CONT, cb, PAGE_SIZE, g_aZones[idxZone].fGfp,
    9891035                                       true /* contiguous */, fExecutable, VERR_NO_CONT_MEMORY, pszTag);
    990 #else
    991         /* ZONE_NORMAL (32-bit hosts): 0-896MB */
    992         rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_CONT, cb, PAGE_SIZE, GFP_USER,
    993                                        true /* contiguous */, fExecutable, VERR_NO_CONT_MEMORY, pszTag);
    994 #endif
     1036        idxZone++;
     1037        if (RT_SUCCESS(rc) || idxZone == RT_ELEMENTS(g_aZones))
     1038            break;
     1039    }
    9951040    if (RT_SUCCESS(rc))
    9961041    {
     
    9981043        if (RT_SUCCESS(rc))
    9991044        {
    1000 #if defined(RT_STRICT) && (defined(RT_ARCH_AMD64) || defined(CONFIG_HIGHMEM64G))
     1045#if defined(RT_STRICT)
    10011046            size_t iPage = pMemLnx->cPages;
    10021047            while (iPage-- > 0)
    1003                 Assert(page_to_phys(pMemLnx->apPages[iPage]) < _4G);
     1048                Assert(page_to_phys(pMemLnx->apPages[iPage]) < PhysHighest);
    10041049#endif
    10051050            pMemLnx->Core.u.Cont.Phys = page_to_phys(pMemLnx->apPages[0]);
  • trunk/src/VBox/Runtime/r0drv/memobj-r0drv.cpp

    r99758 r100355  
    474474
    475475
    476 RTR0DECL(int) RTR0MemObjAllocContTag(PRTR0MEMOBJ pMemObj, size_t cb, bool fExecutable, const char *pszTag)
     476RTR0DECL(int) RTR0MemObjAllocContTag(PRTR0MEMOBJ pMemObj, size_t cb, RTHCPHYS PhysHighest, bool fExecutable, const char *pszTag)
    477477{
    478478    /* sanity checks. */
     
    482482    AssertReturn(cb > 0, VERR_INVALID_PARAMETER);
    483483    AssertReturn(cb <= cbAligned, VERR_INVALID_PARAMETER);
     484    AssertReturn(PhysHighest >= cb, VERR_INVALID_PARAMETER);
    484485    RT_ASSERT_PREEMPTIBLE();
    485486
    486487    /* do the allocation. */
    487     return rtR0MemObjNativeAllocCont(pMemObj, cbAligned, fExecutable, pszTag);
     488    return rtR0MemObjNativeAllocCont(pMemObj, cbAligned, PhysHighest, fExecutable, pszTag);
    488489}
    489490RT_EXPORT_SYMBOL(RTR0MemObjAllocContTag);
  • trunk/src/VBox/Runtime/r0drv/netbsd/memobj-r0drv-netbsd.c

    r98103 r100355  
    288288
    289289
    290 DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable, const char *pszTag)
     290DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest,
     291                                          bool fExecutable, const char *pszTag)
    291292{
    292293    PRTR0MEMOBJNETBSD pMemNetBSD = (PRTR0MEMOBJNETBSD)rtR0MemObjNew(sizeof(*pMemNetBSD), RTR0MEMOBJTYPE_CONT, NULL, cb, pszTag);
    293294    if (pMemNetBSD)
    294295    {
    295         int rc = rtR0MemObjNetBSDAllocHelper(pMemNetBSD, cb, fExecutable, _4G - 1, true /*fContiguous*/);
     296        int rc = rtR0MemObjNetBSDAllocHelper(pMemNetBSD, cb, fExecutable, PhysHighest, true /*fContiguous*/);
    296297        if (RT_SUCCESS(rc))
    297298        {
  • trunk/src/VBox/Runtime/r0drv/nt/memobj-r0drv-nt.cpp

    r98103 r100355  
    565565     * Fall back on contiguous memory...
    566566     */
    567     return rtR0MemObjNativeAllocCont(ppMem, cb, fExecutable, pszTag);
     567    return rtR0MemObjNativeAllocCont(ppMem, cb, _4G - 1, fExecutable, pszTag);
    568568}
    569569
     
    636636
    637637
    638 DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable, const char *pszTag)
    639 {
    640     return rtR0MemObjNativeAllocContEx(ppMem, cb, fExecutable, _4G-1, PAGE_SIZE /* alignment */, pszTag);
     638DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest,
     639                                          bool fExecutable, const char *pszTag)
     640{
     641    return rtR0MemObjNativeAllocContEx(ppMem, cb, fExecutable, PhysHighest, PAGE_SIZE /* alignment */, pszTag);
    641642}
    642643
  • trunk/src/VBox/Runtime/r0drv/os2/memobj-r0drv-os2.cpp

    r98103 r100355  
    218218
    219219
    220 DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable, const char *pszTag)
     220DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest,
     221                                          bool fExecutable, const char *pszTag)
    221222{
    222223    NOREF(fExecutable);
     224    AssertMsgReturn(PhysHighest >= _16M - 1, ("PhysHigest=%RHp\n", PhysHighest), VERR_NOT_SUPPORTED);
    223225
    224226    /* create the object. */
     
    229231        /* do the allocation. */
    230232        ULONG ulPhys = ~0UL;
    231         int rc = KernVMAlloc(cb, VMDHA_FIXED | VMDHA_CONTIG, &pMemOs2->Core.pv, (PPVOID)&ulPhys, NULL);
     233        int rc = KernVMAlloc(cb, VMDHA_FIXED | VMDHA_CONTIG | (PhysHighest < _4G - 1 ? VMDHA_16M : 0),
     234                             &pMemOs2->Core.pv, (PPVOID)&ulPhys, NULL);
    232235        if (!rc)
    233236        {
     
    248251                                          const char *pszTag)
    249252{
    250     AssertMsgReturn(PhysHighest >= 16 *_1M, ("PhysHigest=%RHp\n", PhysHighest), VERR_NOT_SUPPORTED);
     253    AssertMsgReturn(PhysHighest >= _16M - 1, ("PhysHigest=%RHp\n", PhysHighest), VERR_NOT_SUPPORTED);
    251254
    252255    /** @todo alignment  */
     
    261264        /* do the allocation. */
    262265        ULONG ulPhys = ~0UL;
    263         int rc = KernVMAlloc(cb, VMDHA_FIXED | VMDHA_CONTIG | (PhysHighest < _4G ? VMDHA_16M : 0),
     266        int rc = KernVMAlloc(cb, VMDHA_FIXED | VMDHA_CONTIG | (PhysHighest < _4G - 1 ? VMDHA_16M : 0),
    264267                             &pMemOs2->Core.pv, (PPVOID)&ulPhys, NULL);
    265268        if (!rc)
  • trunk/src/VBox/Runtime/r0drv/solaris/memobj-r0drv-solaris.c

    r98103 r100355  
    727727
    728728
    729 DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable, const char *pszTag)
     729DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest,
     730                                          bool fExecutable, const char *pszTag)
    730731{
    731732    AssertReturn(!fExecutable, VERR_NOT_SUPPORTED);
    732     return rtR0MemObjNativeAllocPhys(ppMem, cb, _4G - 1, PAGE_SIZE /* alignment */, pszTag);
     733    return rtR0MemObjNativeAllocPhys(ppMem, cb, PhysHigest, PAGE_SIZE /* alignment */, pszTag);
    733734}
    734735
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