Hello
I’m trying to implement common buffer DMA.
Driver calls AllocateCommonBuffer to get the contiguous memory ( 2MBytes or
more ) and build the MDL:
//…
ext->dma.cb_vaddr = (ULONG)
ext->dma.AdapterObject->DmaOperations->AllocateCommonBuffer(ext->dma.Adapter
Object, ext->Camera.Size, &ext->dma.phaddr, FALSE);
//…
PMDL pmdl = IoAllocateMdl((PVOID)ext->dma.cb_vaddr, ext->Size, FALSE, FALSE,
NULL);
if(pmdl == NULL)
{
//…
return FALSE;
}
ext->dma.cb_mdl = pmdl;
MmBuildMdlForNonPagedPool(pmdl);
//…
Than aplication allocates the 2MBytes of the virtual memory and gives to the
driver this buffer, using METHOD_NEITHER method
Driver tryes to map it to the common buffer (ext->dma.cb_vaddr), but gets
the BSOD after calling
ext->dma.user_vaddr = (ULONG)buff_out;
ULONG user_addr = (ULONG)MmMapLockedPagesSpecifyCache( ext->dma.cb_mdl,
UserMode, MmNonCached, (PVOID)ext->dma.user_vaddr, FALSE,
NormalPagePriority );
Of course, if ext->dma.user_vaddr == NULL, MmMapLockedPagesSpecifyCache
works fine, but I need to map the address, specified by the application! Are
there the ways to implement it?
Are there the way to map fixed User mode address to the contiguous pages?
Please, do not suggest me to read the article from NT Insider 7.2. Article
is great, but I need to map fixed address, specified by the application.
Thanks a lot,
Nikolay