fix(libkernel): start guest threads with the x87 control word 0x037f #11849

Merged
AlexFigas merged 2 commits from upstream-pr/11849 into main 2026-11-02 12:27:12 +00:00
AlexFigas commented 2026-10-27 09:50:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by AlexFigas on 2026-10-27T09:50:28Z.


What

A guest thread started with whatever x87 control word the host gave it: on Linux the creator's, on Windows _beginthreadex's default 0x027f (53-bit precision). On the console it starts with 0x037f, as on FreeBSD 11:

  • FreeBSD 11's cpu_copy_thread clears PCB_FPUINITDONE and PCB_USERFPUINITDONE for the new thread, so its first FPU instruction goes through fpudna and loads fpu_initialstate, whose control word is __INITIAL_FPUCW__ (0x037F), whatever the creator uses. Newer FreeBSD copies the creator's FPU state instead; the libc.prx that titles bundle follows FreeBSD 11's msun.
  • libSceFiber's option that starts fibers with the default FPU state loads the same 0x037f.

RunThread now loads 0x037f on the new thread before it runs the guest entry. MXCSR is not touched here; #7565 sets the measured 0x9fc0.

This matters for the long-double math in libc, which runs at the caller's x87 precision as the console's own code does (see #11260, #11632). At 53 bits, asinl(0.75) returns mantissa 0xd91a98ae3406e000 instead of 0xd91a98ae3406e041, and exp2l results move far from the 64-bit ones. With this change, created guest threads compute at 64 bits, as on the console, unless the title changes the control word itself.

The initial thread is not covered: the relinker's entry stub runs the guest entry on the host's main thread, which keeps the control word the host starts it with (0x027f on Windows). The entry stub is where #7594 sets MXCSR for that thread, and the control word would go there too.

A new libkernel debt entry records that 0x037f comes from FreeBSD 11 and the fiber default, not from a measurement, and that the initial thread keeps the host's control word. It sits next to the pthread_attr entry, away from the lines other open PRs change.

libc's asinl entry said guest threads start at 53 bits on Windows; it now says that of the initial thread only, trimmed to stay under 1000 characters. #11632 and #11634 add the cbrtl and hypotl entries directly above that line, so this PR declares Depends on: #11632, #11634 and I'll rebase once they land. #12319, which rewrote the acosf line below, has merged, and this branch is rebased onto it.

Tested

On Ubuntu 24.04 under WSL2 (GCC 13.3, Release), head 950ce5a4fc, which merges main 98ddd9c179 into this PR's commit:

  • guest_kernel_sys_thread_defaults gains CheckFpuControl. The main thread sets 0x027f and creates a thread. The new thread must read 0x037f, and the creator's own control word must still be 0x027f after the join. It passes 3 runs, with the other guest_kernel_sys_thread*, pthread and fiber tests (67, main's new guest_pthread_cancel_inactive_wait_* cases included; agc_driver_optimize_on_fiber skips itself in this build, the other 66 pass); without the fldcw it aborts, because a Linux thread inherits the creator's 0x027f.
  • The whole suite passed (2556 tests) on the earlier head ac680b0c0b. I did not rerun it on later heads.
  • Windows (WinLibs GCC 15.2), run by others: JJenkx ran guest_kernel_sys_thread_defaults at 739318563f, where it passes 3 runs and aborts with Thread.cpp from the merge base; maskym ran it at 4efa6aae4d merged into main 1089f2bbfd, where it passes.
  • python3 tools/check_conventions.py --base origin/main passes.
  • Overlap. python3 tools/pr_overlap.py --branch fix/libkernel-guest-thread-x87-control-word reports #11632, #11634 and #8417, all in docs/dev/debt/libc.md. The 79 pull requests it could not compare give the same git merge-tree conflicts with this branch as with main.
    • #11865, which changed Pthread/Posix/Thread.cpp, has merged, and this head contains it.
    • #10253 was rebased and now adds its asin/acos entry away from the asinl line, so the two merge cleanly in either order and this PR no longer depends on it.
    • #11632 and #11634 drop cbrtl and hypotl from the host-computed list and add their entries directly above that line, so they conflict with this PR there too. They land first; this PR declares Depends on both. With #11634's head 72ec427b78, which contains #11632 and main 98ddd9c179, merged into this head, they conflict only on that line, and keeping their entries with this PR's asinl line leaves this PR's diff unchanged (4 files, +27 −1) and passes check_conventions.py.
    • #12319, which rewrote the acosf line directly below asinl, has merged.
    • #8417 adds tgamma to the host-computed list line above asinl. It has had changes requested since October 26, so neither this PR nor #11632 and #11634 wait for it.
    • The tool could not compare Pthread/src/Thread.cpp with #3986, #4563, #5021, #7149, #7804 and #8592, which conflict with main. #3986 inserts a line right after RunThread's RegisterStack(self) and #8592 one right before CurrentGuestState().current = self. The fldcw now sits between those two calls, and a three-way merge of each PR's Thread.cpp with this branch's gives no conflict; the other four do not touch those lines.

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: #11632, #11634
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5031882969 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11849). Originally posted by [AlexFigas](https://github.com/AlexFigas) on 2026-10-27T09:50:28Z. --- ### What A guest thread started with whatever x87 control word the host gave it: on Linux the creator's, on Windows `_beginthreadex`'s default `0x027f` (53-bit precision). On the console it starts with `0x037f`, as on FreeBSD 11: - FreeBSD 11's [`cpu_copy_thread`](https://github.com/freebsd/freebsd-src/blob/release/11.0.0/sys/amd64/amd64/vm_machdep.c#L428-L446) clears `PCB_FPUINITDONE` and `PCB_USERFPUINITDONE` for the new thread, so its first FPU instruction goes through [`fpudna`](https://github.com/freebsd/freebsd-src/blob/release/11.0.0/sys/amd64/amd64/fpu.c#L655-L677) and loads `fpu_initialstate`, whose control word is `__INITIAL_FPUCW__` (`0x037F`), whatever the creator uses. Newer FreeBSD copies the creator's FPU state instead; the `libc.prx` that titles bundle follows FreeBSD 11's msun. - libSceFiber's option that starts fibers with the default FPU state loads the same `0x037f`. `RunThread` now loads `0x037f` on the new thread before it runs the guest entry. MXCSR is not touched here; #7565 sets the measured `0x9fc0`. This matters for the long-double math in libc, which runs at the caller's x87 precision as the console's own code does (see #11260, #11632). At 53 bits, `asinl(0.75)` returns mantissa `0xd91a98ae3406e000` instead of `0xd91a98ae3406e041`, and `exp2l` results move far from the 64-bit ones. With this change, created guest threads compute at 64 bits, as on the console, unless the title changes the control word itself. The initial thread is not covered: the relinker's entry stub runs the guest entry on the host's main thread, which keeps the control word the host starts it with (`0x027f` on Windows). The entry stub is where #7594 sets MXCSR for that thread, and the control word would go there too. A new libkernel debt entry records that `0x037f` comes from FreeBSD 11 and the fiber default, not from a measurement, and that the initial thread keeps the host's control word. It sits next to the `pthread_attr` entry, away from the lines other open PRs change. libc's `asinl` entry said guest threads start at 53 bits on Windows; it now says that of the initial thread only, trimmed to stay under 1000 characters. #11632 and #11634 add the `cbrtl` and `hypotl` entries directly above that line, so this PR declares `Depends on: #11632, #11634` and I'll rebase once they land. #12319, which rewrote the `acosf` line below, has merged, and this branch is rebased onto it. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> On Ubuntu 24.04 under WSL2 (GCC 13.3, Release), head 950ce5a4fc, which merges `main` 98ddd9c179 into this PR's commit: - `guest_kernel_sys_thread_defaults` gains `CheckFpuControl`. The main thread sets `0x027f` and creates a thread. The new thread must read `0x037f`, and the creator's own control word must still be `0x027f` after the join. It passes 3 runs, with the other `guest_kernel_sys_thread*`, `pthread` and `fiber` tests (67, `main`'s new `guest_pthread_cancel_inactive_wait_*` cases included; `agc_driver_optimize_on_fiber` skips itself in this build, the other 66 pass); without the `fldcw` it aborts, because a Linux thread inherits the creator's `0x027f`. - The whole suite passed (2556 tests) on the earlier head ac680b0c0b. I did not rerun it on later heads. - Windows (WinLibs GCC 15.2), run by others: JJenkx ran `guest_kernel_sys_thread_defaults` at 739318563f, where it passes 3 runs and aborts with `Thread.cpp` from the merge base; maskym ran it at 4efa6aae4d merged into `main` 1089f2bbfd, where it passes. - `python3 tools/check_conventions.py --base origin/main` passes. - **Overlap.** `python3 tools/pr_overlap.py --branch fix/libkernel-guest-thread-x87-control-word` reports #11632, #11634 and #8417, all in `docs/dev/debt/libc.md`. The 79 pull requests it could not compare give the same `git merge-tree` conflicts with this branch as with `main`. - #11865, which changed `Pthread/Posix/Thread.cpp`, has merged, and this head contains it. - #10253 was rebased and now adds its `asin`/`acos` entry away from the `asinl` line, so the two merge cleanly in either order and this PR no longer depends on it. - #11632 and #11634 drop `cbrtl` and `hypotl` from the host-computed list and add their entries directly above that line, so they conflict with this PR there too. They land first; this PR declares `Depends on` both. With #11634's head 72ec427b78, which contains #11632 and `main` 98ddd9c179, merged into this head, they conflict only on that line, and keeping their entries with this PR's `asinl` line leaves this PR's diff unchanged (4 files, +27 −1) and passes `check_conventions.py`. - #12319, which rewrote the `acosf` line directly below `asinl`, has merged. - #8417 adds `tgamma` to the host-computed list line above `asinl`. It has had changes requested since October 26, so neither this PR nor #11632 and #11634 wait for it. - The tool could not compare `Pthread/src/Thread.cpp` with #3986, #4563, #5021, #7149, #7804 and #8592, which conflict with `main`. #3986 inserts a line right after `RunThread`'s `RegisterStack(self)` and #8592 one right before `CurrentGuestState().current = self`. The `fldcw` now sits between those two calls, and a three-way merge of each PR's `Thread.cpp` with this branch's gives no conflict; the other four do not touch those lines. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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: #11632, #11634 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-10-27 10:55:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-27T10:55:55Z.

Review: APPROVED


Reviewed the exact head 739318563f3cc6cfeaf27458c974b2457807b7a3. The control word is set on the newly created host thread before the guest entry runs, and the change leaves the creator's state untouched. The initial-thread limitation is clearly recorded in the debt entry. I found no correctness issue in this narrow change.

I built guest_kernel_sys_thread_defaults_tests successfully. The direct CTest run stopped at the existing host CPU capability guard (this machine lacks AVX2/FMA); running the exact test executable under qemu-x86_64 -cpu max passed, including the new control-word case. The PR's Windows check also passes. I did not run the full suite independently.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5665902012 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11849#pullrequestreview-5665902012). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-27T10:55:55Z. **Review:** APPROVED --- Reviewed the exact head 739318563f3cc6cfeaf27458c974b2457807b7a3. The control word is set on the newly created host thread before the guest entry runs, and the change leaves the creator's state untouched. The initial-thread limitation is clearly recorded in the debt entry. I found no correctness issue in this narrow change. I built guest_kernel_sys_thread_defaults_tests successfully. The direct CTest run stopped at the existing host CPU capability guard (this machine lacks AVX2/FMA); running the exact test executable under `qemu-x86_64 -cpu max` passed, including the new control-word case. The PR's Windows check also passes. I did not run the full suite independently.
MarcZX10 commented 2026-10-27 13:00:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-27T13:00:08Z.

Review: CHANGES_REQUESTED


The current overlap report still lists this PR's changes to docs/dev/debt/libc.md with #10253 and docs/dev/debt/libkernel.md with #11865. It also says it could not compare Thread.cpp against #11865. #11865's current description records the debt-file conflict with this PR, but this PR still says Depends on: none and claims its overlap check found no other author's overlap. Please update the overlap report/checklist to record the agreed landing order for the shared debt entry, and manually compare the Thread.cpp change with #11865 before saying there is no overlap. The source change and test evidence otherwise look sound; this is a contribution-rule/merge-coordination blocker.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5667412132 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11849#pullrequestreview-5667412132). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-27T13:00:08Z. **Review:** CHANGES_REQUESTED --- The current overlap report still lists this PR's changes to `docs/dev/debt/libc.md` with #10253 and `docs/dev/debt/libkernel.md` with #11865. It also says it could not compare `Thread.cpp` against #11865. #11865's current description records the debt-file conflict with this PR, but this PR still says `Depends on: none` and claims its overlap check found no other author's overlap. Please update the overlap report/checklist to record the agreed landing order for the shared debt entry, and manually compare the `Thread.cpp` change with #11865 before saying there is no overlap. The source change and test evidence otherwise look sound; this is a contribution-rule/merge-coordination blocker.
MarcZX10 commented 2026-10-27 13:35:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-27T13:35:40Z.

Review: CHANGES_REQUESTED


Re-reviewed new exact head 4efa6aae4ddd2230340b03d2fd131eccb1c11ef2. The changes resolve the earlier direct overlap: libc.md is no longer edited, the libkernel debt entry moved away from #11865's edited lines, and merge-tree checks of both current PR heads are clean.

One landing-order/content issue remains. This code changes the precision of newly created guest threads, while the existing asinl debt sentence in libc.md still says Windows guest threads run at 53 bits. The description says that sentence will be narrowed after #10253 lands, but the checklist still says Depends on: none. Please record #10253 as the dependency and, after it lands, update/rebase this PR to narrow the asinl note before merging; otherwise the code and documented behavior disagree.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5667897410 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11849#pullrequestreview-5667897410). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-27T13:35:40Z. **Review:** CHANGES_REQUESTED --- Re-reviewed new exact head `4efa6aae4ddd2230340b03d2fd131eccb1c11ef2`. The changes resolve the earlier direct overlap: `libc.md` is no longer edited, the libkernel debt entry moved away from #11865's edited lines, and merge-tree checks of both current PR heads are clean. One landing-order/content issue remains. This code changes the precision of newly created guest threads, while the existing `asinl` debt sentence in `libc.md` still says Windows guest threads run at 53 bits. The description says that sentence will be narrowed after #10253 lands, but the checklist still says `Depends on: none`. Please record #10253 as the dependency and, after it lands, update/rebase this PR to narrow the `asinl` note before merging; otherwise the code and documented behavior disagree.
MarcZX10 commented 2026-10-27 14:58:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-27T14:58:24Z.

Review: APPROVED


Reviewed exact head ac680b0c0bc37d6ef6fd78bdedfccdfafa076e99 against current main f2f759ae31f2e51f767b8eb83c6c7e7132cab6d8.

The fldcw executes on the newly created host thread before the guest entry starts, setting only that thread's x87 control word; the test also checks the creator retains its previous value. The initial-thread limitation is documented. The updated diff no longer edits libc.md, and the declared dependency on #10253 is explicit; keep that landing order and rebase/recheck if main changes before merge.

Local verification: Release guest_kernel_sys_thread_defaults_tests build succeeded from this exact head; the test passed three runs under QEMU Haswell. Native CTest reaches the repository's host CPU guard because this Xeon lacks AVX2/FMA and related features. Conventions and git diff --check passed, and a merge-tree preview against current main is clean. Hosted Windows, eligibility, conventions, labels, and report checks pass; Linux product and the relinker/register-context/write-watch matrix are skipped for this PR. Author-reported full-suite and Windows runs are described in the PR; I did not independently run the full suite or test on a PS5.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5669252654 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11849#pullrequestreview-5669252654). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-27T14:58:24Z. **Review:** APPROVED --- Reviewed exact head `ac680b0c0bc37d6ef6fd78bdedfccdfafa076e99` against current `main` `f2f759ae31f2e51f767b8eb83c6c7e7132cab6d8`. The `fldcw` executes on the newly created host thread before the guest entry starts, setting only that thread's x87 control word; the test also checks the creator retains its previous value. The initial-thread limitation is documented. The updated diff no longer edits `libc.md`, and the declared dependency on #10253 is explicit; keep that landing order and rebase/recheck if `main` changes before merge. Local verification: Release `guest_kernel_sys_thread_defaults_tests` build succeeded from this exact head; the test passed three runs under QEMU Haswell. Native CTest reaches the repository's host CPU guard because this Xeon lacks AVX2/FMA and related features. Conventions and `git diff --check` passed, and a merge-tree preview against current main is clean. Hosted Windows, eligibility, conventions, labels, and report checks pass; Linux product and the relinker/register-context/write-watch matrix are skipped for this PR. Author-reported full-suite and Windows runs are described in the PR; I did not independently run the full suite or test on a PS5.
MarcZX10 commented 2026-10-29 05:49:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T05:49:23Z.

Review: CHANGES_REQUESTED


Re-checked — changes requested

The reported test demonstrates the x87 control-word reset and that the creator thread retains its own value. The branch is still based on main 3a2b919816, 36 commits behind current main 52c09d567d2fa453494dd720fcf53a98149468e4. The repository checklist requires a current-main base, and the reported whole-suite run is on an earlier head.

What I ran

  • Reviewed exact head 57c9f5d2554deb338b1306b38b93d0f7ff129f36 against current main.
  • Ran git merge-tree --write-tree and git diff --check.
  • Checked the exact-head thread test report and current hosted checks.

Results

Check Result
Current-main merge preview Clean; current main is not in the branch history
git diff --check Passed
Focused thread tests Author reports 67 thread/pthread/fiber tests and three focused runs on the older 3a2b919816 base
Whole suite Reported on an earlier head, not rerun after the rebase
Windows Existing report is on earlier heads; current-head Windows behavior is not reported

Please refresh onto current main and rerun the focused thread tests on that exact head. I did not build or run the C++ tests locally.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5693411504 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11849#pullrequestreview-5693411504). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T05:49:23Z. **Review:** CHANGES_REQUESTED --- # Re-checked — changes requested The reported test demonstrates the x87 control-word reset and that the creator thread retains its own value. The branch is still based on `main` `3a2b919816`, 36 commits behind current `main` `52c09d567d2fa453494dd720fcf53a98149468e4`. The repository checklist requires a current-main base, and the reported whole-suite run is on an earlier head. ## What I ran - Reviewed exact head `57c9f5d2554deb338b1306b38b93d0f7ff129f36` against current `main`. - Ran `git merge-tree --write-tree` and `git diff --check`. - Checked the exact-head thread test report and current hosted checks. ## Results | Check | Result | |---|---| | Current-main merge preview | Clean; current `main` is not in the branch history | | `git diff --check` | Passed | | Focused thread tests | Author reports 67 thread/pthread/fiber tests and three focused runs on the older `3a2b919816` base | | Whole suite | Reported on an earlier head, not rerun after the rebase | | Windows | Existing report is on earlier heads; current-head Windows behavior is not reported | Please refresh onto current `main` and rerun the focused thread tests on that exact head. I did not build or run the C++ tests locally.
MarcZX10 commented 2026-10-29 11:07:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T11:07:52Z.

Review: CHANGES_REQUESTED


Re-checked — changes requested

The exact-head report now includes three focused runs, the 67 thread/pthread/fiber tests, and notes that the default-thread test aborts with main's implementation but passes with this change. The branch is based on 1b580f13cf; current main is ba5b5330b3, with updates to the debt files this PR changes. Please merge current main and rerun the focused thread-default test on the resulting exact head. Keep the declared landing order with #10253, #11632 and #11634.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5696706312 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11849#pullrequestreview-5696706312). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T11:07:52Z. **Review:** CHANGES_REQUESTED --- ## Re-checked — changes requested The exact-head report now includes three focused runs, the 67 thread/pthread/fiber tests, and notes that the default-thread test aborts with main's implementation but passes with this change. The branch is based on `1b580f13cf`; current `main` is `ba5b5330b3`, with updates to the debt files this PR changes. Please merge current main and rerun the focused thread-default test on the resulting exact head. Keep the declared landing order with #10253, #11632 and #11634.
MarcZX10 commented 2026-10-30 10:14:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-30T10:14:37Z.

Review: APPROVED


Reviewed — looks good

Reviewed exact open head 950ce5a4fc7a0faa02e2f2a36f0f73891e72b53e; I found no blocking issue in the per-thread x87 control-word initialization, test, or dependency declaration.

What I ran

The PR base is 98ddd9c1792bbab016ceed5db267a93d1d61f00a. Its merge preview onto current main a5939f10a85fdbcd3e0fe75e5eea278f4fe3e52a is clean. Local checks ran on Linux (Debian, Python 3.11.2, GCC 12.2.0); I did not configure or build. I inspected the exact diff, CMake registration, prior discussion, and CI. The author reports the focused test passing three times on this exact head under Ubuntu 24.04/WSL2 with GCC 13.3; I did not independently run it.

python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 11849
git diff --check 98ddd9c1792bbab016ceed5db267a93d1d61f00a...950ce5a4fc7a0faa02e2f2a36f0f73891e72b53e
git merge-tree --write-tree refs/remotes/upstream/main 950ce5a4fc7a0faa02e2f2a36f0f73891e72b53e
python3 tools/pr_stack_check.py 11849 --repo boykopovar/AnyPS5
python3 tools/pr_test_quality.py --root /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-11849-950ce5a4fc7a/head-950ce5a4fc7a-494f0c81 --json core/libs/tests/GuestKernelSysThreadDefaults.cpp

Results

Check Result
Diff check and conventions Passed locally; hosted conventions passed on this head.
Merge preview Clean against current main.
Dependency order Directly verified as #11632 → #11634 → #11849. The stack helper reported a cycle, but the live PR bodies show #11632 has no dependency and #11634 depends only on #11632; this is a helper false positive.
Test registration The heuristic flagged the new C++ test as possibly unregistered; exact-head core/libs/CMakeLists.txt registers guest_kernel_sys_thread_defaults_tests and the guest_kernel_sys_thread_defaults CTest.
Windows CI Job succeeded and compiled the changed library sources. Its log says no changed guest test sources were selected, so it did not execute the new test.
Focused behavior test Author reports three exact-head passes and that the test aborts against the base implementation; not independently run here.
No-build precheck The convention/diff checks passed. Its isolated checkout lacked the local ABI and test-quality helper scripts, and its dependency helper reported the false cycle above.
Selected unedited local output
All conventions checks passed.

1af306b7560db22f489bee4a435fe59bf28c15e8
No guest core/libs test sources changed
No guest core/libs test sources changed; the libs build still ran
{
  "findings": [
    {
      "path": "core/libs/tests/GuestKernelSysThreadDefaults.cpp",
      "line": 1,
      "kind": "possible-unregistered-cpp-test",
      "message": "Changed C++ test source path was not found literally in CMake files; inspect registration, generated source lists, and workflow coverage."
    }
  ],
  "negative_control_candidates": [],
  "limits": [
    "Heuristics can miss weak assertions and can flag valid tests; inspect every finding.",
    "A test that passes against base is not by itself proof that the PR test is inadequate.",
    "Negative controls are only candidates until the test actually runs against base and fails by assertion rather than import/setup error."
  ]
}

Negative control

Assertion Change to code under test Did the test fail?
New guest threads start with control word 0x037f, while the creator retains 0x027f. Author reports testing against main's Thread.cpp without the fldcw change. Yes, author-reported; not independently run.

Sources

Not verified

I did not build or run tests locally. The hosted Windows job did not execute the new CTest, and hosted Linux was skipped. The Windows focused result in the discussion is from an earlier head; the implementation and test logic are unchanged, but it is not an exact-current-head Windows run. No physical-console behavior was tested.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5710848897 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11849#pullrequestreview-5710848897). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-30T10:14:37Z. **Review:** APPROVED --- # Reviewed — looks good Reviewed exact open head `950ce5a4fc7a0faa02e2f2a36f0f73891e72b53e`; I found no blocking issue in the per-thread x87 control-word initialization, test, or dependency declaration. ## What I ran The PR base is `98ddd9c1792bbab016ceed5db267a93d1d61f00a`. Its merge preview onto current `main` `a5939f10a85fdbcd3e0fe75e5eea278f4fe3e52a` is clean. Local checks ran on Linux (Debian, Python 3.11.2, GCC 12.2.0); I did not configure or build. I inspected the exact diff, CMake registration, prior discussion, and CI. The author reports the focused test passing three times on this exact head under Ubuntu 24.04/WSL2 with GCC 13.3; I did not independently run it. ```sh python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 11849 git diff --check 98ddd9c1792bbab016ceed5db267a93d1d61f00a...950ce5a4fc7a0faa02e2f2a36f0f73891e72b53e git merge-tree --write-tree refs/remotes/upstream/main 950ce5a4fc7a0faa02e2f2a36f0f73891e72b53e python3 tools/pr_stack_check.py 11849 --repo boykopovar/AnyPS5 python3 tools/pr_test_quality.py --root /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-11849-950ce5a4fc7a/head-950ce5a4fc7a-494f0c81 --json core/libs/tests/GuestKernelSysThreadDefaults.cpp ``` ## Results | Check | Result | |---|---| | Diff check and conventions | Passed locally; hosted conventions passed on this head. | | Merge preview | Clean against current `main`. | | Dependency order | Directly verified as #11632 → #11634 → #11849. The stack helper reported a cycle, but the live PR bodies show #11632 has no dependency and #11634 depends only on #11632; this is a helper false positive. | | Test registration | The heuristic flagged the new C++ test as possibly unregistered; exact-head `core/libs/CMakeLists.txt` registers `guest_kernel_sys_thread_defaults_tests` and the `guest_kernel_sys_thread_defaults` CTest. | | Windows CI | Job succeeded and compiled the changed library sources. Its log says no changed guest test sources were selected, so it did not execute the new test. | | Focused behavior test | Author reports three exact-head passes and that the test aborts against the base implementation; not independently run here. | | No-build precheck | The convention/diff checks passed. Its isolated checkout lacked the local ABI and test-quality helper scripts, and its dependency helper reported the false cycle above. | <details><summary>Selected unedited local output</summary> ```text All conventions checks passed. ``` ```text 1af306b7560db22f489bee4a435fe59bf28c15e8 ``` ```text No guest core/libs test sources changed No guest core/libs test sources changed; the libs build still ran ``` ```json { "findings": [ { "path": "core/libs/tests/GuestKernelSysThreadDefaults.cpp", "line": 1, "kind": "possible-unregistered-cpp-test", "message": "Changed C++ test source path was not found literally in CMake files; inspect registration, generated source lists, and workflow coverage." } ], "negative_control_candidates": [], "limits": [ "Heuristics can miss weak assertions and can flag valid tests; inspect every finding.", "A test that passes against base is not by itself proof that the PR test is inadequate.", "Negative controls are only candidates until the test actually runs against base and fails by assertion rather than import/setup error." ] } ``` </details> ## Negative control | Assertion | Change to code under test | Did the test fail? | |---|---|---| | New guest threads start with control word `0x037f`, while the creator retains `0x027f`. | Author reports testing against `main`'s `Thread.cpp` without the `fldcw` change. | Yes, author-reported; not independently run. | ## Sources - [Thread initialization at this head](https://github.com/boykopovar/AnyPS5/blob/950ce5a4fc7a0faa02e2f2a36f0f73891e72b53e/core/libs/prx/libkernel/Pthread/src/Thread.cpp#L791-L800) - [Focused test at this head](https://github.com/boykopovar/AnyPS5/blob/950ce5a4fc7a0faa02e2f2a36f0f73891e72b53e/core/libs/tests/GuestKernelSysThreadDefaults.cpp#L68-L90) - [CMake test registration at this head](https://github.com/boykopovar/AnyPS5/blob/950ce5a4fc7a0faa02e2f2a36f0f73891e72b53e/core/libs/CMakeLists.txt#L444-L449) ## Not verified I did not build or run tests locally. The hosted Windows job did not execute the new CTest, and hosted Linux was skipped. The Windows focused result in the discussion is from an earlier head; the implementation and test logic are unchanged, but it is not an exact-current-head Windows run. No physical-console behavior was tested.
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!11849
No description provided.