Commit Graph
2 Commits
Author SHA1 Message Date
Morten HolmandClaude Sonnet 5.5 11ca3cb744 fix(libkernel): release only the main thread stack when moving it off the arena
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-28 12:43:40 +01:00
Morten HolmandClaude Sonnet 5.5 3b1697cf1c fix(libkernel): move the macOS main stack out of the guest arena
Under Rosetta the main thread stack lies at about 12 GiB, inside the guest
arena, where a title can map fixed addresses; a fixed mapping over it
aborts with a host region overlap.

- Aps5StartGuest moves the main thread onto a 16 MiB stack at
  0x600000000000 when the old stack overlaps a host region of the arena.
  It copies argv, environ, the program name and the initial block off the
  old stack, then frees the old stack and releases its range to the arena.
- The guest thread keeps the stack size of the original main thread.
- The arena gets GuestArenaOverlapsHostRegion and
  GuestArenaReleaseHostRegion for POSIX hosts.
- guest_main_stack_move starts the guest, then requires the main thread
  outside the arena, a fixed mapping where the old stack was, and argv and
  the environment intact.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-27 22:55:41 +01:00