fix(libkernel): build sceKernelVirtualQuery on linux #44

Merged
oneandonlydean merged 1 commit from upstream-pr/44 into main 2026-09-28 05:28:45 +00:00
oneandonlydean commented 2026-09-28 00:33:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-09-28T00:33:10Z.


What

core/libs/prx/libkernel/DirectMemory/Export.cpp includes <windows.h> unconditionally and calls VirtualQuery in the sceKernelVirtualQuery fallback for memory the allocation registry doesn't know. Since a503d0b (#5) libkernel no longer compiles on Linux:

core/libs/prx/libkernel/DirectMemory/Export.cpp:10:10: fatal error: windows.h: No such file or directory

How

The Windows path is unchanged and now behind #ifdef _WIN32. On Linux, the fallback reads /proc/self/maps, takes the mapping that contains the address as the region, and derives writable/executable from its permissions. An unreadable (---p) or unmapped address returns SCE_KERNEL_ERROR_EACCES, the same result as the non-MEM_COMMIT case on Windows.

Testing

GCC 16.2.1 on Linux: the libs target builds again. ctest -E agc_driver_flip gives 34/36; the two failures are agc_driver and agc_driver_pm4, which don't touch this file. (agc_driver_flip hangs here without a display, so it was excluded.)

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4657873629 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/44). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-09-28T00:33:10Z. --- ### What `core/libs/prx/libkernel/DirectMemory/Export.cpp` includes `<windows.h>` unconditionally and calls `VirtualQuery` in the `sceKernelVirtualQuery` fallback for memory the allocation registry doesn't know. Since a503d0b (#5) `libkernel` no longer compiles on Linux: ``` core/libs/prx/libkernel/DirectMemory/Export.cpp:10:10: fatal error: windows.h: No such file or directory ``` ### How The Windows path is unchanged and now behind `#ifdef _WIN32`. On Linux, the fallback reads `/proc/self/maps`, takes the mapping that contains the address as the region, and derives writable/executable from its permissions. An unreadable (`---p`) or unmapped address returns `SCE_KERNEL_ERROR_EACCES`, the same result as the non-`MEM_COMMIT` case on Windows. ### Testing GCC 16.2.1 on Linux: the `libs` target builds again. `ctest -E agc_driver_flip` gives 34/36; the two failures are `agc_driver` and `agc_driver_pm4`, which don't touch this file. (`agc_driver_flip` hangs here without a display, so it was excluded.)
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!44
No description provided.