Re: Any alternative to the MmAllocateContiguousMemory?



Elliott wrote:
Hi All,

As I found the MmAllocateContiguousMemory function is not available in WDM architecture, does any alternative to it and provide contiguous memory allocation from non-paged pool? So that we can directly access the allocated memory from both user mode application and physical hardware device under WDM.

    Thanks in advance,

Best Regards,
Elliott
WDM beginner



Are you building for a non NT (98) platform? That is really the only reason to use wdm.h rather than ntddk.h.

Mapping device memory into user space is discouraged. However if you are going to do this anyway, do not use MmAllocateContiguousMemory - it will not work on all platforms. Instead use AllocateCommonBuffer to allocate the contiguous memory and then either use MmMapLockedPagesSpecifyCache or ZwMapViewOfSection to get the thing into user mode. Better yet have your application send IO requests to your driver and have the drive perform the IO for your application.


--

=====================
Mark Roddy DDK MVP
Windows 2003/XP/2000 Consulting
Hollis Technology Solutions 603-321-1032
www.hollistech.com
.



Relevant Pages

  • Re: Any alternative to the MmAllocateContiguousMemory?
    ... > WDM architecture, does any alternative to it and provide contiguous memory ... > allocation from non-paged pool? ...
    (microsoft.public.development.device.drivers)
  • Any alternative to the MmAllocateContiguousMemory?
    ... WDM architecture, does any alternative to it and provide contiguous memory ... allocation from non-paged pool? ...
    (microsoft.public.development.device.drivers)
  • Re: Any alternative to the MmAllocateContiguousMemory?
    ... AllocateCommonBuffer does that. ... does any alternative to it and provide contiguous memory ... > device under WDM. ...
    (microsoft.public.development.device.drivers)
  • Re: Windows array allocation problem
    ... If I know for sure how much will be unavailable, I can set the maximum allocation accordingly. ... DSOs/DLLs - which can be dynamically loaded at various addresses at ... it seems that allocating any array to any size is a risky business that might suddenly fail for lack of adequate contiguous memory. ...
    (comp.lang.fortran)
  • Re: contiguous memory allocation problem
    ... I sometimes see that the USB driver is unable to allocate contiguous memory ... I am thinking about pre-allocating some memory for USB, ... which the USB system uses for memory allocation? ... The machine in question is running FreeBSD 7-current from April. ...
    (freebsd-hackers)