I checked win7 sources and I think my statement below is correct. Have you looked at the actual PTEs to see what cache attribute they use?
Technically, the behavior I described is not part of any contract and drivers should not rely on it, but I still want to make sure the current code does what it’s supposed to do.
(Also note that even in win7 it’s still possible to create a conflicting mapping through Device\PhysicalMemory. For example, the original mapping could be freed, and the physical pages could then be mapped by somebody else using a different attribute. This is why mapping memory that you don’t own is unsafe).
Thanks,
Pavel
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of George M. Garner Jr.
Sent: Friday, November 26, 2010 3:32 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Question about \Device\PhysicalMemory
This is an informative thread, particularly when read together with the following two threads linked therein:
http://www.osronline.com/showThread.cfm?link=173359; and https://www.osronline.com/showthread.cfm?link=164773.
I do wish to take issue with one thing. In the second thread, Pavel Lebedinsky states that:
“This is by design. If a physical page is already mapped with a particular cache attribute, win7 will detect this and use the same attribute when mapping a view of \Device\PhysicalMemory.”
This statement is incorrect. In fact win7 ignores potential cache conflicts when mapping physical memory within the PFN database via the \Device\PhysicalMemory section object. The mapping usually (if not always) succeeds with the requested cache attributes, and with processor TLB corruption as the likely result.
Pavel’s statement is correct as regards the behavior of MmMapIoSpace which implements a cache override for pages within the PFN database. MmMapIoSpace has other problems, however, and will bugcheck in the driver verifier if you try to read the entire physical memory map using it.
Regards,
George.
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