Mapping Reserved Memory To User Mode

Discussion in 'Windows Vista Drivers' started by Michael, Sep 21, 2007.

  1. Michael

    Michael Guest

    I need to reserve some physical memory at boot time, and map it to user mode
    later on. I set /burnmemory=50 in boot.ini. Then I made the following calls:

    MmGetPhysicalMemoryRanges()
    MmMapIoSpace()

    .... later on in user context
    IoAllocateMdl()
    MmBuildMdlForNonPagedPool()
    MmMapLockedPagesSpecifyCache()


    The problem is that Driver Verifier is complaining that the pages were never
    locked down.

    "MmMapLockedPages called to map, but the caller hasn't locked down the MDL
    pages."

    I shouldn't have to lock these down since I made a call to MmMapIoSpace().
    If I actually try to lock them down, I get another Driver Verifier bug check
    stating that I shouldn't lock down the pages.

    Where am I going wrong?

    Thanks,
    Michael
     
    Michael, Sep 21, 2007
    #1
    1. Advertisements

  2. This means that some of the pages in the MDL were part of the
    PFN database and their refcount was 0.

    Make sure the entire range you're mapping with MmMapIoSpace
    is outside the PFN database. It's probably easier to do this
    if you use /maxmem rather than /burnmemory.

    By the way, why do you need MmMapLockedPagesSpecifyCache?
    Are you mapping these pages into user address space?
     
    Pavel Lebedinsky [MSFT], Sep 26, 2007
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.