VirtualBox

Changeset 80321 in vbox for trunk/src/VBox/Runtime/r0drv


Ignore:
Timestamp:
Aug 16, 2019 9:20:57 AM (5 years ago)
Author:
vboxsync
Message:

IPRT/memobj-r0drv-linux.c: Implemented mapping or sub-ranges as required for joining GVM and VM. bugref:9217

File:
1 edited

Legend:

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

    r78120 r80321  
    15501550    if (uAlignment > PAGE_SIZE)
    15511551        return VERR_NOT_SUPPORTED;
    1552     AssertMsgReturn(!offSub && !cbSub, ("%#zx %#zx\n", offSub, cbSub), VERR_NOT_SUPPORTED); /** @todo implement sub maps */
    15531552
    15541553#ifdef VBOX_USE_PAE_HACK
     
    15691568     * Create the IPRT memory object.
    15701569     */
    1571     pMemLnx = (PRTR0MEMOBJLNX)rtR0MemObjNew(sizeof(*pMemLnx), RTR0MEMOBJTYPE_MAPPING, NULL, pMemLnxToMap->Core.cb);
     1570    if (cbSub == 0)
     1571        cbSub = pMemLnxToMap->Core.cb;
     1572    pMemLnx = (PRTR0MEMOBJLNX)rtR0MemObjNew(sizeof(*pMemLnx), RTR0MEMOBJTYPE_MAPPING, NULL, cbSub);
    15721573    if (pMemLnx)
    15731574    {
     
    15761577         */
    15771578        void *pv;
    1578         pv = rtR0MemObjLinuxDoMmap(R3PtrFixed, pMemLnxToMap->Core.cb, uAlignment, pTask, fProt);
     1579        pv = rtR0MemObjLinuxDoMmap(R3PtrFixed, cbSub, uAlignment, pTask, fProt);
    15791580        if (pv != (void *)-1)
    15801581        {
     
    15831584             * This is generic, paranoid and not very efficient.
    15841585             */
    1585             pgprot_t        fPg = rtR0MemObjLinuxConvertProt(fProt, false /* user */);
     1586            pgprot_t        fPg       = rtR0MemObjLinuxConvertProt(fProt, false /* user */);
    15861587            unsigned long   ulAddrCur = (unsigned long)pv;
    1587             const size_t    cPages = pMemLnxToMap->Core.cb >> PAGE_SHIFT;
     1588            const size_t    cPages    = (offSub + cbSub) >> PAGE_SHIFT;
    15881589            size_t          iPage;
    15891590
     
    15931594            if (pMemLnxToMap->cPages)
    15941595            {
    1595                 for (iPage = 0; iPage < cPages; iPage++, ulAddrCur += PAGE_SIZE)
     1596                for (iPage = offSub >> PAGE_SHIFT; iPage < cPages; iPage++, ulAddrCur += PAGE_SIZE)
    15961597                {
    15971598#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 11)
     
    16481649                if (Phys != NIL_RTHCPHYS)
    16491650                {
    1650                     for (iPage = 0; iPage < cPages; iPage++, ulAddrCur += PAGE_SIZE, Phys += PAGE_SIZE)
     1651                    for (iPage = offSub >> PAGE_SHIFT; iPage < cPages; iPage++, ulAddrCur += PAGE_SIZE, Phys += PAGE_SIZE)
    16511652                    {
    16521653#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) || defined(HAVE_26_STYLE_REMAP_PAGE_RANGE)
     
    17221723             * Bail out.
    17231724             */
    1724             rtR0MemObjLinuxDoMunmap(pv, pMemLnxToMap->Core.cb, pTask);
     1725            rtR0MemObjLinuxDoMunmap(pv, cbSub, pTask);
    17251726        }
    17261727        rtR0MemObjDelete(&pMemLnx->Core);
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