diff --git a/binaries/system/aken.sys b/binaries/system/aken.sys index f5f5259a70..a24a47a6d6 100644 Binary files a/binaries/system/aken.sys and b/binaries/system/aken.sys differ diff --git a/binaries/system/aken64.sys b/binaries/system/aken64.sys index e943548418..406fff88cf 100644 Binary files a/binaries/system/aken64.sys and b/binaries/system/aken64.sys differ diff --git a/binaries/system/aken64d.sys b/binaries/system/aken64d.sys index 54324b6458..053328f4be 100644 Binary files a/binaries/system/aken64d.sys and b/binaries/system/aken64d.sys differ diff --git a/binaries/system/akend.sys b/binaries/system/akend.sys index 9a48032c66..35aa314d67 100644 Binary files a/binaries/system/akend.sys and b/binaries/system/akend.sys differ diff --git a/source/lib/sysdep/win/aken/aken.cpp b/source/lib/sysdep/win/aken/aken.cpp index 9b455fe500..4aafe7b441 100644 --- a/source/lib/sysdep/win/aken/aken.cpp +++ b/source/lib/sysdep/win/aken/aken.cpp @@ -25,7 +25,7 @@ there are three approaches to mapping physical memory: http://support.microsoft.com/kb/925793/en-us - ZwMapViewOfSection of PhysicalMemory (http://tinyurl.com/yozmgy). - a bit bulky, but the WinXP implementation prevents mapping pages with + the code is a bit bulky, but the WinXP API prevents mapping pages with conflicting attributes (see below). - MmMapLockedPagesSpecifyCache or MmGetSystemAddressForMdlSafe @@ -43,6 +43,9 @@ means of accessing the page frame database (to check if mapped anywhere and determine the previously set attributes) has not borne fruit, so we must use ZwMapViewOfSection. +note that we do try to guess if the page will have been mapped as cacheable +and even try the opposite if we turn out to be incorrect. + */ @@ -110,8 +113,14 @@ static NTSTATUS AkenMapPhysicalMemory(const DWORD64 physicalAddress64, const DWO ntStatus = ZwMapViewOfSection(hMemory, hProcess, &virtualBaseAddress, zeroBits, mappedSize, &physicalBaseAddress, &mappedSize, inheritDisposition, allocationType, protect); if(!NT_SUCCESS(ntStatus)) { - KdPrint(("AkenMapPhysicalMemory: ZwMapViewOfSection failed\n")); - goto close_handle; + // try again with the opposite cacheability attribute + protect ^= PAGE_NOCACHE; + ntStatus = ZwMapViewOfSection(hMemory, hProcess, &virtualBaseAddress, zeroBits, mappedSize, &physicalBaseAddress, &mappedSize, inheritDisposition, allocationType, protect); + if(!NT_SUCCESS(ntStatus)) + { + KdPrint(("AkenMapPhysicalMemory: ZwMapViewOfSection failed\n")); + goto close_handle; + } } // the mapping rounded our physical base address down to the nearest