Hi , all
When does it happen that MdlAddress->MappedSystemVa == 0 and MdlAddress->StartVa == 0 ?
The Classpnp driver set Srb->DataBuffer = MmGetMdlVirtualAddress( MdlAddress ).
I add a completion routine to interpret IRP_MJ_SCSI. Then use
buffer = MmGetMdlSystemAddressForSafe(MdlAddress) to get data. I am confused
that sometimes the buffer address is equals to MdlAddress->MappedSystemVa, but sometimes is not.
Best Regards
A confused newbie…
one of the memory manager’s page-scrubbing threads likes to build MDLs
that don’t have any virtual address and send them to the storage stack
once in a while. There are probably a couple more places that it comes
from too.
you should pretty much ignore StartVa and the MDL virtual address at the
storage driver level. Chances are you aren’t running in the context of
caller anymore so it’s useless. The storage stack uses it for legacy
reasons but the class and port drivers don’t access it directly (either
data is transferred using DMA or the port driver calls
MmGetSystemAddressForMdlSafe on the miniport’s behalf).
If you want a pointer to the databuffer then you should always call
MmGetSystemAddressForMdlSafe. It checks the MDL flags to see if the MDL
has been mapped into the kernel VA space and, if not, calls the routine
to map it.
on a SCSI note:
srb->DataBuffer is sometimes an offset into the MDL’s data buffer. the
class drivers do this rather than allocating subordinate MDLs. If you
want to map the data buffer for the MDL you need to do something like
PUCHAR buffer = MmGetSystemAddressForMdlSafe(mdl)
buffer += Srb->DataBuffer - MmGetVirtualAddressForMdl(mdl)
it can be a pain in the butt, but it saves us a pool allocation when we
need to break up requests.
-p
-----Original Message-----
From: t [mailto:t]
Sent: Thursday, August 29, 2002 10:21 PM
To: NT Developers Interest List
Subject: [ntdev] MdlAddress->MappedSystemVa == 0 and MdlAddress->StartVa
== 0
Hi , all
When does it happen that MdlAddress->MappedSystemVa == 0 and
MdlAddress->StartVa == 0 ?
The Classpnp driver set Srb->DataBuffer = MmGetMdlVirtualAddress(
MdlAddress ).
I add a completion routine to interpret IRP_MJ_SCSI. Then use
buffer = MmGetMdlSystemAddressForSafe(MdlAddress) to get data. I am
confused
that sometimes the buffer address is equals to
MdlAddress->MappedSystemVa, but sometimes is not.
Best Regards
A confused newbie…
—
You are currently subscribed to ntdev as: xxxxx@microsoft.com
To unsubscribe send a blank email to %%email.unsub%%