VirtualBox

Ignore:
Timestamp:
May 24, 2009 2:34:58 AM (16 years ago)
Author:
vboxsync
Message:

memobj-r0drv-darwin.cpp: Added an ugly hack in rtR0MemObjNativeMapKernel that touches all the pages in the mapping to make sure there are page table entries for them. Need to take a second look at this later...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r0drv/darwin/memobj-r0drv-darwin.cpp

    r16329 r19956  
    3636
    3737#include <iprt/memobj.h>
     38
    3839#include <iprt/alloc.h>
     40#include <iprt/asm.h>
    3941#include <iprt/assert.h>
    4042#include <iprt/log.h>
    4143#include <iprt/param.h>
     44#include <iprt/process.h>
    4245#include <iprt/string.h>
    43 #include <iprt/process.h>
     46
    4447#include "internal/memobj.h"
    4548
     
    508511            {
    509512                /*
     513                 * HACK ALERT!
     514                 *
     515                 * Touch the pages to force the kernel to create  the page
     516                 * table entries. This is necessary since the kernel gets
     517                 * upset if we take a page fault when preemption is disabled
     518                 * and/or we own a simple lock. It has no problems with us
     519                 * disabling interrupts when taking the traps, weird stuff.
     520                 */
     521                uint32_t volatile  *pu32   = (uint32_t volatile *)pv;
     522                size_t              cbLeft = cbSub;
     523                for (;;)
     524                {
     525                    ASMAtomicCmpXchgU32(pu32, 0xdeadbeef, 0xdeadbeef);
     526                    if (cbLeft <= PAGE_SIZE)
     527                        break;
     528                    cbLeft -= PAGE_SIZE;
     529                    pu32 += PAGE_SIZE / sizeof(uint32_t);
     530                }
     531
     532                /*
    510533                 * Create the IPRT memory object.
    511534                 */
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