As we know, MmGetMdlPfnArray returns a pointer to the beginning of the array of physical page numbers.
I want to access the contents of the array.
How can I??
thanks a lot.
As we know, MmGetMdlPfnArray returns a pointer to the beginning of the array of physical page numbers.
I want to access the contents of the array.
How can I??
thanks a lot.
That’s more of a C question…Why do you want to go digging in the PFN array
anyway?
-scott
–
Scott Noone
Consulting Associate
OSR Open Systems Resources, Inc.
http://www.osronline.com
wrote in message news:xxxxx@ntdev…
> As we know, MmGetMdlPfnArray returns a pointer to the beginning of the
> array of physical page numbers.
>
> I want to access the contents of the array.
> How can I??
>
> thanks a lot.
>
What are you trying to do? Most direct access of the PfnArray are
because the developers created a bad design.
Don Burn (MVP, Windows DKD)
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
-----Original Message-----
From: xxxxx@hotmail.com [mailto:xxxxx@hotmail.com]
Posted At: Tuesday, March 09, 2010 5:44 AM
Posted To: ntdev
Conversation: about MmGetMdlPfnArray
Subject: about MmGetMdlPfnArrayAs we know, MmGetMdlPfnArray returns a pointer to the beginning of the
array of physical page numbers.I want to access the contents of the array.
How can I??thanks a lot.
__________ Information from ESET Smart Security, version of virus
signature database 4928 (20100309) __________The message was checked by ESET Smart Security.
> I want to access the contents of the array.
For what?
For DMA? there is a published DMA API.
–
Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com
yeah, I am doing DMA data transfer.
I hope to get each physical page information of a user buffer, which is locked by an MDL.
the information should includes:
The pointer returned by MmGetMdlPfnArray is the beginning of an array.
Can I access the array?
I hope to get useful information from the array.
thanks!
xxxxx@hotmail.com wrote:
yeah, I am doing DMA data transfer.
I hope to get each physical page information of a user buffer, which is locked by an MDL.
the information should includes:
- the beginning virtual address of a physical page,
- the beginning physical address of a physical page
- the length of a physical page, etc.
The pointer returned by MmGetMdlPfnArray is the beginning of an array.
Can I access the array?
You didn’t really think about what you are asking. MmGetMdlPfnArray
returns the address of the first element of the array. The next element
immediately follows that, just like an array of ints. No magic.
However, the right way to handle this is to use a DMA adapter, not to
dink directly with the MDL. The physical page number does not always
map directly to a bus address (although it usually does in x86 systems).
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
>You didn’t really think about what you are asking. MmGetMdlPfnArray
returns the address of the first element of the array. The next element
immediately follows that, just like an array of ints. No magic.
However, the right way to handle this is to use a DMA adapter, not to
dink directly with the MDL. The physical page number does not always
map directly to a bus address (although it usually does in x86 systems).
At present, I have a Lniux kernel code, which is realized by other colleagues, to port to Windows.
The Linux code splits a big user buffer into lots of single physical pages first and map each single page for DMA transfer.
It seems that the design can not be achieved under Windows.
Oh, my god!!
>
>You didn’t really think about what you are asking. MmGetMdlPfnArray
>returns the address of the first element of the array. The next
element
>immediately follows that, just like an array of ints. No magic.>However, the right way to handle this is to use a DMA adapter, not to
>dink directly with the MDL. The physical page number does not always
>map directly to a bus address (although it usually does in x86
systems).At present, I have a Lniux kernel code, which is realized by other
colleagues,
to port to Windows.
The Linux code splits a big user buffer into lots of single physical
pages
first and map each single page for DMA transfer.It seems that the design can not be achieved under Windows.
Oh, my god!!
Windows does that too, but it does it all for you. As others have said,
read the documentation.
James
> yeah, I am doing DMA data transfer.
Then use the DMA APIs and stop digging into the undocumented PFN array. Otherwise, you will have many in-the-field support issues.
The DMA APIs dig into this array, but in the correct way.
–
Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com
> The Linux code splits a big user buffer into lots of single physical pages first and map each single
page for DMA transfer.
It seems that the design can not be achieved under Windows.
It cannot.
The whole DMA code must be rewritten from scratch. Windows has another DMA architecture.
You do not see pages there. You only see the MDL, pass it to the DMA APIs to get the SGL. Then you see the SGL entries.
You do not need to “map” the SGL entries, they are already prepared, you just tell these addresses to your hardware.
When porting any Linux kmode code to Windows, be prepared to a major rewrite. Nearly no concepts match 1-to-1 between the 2 OSes.
–
Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com
>> The Linux code splits a big user buffer into lots of single physical pages
first and map each single
>page for DMA transfer.
>
> It seems that the design can not be achieved under Windows.
It cannot.
The whole DMA code must be rewritten from scratch. Windows has another DMA
architecture.
You do not see pages there. You only see the MDL, pass it to the DMA APIs to
get the SGL. Then you see the SGL entries.
You do not need to “map” the SGL entries, they are already prepared, you just
tell these addresses to your hardware.
When porting any Linux kmode code to Windows, be prepared to a major rewrite.
Nearly no concepts match 1-to-1 between the 2 OSes.
thanks!
I fully accept your suggestion. thanks again!!