[PATCH] ntoskrnl: Implement MmGetPhysicalAddress
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(a)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
Hi, While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check? Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=95206 Your paranoid android. === debiant2 (32 bit Chinese:China report) === ntoskrnl.exe: ntoskrnl.c:2719: Test failed: id 1 poll: GetOverlappedResult failed, last error 996
Alex Henrie <alexhenrie24(a)gmail.com> wrote:
+PHYSICAL_ADDRESS MmGetPhysicalAddress(void *virtual_address) +{ + PHYSICAL_ADDRESS ret; + TRACE("(%p)\n", virtual_address); + ret.QuadPart = (ULONG_PTR)virtual_address; + return ret; +} ... +@ stdcall MmGetPhysicalAddress(ptr)
Shouldn't WINAPI be added to match the spec entry? -- Dmitry.
On 8/6/21 21:28, Alex Henrie wrote:
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.
...
+/*********************************************************************** + * MmGetPhysicalAddress (NTOSKRNL.EXE.@) + */ +PHYSICAL_ADDRESS MmGetPhysicalAddress(void *virtual_address) +{ + PHYSICAL_ADDRESS ret; + TRACE("(%p)\n", virtual_address);
I suppose this deserves a FIXME. Besides WINAPI which Dmitry noted.
On Fri, Aug 6, 2021 at 1:20 PM Dmitry Timoshkov <dmitry(a)baikal.ru> wrote:
Shouldn't WINAPI be added to match the spec entry?
Yes, thanks for catching that. On Fri, Aug 6, 2021 at 1:24 PM Paul Gofman <pgofman(a)codeweavers.com> wrote:
I suppose this deserves a FIXME.
I'm not sure FIXME is appropriate because it can't be fixed. But since you want it, I'll add it anyway. -Alex
participants (4)
-
Alex Henrie -
Dmitry Timoshkov -
Marvin -
Paul Gofman