feat(libkernel): thread-local storage for Mach-O guests #11047

Merged
imellag merged 2 commits from upstream-pr/11047 into main 2026-10-27 14:18:47 +00:00
imellag commented 2026-10-25 15:11:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by imellag on 2026-10-25T15:11:14Z.


What

This is mugurc's 8b52faaba5 from his macOS series (ci/macos-series-2, listed on #1). mugurc is co-author of the commit.

main's macOS relinker turns each %fs access of a guest image into a stub that calls Aps5GuestTlsAllocate_nid_no_patch on a thread's first access, registers each image's TLS descriptor with Aps5GuestTlsRegister_nid_no_patch (MacOsImage.cpp), and binds guest modules' __tls_get_addr to Aps5GuestTlsGetAddr_nid_no_patch (MacOsGuestModuleWriter.cpp). No library defines them, so no relinked executable starts on macOS: dyld stops at symbol not found in flat namespace '_Aps5GuestTlsAllocate_nid_no_patch'.

GuestTlsMacOs.cpp (libkernel, whole file under __APPLE__) defines them:

  • Aps5GuestTlsRegister checks the descriptor the relinker writes (version 1, layout at offsets 0 to 0x28 as MacOsImage.cpp writes it) and creates the pthread key; the key's destructor frees a thread's block.
  • Aps5GuestTlsAllocateThreadPointer allocates the block: the TLS template, zeros, then a 0x100-byte thread control block whose first word points at itself, as on FreeBSD. It stores the thread pointer under the key.
  • Aps5GuestTlsAllocate is the entry the stubs call: rax holds the descriptor and returns the thread pointer, and every other register is preserved, the upper halves of the ymm registers only where AVX exists.
  • Aps5GuestTlsGetAddr returns the thread's block plus the offset.

The libkernel debt file gets an entry for the macOS TLS design (one block and thread pointer per image, 0 at the stack guard word), and the __tls_get_addr entry no longer says the macOS resolver is undefined. Linux and Windows build an empty file.

Tested

Current main (2026-10-26): I looked for the smallest set of open PRs that boots titles on macOS from main 035ac96edd: #10366, #10552, #7631, #7804, #11249, #10669, #10540, #11447, this PR, #11048, #10876 and #9263, plus a local VulkanDevice.cpp patch that no open PR covers yet. With it, Planet of Lana and God of War Sons of Sparta, relinked with that tree, start from New Game and run without errors (Lana in gameplay for 120 s, GoW to the Cyclops fight in 145 s). Without this PR, the relinked eboot stops in dyld: symbol not found in flat namespace '_Aps5GuestTlsAllocate_nid_no_patch'.

Apple M4 Pro, macOS 27.0.1, Apple clang 21, x86-64 Release under Rosetta 2 (-DCMAKE_OSX_ARCHITECTURES=x86_64, Ninja, BUILD_TESTING=ON). main alone doesn't build the libraries on macOS, so the tree is main 61fc572cee with #10423, the open macOS build PRs (#10366, #10419, #10552, #7631, #7804, #4630, #10540, #10659, #10660, #10669, #10676), #10889, #10898 and the parts of mugurc's series that #7201 also carries. Planet of Lana (PPSA19450) is relinked with that tree's relinker (--macos --to-rosetta).

  • Without this PR: the relinked eboot stops in dyld at symbol not found in flat namespace '_Aps5GuestTlsAllocate_nid_no_patch'.
  • With it: the guest gets past its TLS setup and runs until its first window, which needs the main thread (that part is #11048). With both, Lana boots, loads the save and plays in the village: 27 to 30 fps from 85 s in each of 10 runs of 120 s.

Linux: GuestTlsMacOs.cpp passes g++ -std=gnu++20 -fsyntax-only with GCC 14 (gcc:14 image, x86-64). Not built on Windows; the file is empty there too.

check_conventions.py --base upstream/main passes. pr_overlap.py reports #9461, which edits the line next to the __tls_get_addr debt entry, and #5021 adding a file with the same name; neither touches the same code.

#7201 (the whole macOS port) and #5021 (the native ARM64 AOT draft) carry their own versions of these functions. #7201's head (6687cbac29, 2026-10-16) conflicts with main, needs a rebase anyway, and is being split into smaller PRs such as #10552 and #10419. #5021 is a draft of more than 43,000 lines that conflicts with main and says no merge into main is implied. If either lands first with these functions, this PR is not needed and I will close it.

Checklist

  • Based on current main; no other open PR implements the same functions (except #7201 and #5021, see the end of Tested)
  • 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: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5005924271 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11047). Originally posted by [imellag](https://github.com/imellag) on 2026-10-25T15:11:14Z. --- ### What This is mugurc's `8b52faaba5` from his macOS series (`ci/macos-series-2`, listed on #1). mugurc is co-author of the commit. `main`'s macOS relinker turns each `%fs` access of a guest image into a stub that calls `Aps5GuestTlsAllocate_nid_no_patch` on a thread's first access, registers each image's TLS descriptor with `Aps5GuestTlsRegister_nid_no_patch` (`MacOsImage.cpp`), and binds guest modules' `__tls_get_addr` to `Aps5GuestTlsGetAddr_nid_no_patch` (`MacOsGuestModuleWriter.cpp`). No library defines them, so no relinked executable starts on macOS: dyld stops at `symbol not found in flat namespace '_Aps5GuestTlsAllocate_nid_no_patch'`. `GuestTlsMacOs.cpp` (libkernel, whole file under `__APPLE__`) defines them: - `Aps5GuestTlsRegister` checks the descriptor the relinker writes (version 1, layout at offsets 0 to 0x28 as `MacOsImage.cpp` writes it) and creates the pthread key; the key's destructor frees a thread's block. - `Aps5GuestTlsAllocateThreadPointer` allocates the block: the TLS template, zeros, then a 0x100-byte thread control block whose first word points at itself, as on FreeBSD. It stores the thread pointer under the key. - `Aps5GuestTlsAllocate` is the entry the stubs call: `rax` holds the descriptor and returns the thread pointer, and every other register is preserved, the upper halves of the ymm registers only where AVX exists. - `Aps5GuestTlsGetAddr` returns the thread's block plus the offset. The libkernel debt file gets an entry for the macOS TLS design (one block and thread pointer per image, 0 at the stack guard word), and the `__tls_get_addr` entry no longer says the macOS resolver is undefined. Linux and Windows build an empty file. ### Tested **Current `main` (2026-10-26):** I looked for the smallest set of open PRs that boots titles on macOS from `main` `035ac96edd`: #10366, #10552, #7631, #7804, #11249, #10669, #10540, #11447, this PR, #11048, #10876 and #9263, plus a local `VulkanDevice.cpp` patch that no open PR covers yet. With it, Planet of Lana and God of War Sons of Sparta, relinked with that tree, start from New Game and run without errors (Lana in gameplay for 120 s, GoW to the Cyclops fight in 145 s). Without this PR, the relinked eboot stops in dyld: `symbol not found in flat namespace '_Aps5GuestTlsAllocate_nid_no_patch'`. Apple M4 Pro, macOS 27.0.1, Apple clang 21, x86-64 Release under Rosetta 2 (`-DCMAKE_OSX_ARCHITECTURES=x86_64`, Ninja, `BUILD_TESTING=ON`). `main` alone doesn't build the libraries on macOS, so the tree is `main` `61fc572cee` with #10423, the open macOS build PRs (#10366, #10419, #10552, #7631, #7804, #4630, #10540, #10659, #10660, #10669, #10676), #10889, #10898 and the parts of mugurc's series that #7201 also carries. Planet of Lana (PPSA19450) is relinked with that tree's relinker (`--macos --to-rosetta`). - **Without this PR:** the relinked eboot stops in dyld at `symbol not found in flat namespace '_Aps5GuestTlsAllocate_nid_no_patch'`. - **With it:** the guest gets past its TLS setup and runs until its first window, which needs the main thread (that part is #11048). With both, Lana boots, loads the save and plays in the village: 27 to 30 fps from 85 s in each of 10 runs of 120 s. Linux: `GuestTlsMacOs.cpp` passes `g++ -std=gnu++20 -fsyntax-only` with GCC 14 (`gcc:14` image, x86-64). Not built on Windows; the file is empty there too. `check_conventions.py --base upstream/main` passes. `pr_overlap.py` reports #9461, which edits the line next to the `__tls_get_addr` debt entry, and #5021 adding a file with the same name; neither touches the same code. #7201 (the whole macOS port) and #5021 (the native ARM64 AOT draft) carry their own versions of these functions. #7201's head (`6687cbac29`, 2026-10-16) conflicts with `main`, needs a rebase anyway, and is being split into smaller PRs such as #10552 and #10419. #5021 is a draft of more than 43,000 lines that conflicts with `main` and says no merge into `main` is implied. If either lands first with these functions, this PR is not needed and I will close it. ### 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 (except #7201 and #5021, see the end of Tested) - [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: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-10-25 15:15:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T15:15:27Z.

Review: APPROVED


Reviewed exact head fd8ac6fcb95d0d4838aecb3bafe12d876f0103a2. The descriptor checks match the relinker TLS layout. Allocation aligns the block, copies the initialized template and zeros the remainder, stores one thread pointer per image in a pthread key, and frees each block through the key destructor. The first-access assembly preserves the guest caller-saved GPRs and XMM/YMM state around allocation while returning the thread pointer in RAX; the relinker-generated site restores the saved flags. The author reports the unresolved-symbol failure before the change and successful macOS title execution with #11048. Platform product jobs are skipped by path policy; I could not execute the Apple-specific assembly on this Linux runner.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5643822189 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11047#pullrequestreview-5643822189). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-25T15:15:27Z. **Review:** APPROVED --- Reviewed exact head fd8ac6fcb95d0d4838aecb3bafe12d876f0103a2. The descriptor checks match the relinker TLS layout. Allocation aligns the block, copies the initialized template and zeros the remainder, stores one thread pointer per image in a pthread key, and frees each block through the key destructor. The first-access assembly preserves the guest caller-saved GPRs and XMM/YMM state around allocation while returning the thread pointer in RAX; the relinker-generated site restores the saved flags. The author reports the unresolved-symbol failure before the change and successful macOS title execution with #11048. Platform product jobs are skipped by path policy; I could not execute the Apple-specific assembly on this Linux runner.
MarcZX10 commented 2026-10-25 16:04:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T16:04:03Z.

Review: DISMISSED


I rechecked the exact current heads of #11047 (fd8ac6fcb95d0d4838aecb3bafe12d876f0103a2) and #9461 (de5306dd29180871c2010d434fdfcfa71c1f9056). Their implementation changes are independent, but git merge-tree --write-tree reports a content conflict in docs/dev/debt/libkernel.md: #9461 inserts its TSC-frequency entry next to the __tls_get_addr entry that this PR replaces and follows with the new macOS TLS entry. Both entries can be retained, but the current overlap report does not merge automatically.

CONTRIBUTING.md requires the authors to agree which PR goes first when the overlap report identifies shared lines and record the order with Depends on. Please coordinate with #9461’s author and update the checklist/rebase as agreed. This finding concerns the debt-file composition only; I found no same-function implementation in #9461. I’m leaving changes requested until the required ordering is recorded.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5644053727 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11047#pullrequestreview-5644053727). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-25T16:04:03Z. **Review:** DISMISSED --- I rechecked the exact current heads of #11047 (`fd8ac6fcb95d0d4838aecb3bafe12d876f0103a2`) and #9461 (`de5306dd29180871c2010d434fdfcfa71c1f9056`). Their implementation changes are independent, but `git merge-tree --write-tree` reports a content conflict in `docs/dev/debt/libkernel.md`: #9461 inserts its TSC-frequency entry next to the `__tls_get_addr` entry that this PR replaces and follows with the new macOS TLS entry. Both entries can be retained, but the current overlap report does not merge automatically. `CONTRIBUTING.md` requires the authors to agree which PR goes first when the overlap report identifies shared lines and record the order with `Depends on`. Please coordinate with #9461’s author and update the checklist/rebase as agreed. This finding concerns the debt-file composition only; I found no same-function implementation in #9461. I’m leaving changes requested until the required ordering is recorded.
jotitadev commented 2026-10-27 07:05:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-27T07:05:59Z.

Review: COMMENTED


Tested head 337a1fcfe on macOS, and found one problem: Aps5GuestTlsAvx_nid_no_patch is always 0, so the stub never saves the upper halves of the ymm registers, even on a CPU with AVX.

Machine: Apple M2 Max (32 GB), macOS 27.2 (26B5112a), Apple clang 21.0.0, x86_64 Release under Rosetta 2 (-DCMAKE_OSX_ARCHITECTURES=x86_64, Ninja, BUILD_TESTING=ON, Python 3.9 from Xcode).
Base: main b986c11a34 does not build the libraries on macOS by itself, so the tree is that main plus the open macOS build PRs (#10366, #7631, #10659, #10660, #11249, #11358, #10669, #10552, #7804, #10676, #11447, #11437) and #11554, plus #11705 (applied locally). Only this PR is toggled, with git merge --no-commit on top.

Aps5GuestTlsAvx_nid_no_patch is computed before compiler-rt fills __cpu_model

The variable is a dynamic initializer in libkernel: __builtin_cpu_supports("avx") reads __cpu_model, which compiler-rt's __cpu_indicator_init fills from a constructor with priority 101. Mach-O ignores constructor priorities, and here libkernel's initializer runs first, so it reads zeros.

With ROSETTA_ADVERTISE_AVX=1, Rosetta reports AVX. The process sees it, but libkernel's flag doesn't:

__builtin_cpu_supports("avx") in main Aps5GuestTlsAvx_nid_no_patch
default Rosetta 0 0
ROSETTA_ADVERTISE_AVX=1 1 0

A 3-line dylib (std::uint8_t Flag = __builtin_cpu_supports("avx") ? 1 : 0;, read from main) shows the same thing: 0 from the dylib's initializer, 1 from a later call in the same dylib. On an Intel Mac with AVX, or under Rosetta with AVX advertised, a guest's first %fs access therefore goes through the xmm-only path. Its ymm upper halves then survive only if nothing in Aps5GuestTlsAllocateThreadPointer (posix_memalign, memcpy, memset, pthread_setspecific) uses VEX code. I couldn't make libSystem clobber them under Rosetta, even with a 40 KB template, so I haven't seen a guest break from this. I can't test native Intel.

This fixes it:

std::uint8_t Aps5GuestTlsAvx_nid_no_patch = [] { __builtin_cpu_init(); return __builtin_cpu_supports("avx") ? 1 : 0; }();

With it, the flag is 1 under ROSETTA_ADVERTISE_AVX=1 and 0 without it, and the ymm path below passes 3/3.

What I ran (no test in the PR covers these functions, so I used a harness)

This is a small x86_64 harness linked against the built libkernel.prx. It resolves the four symbols with dlsym and calls Aps5GuestTlsAllocate from assembly the way the relinker stubs do: descriptor in rax, rcx/rdx/rsi/rdi/r8–r11 set to sentinels, and xmm0–15 (or ymm0–15) loaded with patterns. It checks:

  • all eight GPRs and all 16 vector registers come back intact;
  • the thread pointer points at itself, and the word at 0x28 is 0;
  • the template is copied and the tail is zeroed;
  • the block is aligned (16 and 64);
  • pthread_getspecific holds the thread pointer, and Aps5GuestTlsGetAddr returns block + offset;
  • two images get distinct keys and blocks;
  • a second thread gets its own block through GetAddr on its first access.
without this PR with this PR
harness, xmm path (default Rosetta) symbols missing in libkernel.prx 3/3 pass
harness, ymm path (ROSETTA_ADVERTISE_AVX=1) symbols missing never taken (flag 0, see above); 3/3 pass with the one-line fix
non-GPU suite ctest -E "^agc|gpu|vulkan|video_out" (1372) 78 fail 78 fail, same set*

* One extra failure in the run with the PR, guest_jxr_stream, is flaky on the base too (5 of 15 runs abort without this PR).

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5663370651 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11047#pullrequestreview-5663370651). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-27T07:05:59Z. **Review:** COMMENTED --- Tested head `337a1fcfe` on macOS, and found one problem: `Aps5GuestTlsAvx_nid_no_patch` is always 0, so the stub never saves the upper halves of the ymm registers, even on a CPU with AVX. **Machine:** Apple M2 Max (32 GB), macOS 27.2 (26B5112a), Apple clang 21.0.0, x86_64 Release under Rosetta 2 (`-DCMAKE_OSX_ARCHITECTURES=x86_64`, Ninja, `BUILD_TESTING=ON`, Python 3.9 from Xcode). **Base:** `main` `b986c11a34` does not build the libraries on macOS by itself, so the tree is that `main` plus the open macOS build PRs (#10366, #7631, #10659, #10660, #11249, #11358, #10669, #10552, #7804, #10676, #11447, #11437) and #11554, plus #11705 (applied locally). Only this PR is toggled, with `git merge --no-commit` on top. ### `Aps5GuestTlsAvx_nid_no_patch` is computed before compiler-rt fills `__cpu_model` The variable is a dynamic initializer in libkernel: `__builtin_cpu_supports("avx")` reads `__cpu_model`, which compiler-rt's `__cpu_indicator_init` fills from a constructor with priority 101. Mach-O ignores constructor priorities, and here libkernel's initializer runs first, so it reads zeros. With `ROSETTA_ADVERTISE_AVX=1`, Rosetta reports AVX. The process sees it, but libkernel's flag doesn't: | | `__builtin_cpu_supports("avx")` in `main` | `Aps5GuestTlsAvx_nid_no_patch` | |---|---|---| | default Rosetta | 0 | 0 | | `ROSETTA_ADVERTISE_AVX=1` | 1 | **0** | A 3-line dylib (`std::uint8_t Flag = __builtin_cpu_supports("avx") ? 1 : 0;`, read from `main`) shows the same thing: 0 from the dylib's initializer, 1 from a later call in the same dylib. On an Intel Mac with AVX, or under Rosetta with AVX advertised, a guest's first `%fs` access therefore goes through the xmm-only path. Its ymm upper halves then survive only if nothing in `Aps5GuestTlsAllocateThreadPointer` (`posix_memalign`, `memcpy`, `memset`, `pthread_setspecific`) uses VEX code. I couldn't make libSystem clobber them under Rosetta, even with a 40 KB template, so I haven't seen a guest break from this. I can't test native Intel. This fixes it: ```cpp std::uint8_t Aps5GuestTlsAvx_nid_no_patch = [] { __builtin_cpu_init(); return __builtin_cpu_supports("avx") ? 1 : 0; }(); ``` With it, the flag is 1 under `ROSETTA_ADVERTISE_AVX=1` and 0 without it, and the ymm path below passes 3/3. ### What I ran (no test in the PR covers these functions, so I used a harness) This is a small x86_64 harness linked against the built `libkernel.prx`. It resolves the four symbols with `dlsym` and calls `Aps5GuestTlsAllocate` from assembly the way the relinker stubs do: descriptor in `rax`, `rcx`/`rdx`/`rsi`/`rdi`/`r8`–`r11` set to sentinels, and xmm0–15 (or ymm0–15) loaded with patterns. It checks: - all eight GPRs and all 16 vector registers come back intact; - the thread pointer points at itself, and the word at 0x28 is 0; - the template is copied and the tail is zeroed; - the block is aligned (16 and 64); - `pthread_getspecific` holds the thread pointer, and `Aps5GuestTlsGetAddr` returns block + offset; - two images get distinct keys and blocks; - a second thread gets its own block through `GetAddr` on its first access. | | without this PR | with this PR | |---|---|---| | harness, xmm path (default Rosetta) | symbols missing in `libkernel.prx` | 3/3 pass | | harness, ymm path (`ROSETTA_ADVERTISE_AVX=1`) | symbols missing | never taken (flag 0, see above); 3/3 pass with the one-line fix | | non-GPU suite `ctest -E "^agc\|gpu\|vulkan\|video_out"` (1372) | 78 fail | 78 fail, same set* | \* One extra failure in the run with the PR, `guest_jxr_stream`, is flaky on the base too (5 of 15 runs abort without this PR). Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
jotitadev commented 2026-10-27 09:22:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-27T09:22:58Z.

Review: COMMENTED


Follow-up on the AVX flag: fixed at head c8cac8e09.

Machine: Apple M2 Max (32 GB), macOS 27.2, Apple clang 21.0.0, x86_64 Release under Rosetta 2 (-DCMAKE_OSX_ARCHITECTURES=x86_64, Ninja, BUILD_TESTING=ON, Python 3.9 from Xcode).
Base: current main 5d52b06ff3 plus the open macOS build PRs (#7631, #11249, #11358, #10669, #10552, #7804, #11447, #11437, #11554) and #11705 applied locally, since main alone doesn't build libkernel on macOS. This PR merges cleanly on top.

Same harness as before, extended to tell which path the stub took: it fills the stack below the call with 0xCC and, after the call, looks for the low and upper halves of each loaded vector register in the stub's save area.

Aps5GuestTlsAvx_nid_no_patch stub path harness
c8cac8e09, default Rosetta (no AVX) 0 xmm (upper halves 0/16) 3/3 pass
c8cac8e09, ROSETTA_ADVERTISE_AVX=1 1 ymm (upper halves 16/16) 3/3 pass
control: first commit only (86cdfb864), ROSETTA_ADVERTISE_AVX=1 0 xmm 3/3 pass

Non-GPU suite (ctest -E "^agc|gpu|vulkan|video_out", 1407 tests): 52 failures on the base, the same 52 with this PR. The PR run also had guest_jxr_stream and guest_refused_connect fail once and guest_socket_read_write pass; rerun alone 5x, guest_refused_connect passed 5/5, and the other two fail intermittently on the base as well.

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5664781791 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11047#pullrequestreview-5664781791). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-27T09:22:58Z. **Review:** COMMENTED --- Follow-up on the AVX flag: fixed at head `c8cac8e09`. **Machine:** Apple M2 Max (32 GB), macOS 27.2, Apple clang 21.0.0, x86_64 Release under Rosetta 2 (`-DCMAKE_OSX_ARCHITECTURES=x86_64`, Ninja, `BUILD_TESTING=ON`, Python 3.9 from Xcode). **Base:** current `main` `5d52b06ff3` plus the open macOS build PRs (#7631, #11249, #11358, #10669, #10552, #7804, #11447, #11437, #11554) and #11705 applied locally, since `main` alone doesn't build libkernel on macOS. This PR merges cleanly on top. Same harness as before, extended to tell which path the stub took: it fills the stack below the call with `0xCC` and, after the call, looks for the low and upper halves of each loaded vector register in the stub's save area. | | `Aps5GuestTlsAvx_nid_no_patch` | stub path | harness | |---|---|---|---| | `c8cac8e09`, default Rosetta (no AVX) | 0 | xmm (upper halves 0/16) | 3/3 pass | | `c8cac8e09`, `ROSETTA_ADVERTISE_AVX=1` | **1** | **ymm** (upper halves 16/16) | 3/3 pass | | control: first commit only (`86cdfb864`), `ROSETTA_ADVERTISE_AVX=1` | 0 | xmm | 3/3 pass | Non-GPU suite (`ctest -E "^agc|gpu|vulkan|video_out"`, 1407 tests): 52 failures on the base, the same 52 with this PR. The PR run also had `guest_jxr_stream` and `guest_refused_connect` fail once and `guest_socket_read_write` pass; rerun alone 5x, `guest_refused_connect` passed 5/5, and the other two fail intermittently on the base as well. Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
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!11047
No description provided.