physical address is not the same

Hi All,

I run a app program to test my driver based on WDK6000.
I have a question.
I run the app two times[did not restart the computer],found that the physical addr"pAddr"[show below] is not the same.
One time pAddr is “0x969b000”,another time is pAddr is “0x969c000”.
Well,I’m not well understand it.
I think pAddr[physical address] must be the same if I don’t restart the computer or reinstall the driver.
Can this be right or there may be some abnormal situation?

Any help is appreciated.Thanks.

Best Regards
Zhou ChengJun

Related to the code below[Simplify]:

EvtDevicePrepareHardware
{

m_Buffer = MmAllocateContiguousMemorySpecifyCache(STREAM_BUF_LEN,
LowestAcceptableAddress,
HighestPhysicalAddress,
BoundaryAddressMultiple,
MmCached);
m_Mdl = IoAllocateMdl(m_Buffer, STREAM_BUF_LEN, FALSE, FALSE, NULL);

MmBuildMdlForNonPagedPool(m_Mdl);


}

EvtIoDeviceControl
{


m_VirtualAddress = MmMapLockedPagesSpecifyCache( m_Mdl,
UserMode,
MmCached,
NULL,
FALSE,
NormalPagePriority );
pAddr=MmGetPhysicalAddress(m_VirtualAddress);

}

Why would you expect the same physical address each time?

On Wed, Feb 27, 2008 at 9:09 AM, wrote:

>
> Hi All,
>
> I run a app program to test my driver based on WDK6000.
> I have a question.
> I run the app two times[did not restart the computer],found that the
> physical addr"pAddr"[show below] is not the same.
> One time pAddr is “0x969b000”,another time is pAddr is “0x969c000”.
> Well,I’m not well understand it.
> I think pAddr[physical address] must be the same if I don’t restart the
> computer or reinstall the driver.
> Can this be right or there may be some abnormal situation?
>
> Any help is appreciated.Thanks.
>
> Best Regards
> Zhou ChengJun
>
> Related to the code below[Simplify]:
>
> EvtDevicePrepareHardware
> {
> …
> m_Buffer = MmAllocateContiguousMemorySpecifyCache(STREAM_BUF_LEN,
>
> LowestAcceptableAddress,
> HighestPhysicalAddress,
>
> BoundaryAddressMultiple,
> MmCached);
> m_Mdl = IoAllocateMdl(m_Buffer, STREAM_BUF_LEN, FALSE, FALSE, NULL);
>
> MmBuildMdlForNonPagedPool(m_Mdl);
>
> …
> }
>
>
> EvtIoDeviceControl
> {
>
> …
> m_VirtualAddress = MmMapLockedPagesSpecifyCache( m_Mdl,
> UserMode,
> MmCached,
> NULL,
> FALSE,
> NormalPagePriority );
> pAddr=MmGetPhysicalAddress(m_VirtualAddress);
> …
> }
>
>
> —
> NTDEV is sponsored by OSR
>
> 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
>


Mark Roddy

> I think pAddr[physical address] must be the same if I don’t restart the
computer

reinstall the driver.

No for sure, they go from the dynamic MM’s allocator.


Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

Thank you two for your answer.

Well,as a device starts,after calling MmBuildMdlForNonPagedPool,MDL has been built and updated.
When run app,Ioctl happens,"m_VirtualAddress " may be different,“pAddr” must be the same if device doesn’t restart.[Just my opinion]

“dynamic” means MDL updated again when Ioctl happened?

Ok I think I understand your question now. If you haven’t run through
EvtDevicePrepareHardware a second time, then the values from
MmAllocateContiguousMemorySpecifyCache have not changed and indeed the
physical address of the allocated buffer should not change and should be the
same as a physical address obtained from a call to MmGetPhysicalAddress on
the original m_Buffer obtained from MmAllocateContiguousMemorySpecifyCache

On Fri, Feb 29, 2008 at 1:35 AM, wrote:

> Thank you two for your answer.
>
> Well,as a device starts,after calling MmBuildMdlForNonPagedPool,MDL has
> been built and updated.
> When run app,Ioctl happens,"m_VirtualAddress " may be different,“pAddr”
> must be the same if device doesn’t restart.[Just my opinion]
>
> “dynamic” means MDL updated again when Ioctl happened?
>
> —
> NTDEV is sponsored by OSR
>
> 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
>


Mark Roddy