lock paged memory pages

Discussion in 'Windows Vista Drivers' started by kobi n, Jul 31, 2007.

  1. kobi n

    kobi n Guest

    Hi,
    a part of my driver functionality requires allocating a very large memory
    amount for io buffers. previously this was done using the nonPaged pool but
    today this solution won't fit since i need a larger memory space then the
    nonPaged pool has to offer. Locking the memory is a must for me since these
    pages are accessed also by Hardware so they can't be paged out.


    so , i'm trying to do the following and would love to hear if i'm missing a
    basic concept while doing so since until now ... no success :

    i'm allocating the memory from the paged pool using ExAllocatePoolWithTag,
    then i allocate Mdl for such allocation and use the MmProbeAndLockPages
    to lock the pages in the memory. while doing so i save all the MDLs in a list
    so i can free them when needed.

    so far i get system crashes and i would love to hear if my concept is wrong.
     
    kobi n, Jul 31, 2007
    #1
    1. Advertisements

  2. You can also use MmAllocatePagesForMdl.
     
    Maxim S. Shatskih, Jul 31, 2007
    #2
    1. Advertisements

  3. kobi n

    kobi n Guest

    Hi,
    i dont think i understand. do you mean to use MmAllocatePagesForMdl
    instead of ExallocatePoolWithTag ?

    and -
    may i understand that my concept is Doable ?

    thanks,
    kobi.
     
    kobi n, Jul 31, 2007
    #3
  4. i dont think i understand. do you mean to use MmAllocatePagesForMdl
    Yes.
     
    Maxim S. Shatskih, Jul 31, 2007
    #4
  5. kobi n

    kobi n Guest

    Hi,

    from the documentation i see that the memory allocated by
    MmAllocatePagesForMdl is from the nonPaged pool and this is exactly what i'm
    trying to avoid since there is not enough memory in this pool for my needs.
     
    kobi n, Jul 31, 2007
    #5
  6. kobi n

    kuasha Guest

    There should be no crash if you check return status and handle exceptions. If
    you do that you probably get an idea why your code is not working. Is it
    possble that your memory allocation is failing and still you are trying to
    access memory? What is the BugCheck code?

    --
    Sincerely,
    Maruf Maniruzzaman,
    Software Engineer,
    KAZ Software Limited,
    Dhaka, Bangladesh.
    http://www.kaz.com.bd
    http://www.kuashaonline.com
     
    kuasha, Jul 31, 2007
    #6
  7. Yes, this memory is nonpaged, but the limit on it is by far more
    permittive.
     
    Maxim S. Shatskih, Jul 31, 2007
    #7
  8. kobi n

    Anton Bassov Guest

    Are you sure you call MmProbeAndLockPages() within try/except block???
    Please note that MmProbeAndLockPages() may rise STATUS_ACCESS_VIOLATION
    exception that you have to handle.....

    Anton Bassov
     
    Anton Bassov, Aug 1, 2007
    #8
  9. kobi n

    Pavel A. Guest

    But the MDL size by itself is limited, correct?
    Is the size requested by OP bigger than the MDL limit?

    --PA
     
    Pavel A., Aug 2, 2007
    #9
    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.