[PATCH] ntoskrnl: Implement MmGetPhysicalAddress

Alex Henrie alexhenrie24 at gmail.com
Fri Aug 6 13:28:47 CDT 2021


Wine doesn't have access to the physical address space, but it works to
pretend that it's the same as the virtual address space.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47047
Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
---
 dlls/ntoskrnl.exe/ntoskrnl.c        | 11 +++++++++++
 dlls/ntoskrnl.exe/ntoskrnl.exe.spec |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c
index 0580231d8e3..76bf339e9bb 100644
--- a/dlls/ntoskrnl.exe/ntoskrnl.c
+++ b/dlls/ntoskrnl.exe/ntoskrnl.c
@@ -2723,6 +2723,17 @@ BOOLEAN WINAPI MmIsAddressValid(PVOID VirtualAddress)
     return !IsBadReadPtr(VirtualAddress, 1);
 }
 
+/***********************************************************************
+ *           MmGetPhysicalAddress   (NTOSKRNL.EXE.@)
+ */
+PHYSICAL_ADDRESS MmGetPhysicalAddress(void *virtual_address)
+{
+    PHYSICAL_ADDRESS ret;
+    TRACE("(%p)\n", virtual_address);
+    ret.QuadPart = (ULONG_PTR)virtual_address;
+    return ret;
+}
+
 /***********************************************************************
  *           MmMapIoSpace   (NTOSKRNL.EXE.@)
  */
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
index ea6d9e9fc95..f51833b91a0 100644
--- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
+++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
@@ -702,7 +702,7 @@
 @ stub MmFreeMappingAddress
 @ stdcall MmFreeNonCachedMemory(ptr long)
 @ stub MmFreePagesFromMdl
-@ stub MmGetPhysicalAddress
+@ stdcall MmGetPhysicalAddress(ptr)
 @ stub MmGetPhysicalMemoryRanges
 @ stdcall MmGetSystemRoutineAddress(ptr)
 @ stub MmGetVirtualForPhysical
-- 
2.32.0




More information about the wine-devel mailing list