How to get Page Frame number of MDL

Hi All,

I am not sure if this is right forum for this question, if not please point
me to right list.

I Have allocated MDL using IOAllocateMDL.
After that I lock MDL with MmProbeAndLockPages and also call
MmGetSystemAddressForMDLSafe.

I am trying to find out PFN numbers for physical pages mapped by MDL.
Earlier I was accessing PFN array in MDL. But since MSDN says that it is
not recommended,
I was trying to do something as below-
I call va = MmGetMDLVIrtualAddress (MDL);

Then I find physical address
pa = MmGetPhysicalAddress(va)

And from this Physical address I find PPN by shifting 12 bits.
But ppn i get through this logic does not match with PFN array in MDL.

So is this procedure correct ? What is wrong here?

Thanks,
-Ulka

Unless you want to know how to get the PFN from the debugger, this isn’t the
right forum (try NTDEV).

BUT, before asking this on NTDEV…It sounds to me like you’re lost off a
cliff someplace. MmGetMdlPfnArray is the right way to get the PFN
information from an MDL, but why do you need this? MSDN probably says that
it’s not recommended because the resulting PFNs are not suitable for DMA,
which is usually why people want physical addresses. I’d suggest restating
your problem on NTDEV to give a larger picture of what problem you’re trying
to solve.

-scott
OSR
@OSRDrivers

“Ulka Vaze” wrote in message news:xxxxx@windbg…
Hi All,

I am not sure if this is right forum for this question, if not please point
me to right list.

I Have allocated MDL using IOAllocateMDL.
After that I lock MDL with MmProbeAndLockPages and also call
MmGetSystemAddressForMDLSafe.

I am trying to find out PFN numbers for physical pages mapped by MDL.
Earlier I was accessing PFN array in MDL. But since MSDN says that it is
not recommended,
I was trying to do something as below-
I call va = MmGetMDLVIrtualAddress (MDL);

Then I find physical address
pa = MmGetPhysicalAddress(va)

And from this Physical address I find PPN by shifting 12 bits.
But ppn i get through this logic does not match with PFN array in MDL.

So is this procedure correct ? What is wrong here?

Thanks,
-Ulka

Thanks. I will post my query on NTDEV

On Mon, Nov 23, 2015 at 7:51 PM, Scott Noone wrote:

> Unless you want to know how to get the PFN from the debugger, this isn’t
> the right forum (try NTDEV).
>
> BUT, before asking this on NTDEV…It sounds to me like you’re lost off a
> cliff someplace. MmGetMdlPfnArray is the right way to get the PFN
> information from an MDL, but why do you need this? MSDN probably says that
> it’s not recommended because the resulting PFNs are not suitable for DMA,
> which is usually why people want physical addresses. I’d suggest restating
> your problem on NTDEV to give a larger picture of what problem you’re
> trying to solve.
>
> -scott
> OSR
> @OSRDrivers
>
> “Ulka Vaze” wrote in message news:xxxxx@windbg…
> Hi All,
>
> I am not sure if this is right forum for this question, if not please
> point me to right list.
>
> I Have allocated MDL using IOAllocateMDL.
> After that I lock MDL with MmProbeAndLockPages and also call
> MmGetSystemAddressForMDLSafe.
>
> I am trying to find out PFN numbers for physical pages mapped by MDL.
> Earlier I was accessing PFN array in MDL. But since MSDN says that it is
> not recommended,
> I was trying to do something as below-
> I call va = MmGetMDLVIrtualAddress (MDL);
>
> Then I find physical address
> pa = MmGetPhysicalAddress(va)
>
> And from this Physical address I find PPN by shifting 12 bits.
> But ppn i get through this logic does not match with PFN array in MDL.
>
> So is this procedure correct ? What is wrong here?
>
> Thanks,
> -Ulka
>
> —
> WINDBG is sponsored by OSR
>
> OSR is hiring!! Info at http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>