fix(libkernel): end unwinding at the guest main stack's entry frame #15691

Merged
GiannisG1 merged 2 commits from upstream-pr/15691 into main 2026-11-14 11:44:32 +00:00
GiannisG1 commented 2026-11-04 06:35:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by GiannisG1 on 2026-11-04T06:35:43Z.


What

Since #7532, EnterGuestMainStack_nid_no_patch moves the stack pointer to the guest main stack and calls the guest entry from inline asm (Thread.cpp L263-L274). The compiler's unwind information for EnterGuestMainStack still describes its frame on the host stack. An unwinder that returns into it from the guest entry computes a CFA past the top of the guest main stack and reads there. libc's _Unwind_Backtrace faults in LibcUnwind::Step at 0x7eeffc0e8, 0xe8 above the console's main stack top. On main 04a9eb4fa2, vkQuake (PPSA99010) and RetroArch (PPSA99169) crash this way at startup. The same walk runs when a C++ exception is thrown on the guest main thread (_Unwind_RaiseException), so an unimplemented call reached there ends in that fault instead of naming the call. Before #7532, vkQuake exited with 0 and RetroArch stopped at sceSystemServiceLoadExec on this PC.

The stack switch is now a routine of its own, Aps5CallOnGuestMainStack_nid_no_patch, whose unwind information marks the return address undefined (.cfi_undefined %rip), as glibc's _start (start.S L57-L59: "Clearing frame pointer is insufficient, use CFI.") and clone (clone.S L92-L94) mark their outermost frames. libc's unwinder reads DW_CFA_undefined as a return address of 0 (Unwind.hpp L215, Unwind.cpp L654) and stops there (L676), so a walk from the guest main stack ends at the entry with _URC_END_OF_STACK. gdb's backtrace ends there too. The routine runs the instructions the inline asm ran.

guest_main_stack (both modes) now calls _Unwind_Backtrace from the entry on the guest main stack. It checks that the walk ends with _URC_END_OF_STACK, passes at least the entry and the routine, that no frame's CFA is above the stack top, and that dladdr names Aps5CallOnGuestMainStack_nid_no_patch for the outermost frame. The inline asm can't meet that last check in a frame-pointer build either: there its walk stops cleanly at EnterGuestMainStack_nid_no_patch.

Landing order: #15803 (with #15804 and #15807 stacked on it) wraps EnterGuestMainStack_nid_no_patch in ANYPS5_GUEST_LIFTED on the same lines. How the two compose is on #15803 (https://github.com/boykopovar/AnyPS5/pull/15803#issuecomment-6700921364); whichever lands second rebases.

Tested

Linux Mint 22.3, kernel 7.0.0-38, glibc 2.39, GCC 13.3.0, Release, BUILD_TESTING=ON, head on main 04a9eb4fa2 (merges cleanly with current main):

  • guest_main_stack and guest_main_stack_adopted: 3/3 each. On 04a9eb4fa2 both fail 3/3 with a segfault in LibcUnwind::Step, at the instruction where the titles crash.
  • With -fno-omit-frame-pointer (as the ASan and fuzzer builds use), on 04a9eb4fa2's Thread.cpp: this PR's first version of the test passed 6/6, because the walk ends at EnterGuestMainStack_nid_no_patch there, as gabichuuuuu pointed out. With the outermost-frame check it fails 6/6, and with this PR it passes 6/6. Default flags: 6/6 with this PR.
  • readelf --debug-dump=frames: the routine's CIE ends with DW_CFA_undefined: r16 (rip).
  • vkQuake (PPSA99010) and RetroArch (PPSA99169), catalog builds relinked by 04a9eb4fa2's relinker, GTX 1050 Ti under Xvfb: with 04a9eb4fa2's libkernel.prx both segfault in LibcUnwind::Step after 1 s and 2 s. With this libkernel.prx, vkQuake exits with 0 and RetroArch stops at sceSystemServiceLoadExec: /app0/picker/picker.bin without its converted executable, as before #7532.
  • PPSA90212 (Breath of the Wild, the Savage Wind PS5 port, catalog ps5-v0.1.0) on main 85529b7483 with this commit cherry-picked, GTX 1050 Ti under Xvfb: on 85529b7483 it segfaults in LibcUnwind::Step under _Unwind_RaiseException and __cxa_throw, thrown by NotImplemented for sceVideoOutGetCurrentOutputMode_ on the main thread. With this libkernel.prx it aborts with sceVideoOutGetCurrentOutputMode_ not implemented.
  • Independently, root-over on a Ryzen 5 5625U with RADV (Mesa 26.0.8): The Last of Us Part I (PPSA07642) faults in LibcUnwind::Step at 0x7eeffc0e8 on main 41614f0558 when sceHttp2SendRequestAsync throws, one step past EnterGuestMainStack_nid_no_patch, and ends with sceHttp2SendRequestAsync not implemented with this PR (comment).
  • tools/suite.py split run against a --full run of 04a9eb4fa2: all 3828 tests on the GTX 1050 Ti, and the 932 that depend on the GPU on the HD Graphics 630 and llvmpipe. No new failure and no new skip; the HD Graphics 630 fails agc_driver_f64_rounding_denormal_modes and agc_driver_image_sample_lod_clamp on 04a9eb4fa2 too (Mesa).
  • check_conventions.py, check_test_registration.py, check_main_sync.py and check_compile.py are clean. pr_overlap.py --branch: the 28 open PRs that share files merge cleanly with this one, and the 9 it could not compare (they conflict with main) change other functions of Thread.cpp.

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 under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: PPSA34502 (Call of Duty: Black Ops II): its switch to the Zombies executable, which crashes in LibcUnwind::Step past the guest main stack top, per milescoviello's runs on an RTX 4070 Ti (https://github.com/boykopovar/AnyPS5/pull/15691#issuecomment-6697045295); PPSA99010 (vkQuake) and PPSA99169 (RetroArch), catalog homebrew, back to their state before #7532
  • GPUs tested: n/a
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5150047164 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15691). Originally posted by [GiannisG1](https://github.com/GiannisG1) on 2026-11-04T06:35:43Z. --- ### What Since #7532, `EnterGuestMainStack_nid_no_patch` moves the stack pointer to the guest main stack and calls the guest entry from inline asm ([`Thread.cpp` L263-L274](https://github.com/boykopovar/AnyPS5/blob/04a9eb4fa2/core/libs/prx/libkernel/Pthread/src/Thread.cpp#L263-L274)). The compiler's unwind information for `EnterGuestMainStack` still describes its frame on the host stack. An unwinder that returns into it from the guest entry computes a CFA past the top of the guest main stack and reads there. libc's `_Unwind_Backtrace` faults in `LibcUnwind::Step` at `0x7eeffc0e8`, `0xe8` above the console's main stack top. On `main` `04a9eb4fa2`, vkQuake (PPSA99010) and RetroArch (PPSA99169) crash this way at startup. The same walk runs when a C++ exception is thrown on the guest main thread (`_Unwind_RaiseException`), so an unimplemented call reached there ends in that fault instead of naming the call. Before #7532, vkQuake exited with 0 and RetroArch stopped at `sceSystemServiceLoadExec` on this PC. The stack switch is now a routine of its own, `Aps5CallOnGuestMainStack_nid_no_patch`, whose unwind information marks the return address undefined (`.cfi_undefined %rip`), as glibc's `_start` ([`start.S` L57-L59](https://github.com/bminor/glibc/blob/glibc-2.39/sysdeps/x86_64/start.S#L57-L59): "Clearing frame pointer is insufficient, use CFI.") and `clone` ([`clone.S` L92-L94](https://github.com/bminor/glibc/blob/glibc-2.39/sysdeps/unix/sysv/linux/x86_64/clone.S#L92-L94)) mark their outermost frames. libc's unwinder reads `DW_CFA_undefined` as a return address of 0 ([`Unwind.hpp` L215](https://github.com/boykopovar/AnyPS5/blob/04a9eb4fa2/core/libs/prx/libc/include/exceptions/Unwind.hpp#L215), [`Unwind.cpp` L654](https://github.com/boykopovar/AnyPS5/blob/04a9eb4fa2/core/libs/prx/libc/src/exception/Unwind.cpp#L654)) and stops there ([L676](https://github.com/boykopovar/AnyPS5/blob/04a9eb4fa2/core/libs/prx/libc/src/exception/Unwind.cpp#L676)), so a walk from the guest main stack ends at the entry with `_URC_END_OF_STACK`. gdb's backtrace ends there too. The routine runs the instructions the inline asm ran. `guest_main_stack` (both modes) now calls `_Unwind_Backtrace` from the entry on the guest main stack. It checks that the walk ends with `_URC_END_OF_STACK`, passes at least the entry and the routine, that no frame's CFA is above the stack top, and that `dladdr` names `Aps5CallOnGuestMainStack_nid_no_patch` for the outermost frame. The inline asm can't meet that last check in a frame-pointer build either: there its walk stops cleanly at `EnterGuestMainStack_nid_no_patch`. Landing order: #15803 (with #15804 and #15807 stacked on it) wraps `EnterGuestMainStack_nid_no_patch` in `ANYPS5_GUEST_LIFTED` on the same lines. How the two compose is on #15803 (https://github.com/boykopovar/AnyPS5/pull/15803#issuecomment-6700921364); whichever lands second rebases. ### Tested Linux Mint 22.3, kernel 7.0.0-38, glibc 2.39, GCC 13.3.0, Release, `BUILD_TESTING=ON`, head on `main` `04a9eb4fa2` (merges cleanly with current `main`): - `guest_main_stack` and `guest_main_stack_adopted`: 3/3 each. On `04a9eb4fa2` both fail 3/3 with a segfault in `LibcUnwind::Step`, at the instruction where the titles crash. - With `-fno-omit-frame-pointer` (as the ASan and fuzzer builds use), on `04a9eb4fa2`'s `Thread.cpp`: this PR's first version of the test passed 6/6, because the walk ends at `EnterGuestMainStack_nid_no_patch` there, as gabichuuuuu pointed out. With the outermost-frame check it fails 6/6, and with this PR it passes 6/6. Default flags: 6/6 with this PR. - `readelf --debug-dump=frames`: the routine's CIE ends with `DW_CFA_undefined: r16 (rip)`. - vkQuake (PPSA99010) and RetroArch (PPSA99169), catalog builds relinked by `04a9eb4fa2`'s relinker, GTX 1050 Ti under Xvfb: with `04a9eb4fa2`'s `libkernel.prx` both segfault in `LibcUnwind::Step` after 1 s and 2 s. With this `libkernel.prx`, vkQuake exits with 0 and RetroArch stops at `sceSystemServiceLoadExec: /app0/picker/picker.bin without its converted executable`, as before #7532. - PPSA90212 (Breath of the Wild, the Savage Wind PS5 port, catalog `ps5-v0.1.0`) on `main` `85529b7483` with this commit cherry-picked, GTX 1050 Ti under Xvfb: on `85529b7483` it segfaults in `LibcUnwind::Step` under `_Unwind_RaiseException` and `__cxa_throw`, thrown by `NotImplemented` for `sceVideoOutGetCurrentOutputMode_` on the main thread. With this `libkernel.prx` it aborts with `sceVideoOutGetCurrentOutputMode_ not implemented`. - Independently, root-over on a Ryzen 5 5625U with RADV (Mesa 26.0.8): The Last of Us Part I (PPSA07642) faults in `LibcUnwind::Step` at `0x7eeffc0e8` on `main` `41614f0558` when `sceHttp2SendRequestAsync` throws, one step past `EnterGuestMainStack_nid_no_patch`, and ends with `sceHttp2SendRequestAsync not implemented` with this PR ([comment](https://github.com/boykopovar/AnyPS5/pull/15691#issuecomment-6708070347)). - `tools/suite.py` split run against a `--full` run of `04a9eb4fa2`: all 3828 tests on the GTX 1050 Ti, and the 932 that depend on the GPU on the HD Graphics 630 and llvmpipe. No new failure and no new skip; the HD Graphics 630 fails `agc_driver_f64_rounding_denormal_modes` and `agc_driver_image_sample_lod_clamp` on `04a9eb4fa2` too (Mesa). - `check_conventions.py`, `check_test_registration.py`, `check_main_sync.py` and `check_compile.py` are clean. `pr_overlap.py --branch`: the 28 open PRs that share files merge cleanly with this one, and the 9 it could not compare (they conflict with `main`) change other functions of `Thread.cpp`. ### 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](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: PPSA34502 (Call of Duty: Black Ops II): its switch to the Zombies executable, which crashes in `LibcUnwind::Step` past the guest main stack top, per milescoviello's runs on an RTX 4070 Ti (https://github.com/boykopovar/AnyPS5/pull/15691#issuecomment-6697045295); PPSA99010 (vkQuake) and PPSA99169 (RetroArch), catalog homebrew, back to their state before #7532 - [x] GPUs tested: n/a - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
ahmadmuj commented 2026-11-06 07:29:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ahmadmuj on 2026-11-06T07:29:35Z.

Review: APPROVED


Checked head 3109f4f6daa4d806fd6ba0143bd51063776ef66f; PR base 5b1d381d5ad5d9f923326b18479c3bd889cdd588. Control: parent 04a9eb4fa2877eb6e40bf2c83adf972e40d89b24.

Linux builds and both guest_main_stack tests pass. I also ran a separate host libgcc probe through the actual EnterGuestMainStack call, in bounded initial/adopted child processes. dladdr confirms all three unwind APIs come from libgcc_s.so.1 (14.2).

Both head cases preserve the arguments and visit three nested guest frames, then Aps5CallOnGuestMainStack, then zero IP. They return _URC_END_OF_STACK; every CFA stays inside the guest stack. Both parent controls reach EnterGuestMainStack, then die with SIGSEGV.

The emitted FDE covers [0xbf8f0, 0xbf903), including return PC 0xbf901. Its CIE marks RIP undefined, consistent with GCC's outermost-frame rule and glibc startup code. Conventions pass.

No findings in this Linux boundary change. No title, console, or Windows/macOS runtime claim.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5797055553 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15691#pullrequestreview-5797055553). Originally posted by [ahmadmuj](https://github.com/ahmadmuj) on 2026-11-06T07:29:35Z. **Review:** APPROVED --- Checked head `3109f4f6daa4d806fd6ba0143bd51063776ef66f`; PR base `5b1d381d5ad5d9f923326b18479c3bd889cdd588`. Control: parent `04a9eb4fa2877eb6e40bf2c83adf972e40d89b24`. Linux builds and both `guest_main_stack` tests pass. I also ran a separate host libgcc probe through the actual `EnterGuestMainStack` call, in bounded initial/adopted child processes. `dladdr` confirms all three unwind APIs come from `libgcc_s.so.1` (14.2). Both head cases preserve the arguments and visit three nested guest frames, then `Aps5CallOnGuestMainStack`, then zero IP. They return `_URC_END_OF_STACK`; every CFA stays inside the guest stack. Both parent controls reach `EnterGuestMainStack`, then die with SIGSEGV. The emitted FDE covers `[0xbf8f0, 0xbf903)`, including return PC `0xbf901`. Its CIE marks RIP undefined, consistent with [GCC's outermost-frame rule](https://github.com/gcc-mirror/gcc/blob/releases/gcc-14.2.0/libgcc/unwind-dw2.c#L1269-L1279) and glibc startup code. Conventions pass. No findings in this Linux boundary change. No title, console, or Windows/macOS runtime claim.
gabichuuuuu commented 2026-11-07 07:27:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by gabichuuuuu on 2026-11-07T07:27:31Z.

Review: COMMENTED


A Windows check, and a question about what the new check covers.

  • The change sits inside #if defined(__linux__) in Thread.cpp (L138–348), and guest_main_stack_tests is registered only when CMAKE_SYSTEM_NAME is Linux, so neither runs on Windows or macOS. On Windows 11 x64 (WinLibs GCC 15.2.0 r7 UCRT, Release) I merged head 3109f4f6 onto main c1e920e7 and ran the libkernel context, exception and unwind tests (ctest -R '^(guest_main_stack|guest_user_context|guest_.*exception|guest_.*unwind|guest_.*context)'). That is 171 tests, none of them guest_main_stack, and they pass on main and with this PR.
  • A question, from reading the code and not run, since the test builds only on Linux. ahmadmuj's parent controls die with SIGSEGV, and this is only about builds that keep the frame pointer: can the new check fail on the parent there? ANYPS5_ENABLE_ASAN and the fuzzer build add -fno-omit-frame-pointer (top-level CMakeLists.txt L110, L119), and -O0 keeps it as well. The old inline asm left rbp at top-16 after its two pushq $0. With a frame pointer, EnterGuestMainStack's CFA would be rbp+16, which is top, and its return slot would hold the pushed 0. LibcUnwind::Step stops at a zero return address (Unwind.cpp L636), so the walk would end in _URC_END_OF_STACK with highestCfa == high, and all three Requires would pass without the fix. If that is right, a check the old code cannot meet would also cover those builds, for example requiring the last frame's IP to lie in Aps5CallOnGuestMainStack_nid_no_patch.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5810773157 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15691#pullrequestreview-5810773157). Originally posted by [gabichuuuuu](https://github.com/gabichuuuuu) on 2026-11-07T07:27:31Z. **Review:** COMMENTED --- A Windows check, and a question about what the new check covers. - The change sits inside `#if defined(__linux__)` in `Thread.cpp` (L138–348), and `guest_main_stack_tests` is registered only when `CMAKE_SYSTEM_NAME` is Linux, so neither runs on Windows or macOS. On Windows 11 x64 (WinLibs GCC 15.2.0 r7 UCRT, Release) I merged head `3109f4f6` onto `main` `c1e920e7` and ran the libkernel context, exception and unwind tests (`ctest -R '^(guest_main_stack|guest_user_context|guest_.*exception|guest_.*unwind|guest_.*context)'`). That is 171 tests, none of them `guest_main_stack`, and they pass on `main` and with this PR. - A question, from reading the code and not run, since the test builds only on Linux. ahmadmuj's parent controls die with SIGSEGV, and this is only about builds that keep the frame pointer: can the new check fail on the parent there? `ANYPS5_ENABLE_ASAN` and the fuzzer build add `-fno-omit-frame-pointer` (top-level `CMakeLists.txt` L110, L119), and `-O0` keeps it as well. The old inline asm left `rbp` at `top-16` after its two `pushq $0`. With a frame pointer, `EnterGuestMainStack`'s CFA would be `rbp+16`, which is `top`, and its return slot would hold the pushed 0. `LibcUnwind::Step` stops at a zero return address (`Unwind.cpp` L636), so the walk would end in `_URC_END_OF_STACK` with `highestCfa == high`, and all three `Require`s would pass without the fix. If that is right, a check the old code cannot meet would also cover those builds, for example requiring the last frame's IP to lie in `Aps5CallOnGuestMainStack_nid_no_patch`. AI-assisted: yes.
gabichuuuuu commented 2026-11-08 10:45:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by gabichuuuuu on 2026-11-08T10:45:47Z.

Review: COMMENTED


Follow-up on my earlier comment, read against head 24babea951. Not run here: the change and guest_main_stack are Linux-only, and I have no Linux build.

24babea951 answers my question. The walk now has to end in a frame that dladdr names Aps5CallOnGuestMainStack_nid_no_patch. The old inline asm can't meet that in a frame-pointer build, where the walk stops cleanly at EnterGuestMainStack_nid_no_patch, and your -fno-omit-frame-pointer runs show it: 6/6 red on 04a9eb4fa2's Thread.cpp, 6/6 green with this PR. The commit only touches GuestMainStack.cpp, so my earlier Windows result for 3109f4f6 (171 context, exception and unwind tests, same on main and the PR) still applies.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5817577372 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15691#pullrequestreview-5817577372). Originally posted by [gabichuuuuu](https://github.com/gabichuuuuu) on 2026-11-08T10:45:47Z. **Review:** COMMENTED --- Follow-up on my earlier comment, read against head `24babea951`. Not run here: the change and `guest_main_stack` are Linux-only, and I have no Linux build. `24babea951` answers my question. The walk now has to end in a frame that `dladdr` names `Aps5CallOnGuestMainStack_nid_no_patch`. The old inline asm can't meet that in a frame-pointer build, where the walk stops cleanly at `EnterGuestMainStack_nid_no_patch`, and your `-fno-omit-frame-pointer` runs show it: 6/6 red on `04a9eb4fa2`'s `Thread.cpp`, 6/6 green with this PR. The commit only touches `GuestMainStack.cpp`, so my earlier Windows result for `3109f4f6` (171 context, exception and unwind tests, same on `main` and the PR) still applies.
PrivacyOnion commented 2026-11-08 15:16:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-08T15:16:28Z.

Review: APPROVED


What I ran

  • Head commit: 24babea951399f0e08b92bf2d294212f76e661bf
  • Merge-base: 04a9eb4fa2877eb6e40bf2c83adf972e40d89b24
  • Rebase test: Cherry-picked cleanly onto current main (828e44310ec98912f041d0e51b8adc809848741b, 0 conflicts).
  • Environment: Windows 11 x86-64, MinGW-w64 GCC 15.2.0 (WinLibs UCRT POSIX), CMake 3.31, Ninja 1.13.

Tools and Checks

  • python tools/check_conventions.py --base upstream/main --head pr-15691: 0 errors.
  • git diff --check upstream/main...pr-15691: clean (no trailing whitespace or line ending issues).
  • python tools/pr_overlap.py --branch pr-15691: probed 1836 open pull requests against main; 24 share Thread.cpp. 10 merge cleanly, 14 stale branches conflict with main on unrelated lines.

Windows Compilation & ABI Verification

  • libkernel built cleanly (core/libs/prx/libkernel/CMakeFiles/libkernel.dir/Pthread/src/Thread.cpp.obj).
  • Aps5CallOnGuestMainStack_nid_no_patch:
    • APS5_VABI calling convention passes arguments in %rdi (top), %rsi (arguments), and %rdx (entry).
    • Stack alignment: mov %rdi, %rsp followed by two 8-byte pushes (push $0; push $0) preserves standard 16-byte alignment at call *%rdx.
    • Frame pointer chain: the double zero push forms a null frame record (old %rbp == 0, return address == 0) terminating frame pointer-based walks.
    • DWARF unwind info: .cfi_undefined %rip correctly instructs the DWARF unwinder to terminate the backtrace with _URC_END_OF_STACK.
    • PE-COFF compatibility: APS5_ASM_FUNCTION macro generates proper symbol definitions on Windows MinGW without assembly warnings.

Windows Regression Tests

Test Status Duration
guest_kernel_is_stack Passed 0.13 s
unwind_record_bounds Passed 0.16 s
guest_exception_handler Passed 0.06 s
guest_raise_exception Passed 13.45 s
guest_pthread_attr_stack Passed 0.06 s
guest_pthread_frame_chain Passed 0.16 s
guest_pthread_start (10,000 thread starts) Passed 4.38 s
guest_pthread_stack Passed 0.08 s

LGTM!

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5818413441 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15691#pullrequestreview-5818413441). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-08T15:16:28Z. **Review:** APPROVED --- ### What I ran - **Head commit:** `24babea951399f0e08b92bf2d294212f76e661bf` - **Merge-base:** `04a9eb4fa2877eb6e40bf2c83adf972e40d89b24` - **Rebase test:** Cherry-picked cleanly onto current `main` (`828e44310ec98912f041d0e51b8adc809848741b`, 0 conflicts). - **Environment:** Windows 11 x86-64, MinGW-w64 GCC 15.2.0 (WinLibs UCRT POSIX), CMake 3.31, Ninja 1.13. ### Tools and Checks - `python tools/check_conventions.py --base upstream/main --head pr-15691`: 0 errors. - `git diff --check upstream/main...pr-15691`: clean (no trailing whitespace or line ending issues). - `python tools/pr_overlap.py --branch pr-15691`: probed 1836 open pull requests against main; 24 share `Thread.cpp`. 10 merge cleanly, 14 stale branches conflict with `main` on unrelated lines. ### Windows Compilation & ABI Verification - `libkernel` built cleanly (`core/libs/prx/libkernel/CMakeFiles/libkernel.dir/Pthread/src/Thread.cpp.obj`). - `Aps5CallOnGuestMainStack_nid_no_patch`: - `APS5_VABI` calling convention passes arguments in `%rdi` (`top`), `%rsi` (`arguments`), and `%rdx` (`entry`). - Stack alignment: `mov %rdi, %rsp` followed by two 8-byte pushes (`push $0; push $0`) preserves standard 16-byte alignment at `call *%rdx`. - Frame pointer chain: the double zero push forms a null frame record (`old %rbp == 0`, `return address == 0`) terminating frame pointer-based walks. - DWARF unwind info: `.cfi_undefined %rip` correctly instructs the DWARF unwinder to terminate the backtrace with `_URC_END_OF_STACK`. - PE-COFF compatibility: `APS5_ASM_FUNCTION` macro generates proper symbol definitions on Windows MinGW without assembly warnings. ### Windows Regression Tests | Test | Status | Duration | |---|---|---| | `guest_kernel_is_stack` | Passed | 0.13 s | | `unwind_record_bounds` | Passed | 0.16 s | | `guest_exception_handler` | Passed | 0.06 s | | `guest_raise_exception` | Passed | 13.45 s | | `guest_pthread_attr_stack` | Passed | 0.06 s | | `guest_pthread_frame_chain` | Passed | 0.16 s | | `guest_pthread_start` (10,000 thread starts) | Passed | 4.38 s | | `guest_pthread_stack` | Passed | 0.08 s | LGTM!
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!15691
No description provided.