Can anyone explain in detail about MmProbeAndLockProcessPages. I could not
find it in WDK documentation.
Thanks,
VC
Can anyone explain in detail about MmProbeAndLockProcessPages. I could not
find it in WDK documentation.
Thanks,
VC
Then it is not documented. Why do you need this?
–
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
“OSR Online” wrote in message news:xxxxx@ntfsd…
> Can anyone explain in detail about MmProbeAndLockProcessPages. I could not
> find it in WDK documentation.
>
> Thanks,
> VC
>
>
>
I was going though inverted call method sample in OSR site.
“Maxim S. Shatskih” wrote in message
news:xxxxx@ntfsd…
> Then it is not documented. Why do you need this?
>
> –
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
> “OSR Online” wrote in message
> news:xxxxx@ntfsd…
>> Can anyone explain in detail about MmProbeAndLockProcessPages. I could
>> not
>> find it in WDK documentation.
>>
>> Thanks,
>> VC
>>
>>
>>
>
Basically MmProbeAndLockProcessPages, locks the pages in memory for the current MDL.
Now the memory is pinned in memory and does not cause page faults as far as I know, after calling this function even though you allocated from the PagedPool. Please correct me if I am wrong, anyone.
No. After MmProbeAndLockProcessPages, page faults are still a reality.
MmProbeAndLockProcessPages does not lock PTEs, it locks only physical
pages. So, pages from the MDL will not disappear, but the original virtual
address range is still pageable.
–
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
wrote in message news:xxxxx@ntfsd…
> Basically MmProbeAndLockProcessPages, locks the pages in memory for the
current MDL.
> Now the memory is pinned in memory and does not cause page faults as far as I
know, after calling this function even though you allocated from the PagedPool.
Please correct me if I am wrong, anyone.
>
Thank you Maxim. This is what I wanted to be sure about.
But if the original address range is pageable, why page them if the physical is locked
Thanks again.
or it is because the MmProbeAndLockPages uses PTE to translate all the pages in that address range to physical addresses, locks physical, but some of the virtual pages have contents in page file ?
It only locks the physical pages, not PTEs
–
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
wrote in message news:xxxxx@ntfsd…
> or it is because the MmProbeAndLockPages uses PTE to translate all the pages
in that address range to physical addresses, locks physical, but some of the
virtual pages have contents in page file ?
>
Maxim, I have another question I would like to ask you. Supposably I use IoAllocateMdl for a NEITHER I/O buffer, this being user mode pageable memory. Then I use MmProbeAndLock pages, to lock physical memory pages. How will I be able to use this USER MODE memory in IRQL = 2. I gues MmMapLockedPagesSpecifyCache or MmGetSystemAddressForMdlSafe cand cause page faults, if PTE are paged. I can only imagine allocating a Nonpaged pool buffer and copy the contents of the UserMode buffer. Is that correct ?
> Maxim, I have another question I would like to ask you. Supposably I use
IoAllocateMdl for a NEITHER I/O buffer, this being user mode pageable memory.
Then I use MmProbeAndLock pages, to lock physical memory pages. How will I
be able to use this USER MODE memory in IRQL = 2.
You cannot use the user mode pointer at DISPATCH_LEVEL, even after
MmProbeAndLockPages.
To access this memory by pointer, use MmGetSystemAddressForMdlSafe and use the
pointer returned by it.
–
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
Ofcourse, but at DPC level even after MmProbeAndLockPages, can MmGetSystemAddressForMdlSafe cause a page fault, PTE’s not being locked , or accesing the pointer returned by MmGetSystemAddressForMdlSafe can cause page faults ? If yes, then how can I use it at DPC ?
When you probe and lock pages, also get the address.
–
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply
wrote in message news:xxxxx@ntfsd…
> Ofcourse, but at DPC level even after MmProbeAndLockPages, can
> MmGetSystemAddressForMdlSafe cause a page fault, PTE’s not being locked ,
> or accesing the pointer returned by MmGetSystemAddressForMdlSafe can cause
> page faults ? If yes, then how can I use it at DPC ?
>
*IRQL:* <=DISPATCH_LEVEL
It either returns the sys VA or NULL. It will not pagefault. The docs
indicate this with the allowed IRQL level.
On Sat, May 17, 2008 at 10:20 AM, wrote:
> Ofcourse, but at DPC level even after MmProbeAndLockPages, can
> MmGetSystemAddressForMdlSafe cause a page fault, PTE’s not being locked , or
> accesing the pointer returned by MmGetSystemAddressForMdlSafe can cause page
> faults ? If yes, then how can I use it at DPC ?
>
> —
> NTFSD is sponsored by OSR
>
> For our schedule debugging and file system seminars
> (including our new fs mini-filter seminar) visit:
> http://www.osr.com/seminars
>
> You are currently subscribed to ntfsd as: xxxxx@hollistech.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
–
Mark Roddy
Thank you Mark. I am not sure I fully understand how this works. If it returns NULL, what is another way to access that memory. As far as I read in the documentation, the function maps the physical pages described in NonPaged system memory, so it will always return a valid system Nonpaged VA if the system has it’s resources.
Thank you everybody for answering.
> Ofcourse, but at DPC level even after MmProbeAndLockPages, can
MmGetSystemAddressForMdlSafe cause a page fault, PTE’s not being locked ,
It cannot.
After MmProbeAndLockPages, the physical page numbers in MDL tail are locked.
MmGetSystemAddressForMdlSafe is MmMapLockedPages(KernelMode), which is:
In XP+, there are APIs to do each step separately, a combination of them will
be the same good old MmMapLockedPages(KernelMode).
MmMapLockedPages(UserMode) is absolutely another path.
or accesing the pointer returned by MmGetSystemAddressForMdlSafe can cause
page faults ?
It cannot. System PTEs are not subject to working set trimming and are always
valid after setting up and before deallocation.
–
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
Now I fully understand. Thank you very much Maxim. This was very useful piece of information for me.