https://git.reactos.org/?p=reactos.git;a=commitdiff;h=fd8893e58fb5b21ebe196…
commit fd8893e58fb5b21ebe19617a9fd206c6e107aa30
Author: Pierre Schweitzer <pierre(a)reactos.org>
AuthorDate: Mon Oct 1 13:47:06 2018 +0200
Commit: Pierre Schweitzer <pierre(a)reactos.org>
CommitDate: Mon Oct 1 20:59:37 2018 +0200
[NTOSKRNL] Respect PFN cache attribute when required
This fixes noisy DPRINT1 being printed while reading
or writing files with NFS.
---
ntoskrnl/mm/ARM3/mdlsup.c | 44 +++++++++++++++++++++++++++++++++++++-------
1 file changed, 37 insertions(+), 7 deletions(-)
diff --git a/ntoskrnl/mm/ARM3/mdlsup.c b/ntoskrnl/mm/ARM3/mdlsup.c
index 4675fe2c58..4975b3edc8 100644
--- a/ntoskrnl/mm/ARM3/mdlsup.c
+++ b/ntoskrnl/mm/ARM3/mdlsup.c
@@ -21,6 +21,8 @@ BOOLEAN MmTrackPtes;
BOOLEAN MmTrackLockedPages;
SIZE_T MmSystemLockPagesCount;
+ULONG MiCacheOverride[MiNotMapped + 1];
+
/* INTERNAL FUNCTIONS *********************************************************/
static
PVOID
@@ -36,6 +38,7 @@ MiMapLockedPagesInUserSpace(
PETHREAD Thread = PsGetCurrentThread();
TABLE_SEARCH_RESULT Result;
MI_PFN_CACHE_ATTRIBUTE CacheAttribute;
+ MI_PFN_CACHE_ATTRIBUTE EffectiveCacheAttribute;
BOOLEAN IsIoMapping;
KIRQL OldIrql;
ULONG_PTR StartingVa;
@@ -180,23 +183,50 @@ MiMapLockedPagesInUserSpace(
MM_READWRITE,
*MdlPages);
- /* FIXME: We need to respect the PFN's caching information in some cases */
+ EffectiveCacheAttribute = CacheAttribute;
+
+ /* We need to respect the PFN's caching information in some cases */
Pfn2 = MiGetPfnEntry(*MdlPages);
if (Pfn2 != NULL)
{
ASSERT(Pfn2->u3.e2.ReferenceCount != 0);
- if (Pfn2->u3.e1.CacheAttribute != CacheAttribute)
+ switch (Pfn2->u3.e1.CacheAttribute)
{
- DPRINT1("FIXME: Using caller's cache attribute instead of PFN
override\n");
- }
+ case MiNonCached:
+ if (CacheAttribute != MiNonCached)
+ {
+ MiCacheOverride[1]++;
+ EffectiveCacheAttribute = MiNonCached;
+ }
+ break;
- /* We don't support AWE magic */
- ASSERT(Pfn2->u3.e1.CacheAttribute != MiNotMapped);
+ case MiCached:
+ if (CacheAttribute != MiCached)
+ {
+ MiCacheOverride[0]++;
+ EffectiveCacheAttribute = MiCached;
+ }
+ break;
+
+ case MiWriteCombined:
+ if (CacheAttribute != MiWriteCombined)
+ {
+ MiCacheOverride[2]++;
+ EffectiveCacheAttribute = MiWriteCombined;
+ }
+ break;
+
+ default:
+ /* We don't support AWE magic (MiNotMapped) */
+ DPRINT1("FIXME: MiNotMapped is not supported\n");
+ ASSERT(FALSE);
+ break;
+ }
}
/* Configure caching */
- switch (CacheAttribute)
+ switch (EffectiveCacheAttribute)
{
case MiNonCached:
MI_PAGE_DISABLE_CACHE(&TempPte);