feat(libkernel): support mapping address hints and no-overwrite fixed mappings on Windows #286

Merged
SP4C3B4R-8 merged 2 commits from upstream-pr/286 into main 2026-10-02 13:41:44 +00:00
SP4C3B4R-8 commented 2026-10-01 21:57:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SP4C3B4R-8 on 2026-10-01T21:57:14Z.


What

On Windows:

  • Non-fixed mappings with an address hint are placed at or above the hint inside the guest arena (GuestArenaAllocateAtOrAbove_nid_postfix), matching MapAtOrAbove on Linux, instead of throwing.
  • Fixed mappings with the no-overwrite flag (0x90) are accepted: inside the arena an occupied range is already rejected by MarkUsed, outside it by VirtualAlloc.

The hinted and no-overwrite cases of the GuestMemory test now also run on Windows, with a successful no-overwrite mapping at a free address added.

Tested

Windows 11, MinGW-w64 GCC 15.2.0 (winlibs, ucrt posix seh). Full build and ctest: 95/95 passed on this branch alone. Also checked with a retail title.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes (Claude). I reviewed and take responsibility for every line.

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4710110429 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/286). Originally posted by [SP4C3B4R-8](https://github.com/SP4C3B4R-8) on 2026-10-01T21:57:14Z. --- ### What On Windows: - Non-fixed mappings with an address hint are placed at or above the hint inside the guest arena (`GuestArenaAllocateAtOrAbove_nid_postfix`), matching `MapAtOrAbove` on Linux, instead of throwing. - Fixed mappings with the no-overwrite flag (0x90) are accepted: inside the arena an occupied range is already rejected by `MarkUsed`, outside it by `VirtualAlloc`. The hinted and no-overwrite cases of the `GuestMemory` test now also run on Windows, with a successful no-overwrite mapping at a free address added. ### Tested Windows 11, MinGW-w64 GCC 15.2.0 (winlibs, ucrt posix seh). Full build and `ctest`: 95/95 passed on this branch alone. Also checked with a retail title. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in TechnicalDebt - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes (Claude). I reviewed and take responsibility for every line. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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!286
No description provided.