MDL/ GetScatterGatherList problems.
From: Christian Sturt (christiansturt_at_yahoo.co.uk)
Date: 07/02/04
- Next message: Stephan Wolf [MVP]: "Re: memcpy to PCI Adapter Memory"
- Previous message: valentin tihomirov: "Hacking USB HID driver."
- Next in thread: Maxim S. Shatskih: "Re: MDL/ GetScatterGatherList problems."
- Reply: Maxim S. Shatskih: "Re: MDL/ GetScatterGatherList problems."
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 2 Jul 2004 15:07:31 +0100
I am trying to build a scatter gather list for an area of user memory after
locking it down. To do this I use the following (with bits removed):
//allocate an MDL to describe the user buffer
mdl = IoAllocateMdl(pDmaBuffer, pdx->nbytes, FALSE, TRUE, NULL);
//this should initialise the MDL headers etc?
MmInitializeMdl(mdl , pDmaBuffer, pdx->nbytes );
//want to lock memory for access.
MmProbeAndLockPages(pdx->theDmaTransfer.theDmaBuffer.mdl , UserMode,
IoModifyAccess);
//get a vadd for use.
vaddr = MmGetSystemAddressForMdlSafe(mdl , NormalPagePriority );
status = GetScatterGatherList (MyadapterObject, fdo, mdl , vaddr,
pdx->nbytes, (PDRIVER_LIST_CONTROL) DmaExecutionRoutine, pdx, FALSE);
//call get scatter gather list.
GetScatterGatherList always returns success, but the list returned is trash.
Some addresses are repeated etc.
I think that the problem must be my MDL (there isn't much else to go
wrong!).
Do I need to use MmInitializeMdl, or does MmProbeAndLockPages fill in the
MDL header?
When I removed it I have the same problem. Am I calling them in the correct
order? They seem logical to me.
Any suggestions why I would get a dodgy SG list?
Thanks
- Next message: Stephan Wolf [MVP]: "Re: memcpy to PCI Adapter Memory"
- Previous message: valentin tihomirov: "Hacking USB HID driver."
- Next in thread: Maxim S. Shatskih: "Re: MDL/ GetScatterGatherList problems."
- Reply: Maxim S. Shatskih: "Re: MDL/ GetScatterGatherList problems."
- Messages sorted by: [ date ] [ thread ]