VirtualBox

Changeset 21962 in vbox


Ignore:
Timestamp:
Aug 4, 2009 3:11:31 PM (15 years ago)
Author:
vboxsync
Message:

SUPLib: touch ring-3 mappings so darwin.amd64 doesn't #PF when accessing them from kernel space. This ASSUMES that the kernel won't be reusing these pmap entries. (This problem and solution is similar to what rtR0MapObjNativeMapKernel experiences and does about it.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/SUPLib.cpp

    r20866 r21962  
    147147static int supLoadModule(const char *pszFilename, const char *pszModule, const char *pszSrvReqHandler, void **ppvImageBase);
    148148static DECLCALLBACK(int) supLoadModuleResolveImport(RTLDRMOD hLdrMod, const char *pszModule, const char *pszSymbol, unsigned uSymbol, RTUINTPTR *pValue, void *pvUser);
     149
     150
     151/** Touch a range of pages. */
     152DECLINLINE(void) supR3TouchPages(void *pv, size_t cPages)
     153{
     154    uint32_t volatile *pu32 = (uint32_t volatile *)pv;
     155    while (cPages-- > 0)
     156    {
     157        ASMAtomicCmpXchgU32(pu32, 0, 0);
     158        pu32 += PAGE_SIZE / sizeof(uint32_t);
     159    }
     160}
    149161
    150162
     
    10601072                        Assert(!(paPages[iPage].Phys & ~X86_PTE_PAE_PG_MASK));
    10611073                    }
     1074#ifdef RT_OS_DARWIN /* HACK ALERT! */
     1075                supR3TouchPages(pReq->u.Out.pvR3, cPages);
     1076#endif
    10621077            }
    10631078            else if (   rc == VERR_NOT_SUPPORTED
     
    12451260        if (pR0Ptr)
    12461261            *pR0Ptr = Req.u.Out.pvR0;
     1262#ifdef RT_OS_DARWIN /* HACK ALERT! */
     1263        supR3TouchPages(Req.u.Out.pvR3, cPages);
     1264#endif
    12471265        return Req.u.Out.pvR3;
    12481266    }
     
    13421360                    Assert(paPages[iPage].Phys <= UINT32_C(0xfffff000));
    13431361                }
     1362#ifdef RT_OS_DARWIN /* HACK ALERT! */
     1363            supR3TouchPages(pReq->u.Out.pvR3, cPages);
     1364#endif
    13441365        }
    13451366        RTMemTmpFree(pReq);
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