Repository navigation
feat: macOS on Apple Silicon host support (Rosetta 2 and MoltenVK) - #7332
Closed
ycarogabriel-lgtm wants to merge 363 commits into
Closed
ycarogabriel-lgtm wants to merge 363 commits into
ycarogabriel-lgtm wants to merge 363 commits into
Conversation
sceNetCtlGetInfo picks the interface and gateway a title reports from the host's default IPv4 route, which it read from /proc/net/route; macOS has no /proc, so the first network query threw and guest_net_ctl aborted. The same routes come from the kernel through sysctl(NET_RT_DUMP), whose rt_msghdr records give the interface index and gateway of each default route. sceNetCtlGetIfStat had no macOS branch at all and would have thrown next; its byte counters come from the if_data that getifaddrs attaches to each AF_LINK entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sceNetResolverStartNtoa6 asks the host for AF_INET6 addresses. FreeBSD returns none for a name or literal that only has an IPv4 address, so a title's IPv6 lookup of "127.0.0.1" fails with ENODNS and it falls back to IPv4. macOS getaddrinfo maps such answers to ::ffff:a.b.c.d instead, so the lookup succeeded with an address the title never expects and guest_sce_net failed. Mapped answers are now skipped on macOS, which leaves a real IPv6 address as the only success. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sceKernelMunlockall called the host munlockall and then forgot the ranges it had locked. macOS does not implement munlockall (it fails with ENOSYS), so the guest's pages stayed wired and the failure overwrote the guest's errno, which a successful munlockall must leave alone; guest_mlock failed on that. On macOS the ranges the runtime recorded are now unlocked one by one with munlock, and errno is restored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t module guest_flexible_memory_declared loads a fixture that stands for a converted guest module with 512 MiB of data and checks that its segments are charged against the flexible memory budget. On macOS the runtime finds guest images through the __APS5DATA,__meta program headers the relinker writes into every converted module; the fixture is built directly as a dylib and had none, so it was not counted and the test failed. The fixture now carries the same metadata, one PT_LOAD segment over its data, as a relinked module would. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The macOS branch backed JIT objects with shm_open, but XNU never maps POSIX shared memory executable (its maximum protection is read-write), so running JIT code through the executable view died with SIGBUS and guest_jit_shared_memory failed. The object is now a temporary file; XNU only allows its first executable mapping while the file still has a path, so it is mapped executable once before being unlinked. XNU also refuses read-write-execute in a single mmap of a file, so such a view is mapped read-write and then made executable with mprotect. Under Rosetta, code rewritten through one view after another view ran it keeps its old translation; that is recorded as debt rather than tracked here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
libusb's configure check finds pipe2 in the Xcode 27 SDK, which declares it for macOS 27, and compiles its event pipe with it. The symbol is then weak-linked, so on macOS 26 and earlier, where libSystem has no pipe2, libusb_init_context calls a null pointer and every title that touches libSceUsbd crashes (guest_usbd died with SIGSEGV). Presetting HAVE_PIPE2 off makes libusb use pipe and fcntl, which every macOS has. A scan of the weak imports of all built prx libraries found no other symbol missing on macOS 26.6. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Guest exit handlers and static destructors still map and protect memory while the host runs its own static destructors. DoMprotect asks GuestThreadStack whether the range is a thread stack, which takes stackLock, a static std::mutex. glibc keeps a destroyed mutex usable, but libc++ on macOS destroys it with pthread_mutex_destroy, so a late mprotect threw "mutex lock failed: Invalid argument" and guest_memory_lifetime failed. The lock and the two stack maps are now allocated once and never destroyed, as the write watch and the direct memory state already are. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ate on macOS When an ITIMER_REAL expiry cannot be handled, the alarm thread throws, and a guest that installed std::set_terminate expects its handler to run with that error as the current exception, which is how titles report fatal errors. On Linux the host and the guest share libc.prx's C++ runtime, so that is what happens. On macOS host code keeps libc++abi, so the error ended in libc++abi's own terminate, the guest handler never ran and guest_itimer failed. The macOS alarm thread now catches the error and rethrows a copy through libc.prx's __cxa_throw, whose terminate path calls the guest handler. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…on watch agc_write_tracking failed on macOS for two reasons that are properties of the macOS write watch, not wrong results: - ImportWatched opens the whole range for host writes during an import, because Metal keeps the protection a page had when it was imported. A watch based on page protection then cannot tell a page the import rewrote with the same bytes from one it never touched, so both count as possibly touched by the CPU. The block state stays exact; only the CPU mark is conservative, which costs a later comparison and loses no write. The test keeps the exact mark for Linux and Windows, and the limit is recorded as debt. - The test's ProtectPage called mprotect directly. On macOS the driver reads a watched page's guest protection from the watch, which guest mprotect updates through DoMprotect; the helper bypassed that, so the driver still saw the page as readable. The helper now tells the watch, as DoMprotect does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The failure classification was written from reports on issue boykopovar#1 and left the local run as pending, so it could not tell which causes apply to this tree. The run on an M1 under Rosetta gives 525 of 590 passing and 30 failures, and the device's own feature list separates real device limits (cull distance, min/max sampler reduction, geometry shaders) from failures this tree can fix: the image tables are sized from the plain per-stage limits although MoltenVK offers a million descriptors through update-after-bind, and the recompiler asks for the Geometry capability only to read the layer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…Metal
A fragment shader that reads the layer declared the Geometry capability,
which MoltenVK cannot enable because Metal has no geometry shaders, so
every such pipeline was refused ("SPIR-V requires unsupported device
capability 2") and six AGC tests failed on Apple GPUs. SPIR-V lets the
same input be read under ShaderViewportIndexLayerEXT, which MoltenVK
offers. The recompiler now uses it only when the device has the
extension and no geometry shaders; a device with geometry shaders, or
without the extension, still gets Geometry as before.
On an M1 through MoltenVK 1.4.2, layered_volume_draw,
layered_volume_vertex, layered_volume_vertex_no_gpl,
pixel_ancillary_word and relative_ancillary now pass;
sample_mask_multisample gets past pipeline creation and fails on its
per-sample mask instead.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The previous change mapped the JIT file executable once and then unlinked it, which made guest_jit_shared_memory pass alone but fail in about every second run: XNU refuses executable mappings of an unlinked file intermittently, even while an earlier executable mapping of it is still alive. Measured natively, 5 of 30 launches failed with the early mapping kept and none of 30 with the file left linked. The file now stays linked until the JIT object's last descriptor closes, when no new mapping can be made, and is unlinked then; 20 consecutive runs pass and leave no file behind. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… when needed Bindless image and sampler tables were sized from the plain per-stage limits, after reserving the fixed typed heaps (1792 sampled images, 32 samplers). MoltenVK reports plain limits of 256 sampled images and 16 samplers per stage, so both tables got a capacity of 0 and every title using them stopped with "image tables need runtimeDescriptorArray ... which the device lacks", although the M1 has those features and allows a million sampled images and 1024 samplers per stage in update-after-bind sets. When the plain limits leave no room and the device supports sampled image update-after-bind, the tables now use that mode: the feature is enabled at device creation, the table bindings carry the update-after-bind flag, their sets are created update-after-bind, and layout validation and set allocation check each descriptor type against its update-after-bind limit, as Vulkan requires for such sets (before, only storage buffers used it). Devices whose plain limits already fit a table keep the plain sets. On an M1 through MoltenVK 1.4.2, bindless_images, image_sint8, image_table, image_table_cache_bounds and image_table_reuse now pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The previous change checked update-after-bind sets against the update-after-bind limit of each descriptor type alone. Vulkan requires those limits to be at least the plain ones, but a context can carry only some of them: agc_driver_graphics builds one with only the storage buffer update-after-bind limits, so its sampled images were checked against 0 and the test failed. An update-after-bind set is now checked against the larger of the two limits, which is the update-after-bind one on any conforming device. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The run after the two driver fixes needs to be on record next to the first one, with the two failures that are not caused by them: a timeout close to the 30 s limit and a write-tracking test that now fails on the unchanged sources too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…Metal
A fragment shader that reads the layer declared the Geometry capability,
which MoltenVK cannot enable because Metal has no geometry shaders, so
every such pipeline was refused ("SPIR-V requires unsupported device
capability 2") and six AGC tests failed on Apple GPUs. SPIR-V lets the
same input be read under ShaderViewportIndexLayerEXT, which MoltenVK
offers. The recompiler now uses it only when the device has the
extension and no geometry shaders; a device with geometry shaders, or
without the extension, still gets Geometry as before.
On an M1 through MoltenVK 1.4.2, layered_volume_draw,
layered_volume_vertex, layered_volume_vertex_no_gpl,
pixel_ancillary_word and relative_ancillary now pass;
sample_mask_multisample gets past pipeline creation and fails on its
per-sample mask instead.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… when needed Bindless image and sampler tables were sized from the plain per-stage limits, after reserving the fixed typed heaps (1792 sampled images, 32 samplers). MoltenVK reports plain limits of 256 sampled images and 16 samplers per stage, so both tables got a capacity of 0 and every title using them stopped with "image tables need runtimeDescriptorArray ... which the device lacks", although the M1 has those features and allows a million sampled images and 1024 samplers per stage in update-after-bind sets. When the plain limits leave no room and the device supports sampled image update-after-bind, the tables now use that mode: the feature is enabled at device creation, the table bindings carry the update-after-bind flag, their sets are created update-after-bind, and layout validation and set allocation check each descriptor type against its update-after-bind limit, as Vulkan requires for such sets (before, only storage buffers used it). Devices whose plain limits already fit a table keep the plain sets. On an M1 through MoltenVK 1.4.2, bindless_images, image_sint8, image_table, image_table_cache_bounds and image_table_reuse now pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The previous change checked update-after-bind sets against the update-after-bind limit of each descriptor type alone. Vulkan requires those limits to be at least the plain ones, but a context can carry only some of them: agc_driver_graphics builds one with only the storage buffer update-after-bind limits, so its sampled images were checked against 0 and the test failed. An update-after-bind set is now checked against the larger of the two limits, which is the update-after-bind one on any conforming device. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…osts sceKernelGetLibkernelTextLocation and sceKernelInternalMemoryGetModuleSegmentInfo were only compiled outside macOS, so a title whose bundled libc.prx imports the latter (the DOOM homebrew PPSA99666 does) stopped in dyld before main with "symbol not found in flat namespace '_-YTW+qXc3CQ'". Both only need the main program's first load segment, which the macOS dl_iterate_phdr emulation already lists from the relinker's program header metadata, so they now read it from there. With this, PPSA99666 relinked with --macos --to-rosetta starts on an M1, passes its launcher, loads doom1.wad and renders the episode menu over the demo through MoltenVK. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… and DOOM The six signed-zero failures only go away with a MoltenVK built on a SPIRV-Cross that has boykopovar#2704, which no MoltenVK release pins yet, and the rebuilt library is silently ignored when the SDK's copy comes first in DYLD_LIBRARY_PATH. Recording the build steps, the loading pitfall, the resulting 15 failures and the first title that renders keeps the results reproducible on another Mac. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two pipelines that conforming Vulkan drivers accept fail on Apple GPUs
through MoltenVK.
Raw 32-bit exports into integer targets: the 32_R, 32_GR, 32_AR and
32_ABGR export formats store the exported bits as they are, so the
recompiler declares a float4 output and a game may point it at an
R32_UINT or other integer target. Vulkan leaves the converted value
undefined but drivers store the bits; Metal refuses the pipeline
("output of type float4 is not compatible with a MTLPixelFormatR32Uint
color attachment"). ExportPackings now reports RawUint or RawSint for
an unpacked integer target, and the fragment output specialization that
already retypes 10_11_11 outputs bitcasts such an output to uint4 or
int4, which stores the same bits everywhere. Validation accepts the
retyped output with the signedness of the target; the existing check
that a 10_11_11 module is refused for an unpacked target now uses a
float target, since on an R32_UINT target a uint4 output is correct.
Uniform sample masks under per-sample shading: a uniform partial mask
went only to the pipeline's pSampleMask, which MoltenVK emulates with a
constant sample_mask output that Metal ignores when the fragment runs
per sample, so masked samples were written. When the pixel inputs
select per-sample shading the uniform mask now also goes to the
shader's existing per-quad mask path, and that path keeps only the
current sample's bit (SampleId) of the input coverage, which is all a
conforming driver reports there anyway while Metal reports the whole
pixel.
On an M1 with MoltenVK and SPIRV-Cross boykopovar#2704, front_face_all_bits and
sample_mask_multisample pass; the full suite has 576 of 590 passing and
all 640 non-GPU tests pass.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
After the integer target and per-sample mask fixes the suite is at 576 of 590 on an M1, and DOOM reaches gameplay in E1M1. The remaining failures are grouped by cause so the next work goes to the ones this tree can fix (host memory write-back, tessellation) and not to device limits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings the Codex and fork sessions' Metal work into the fork's main: the native Metal backend and KosmicKrisp assessments, the MoltenVK GPU results on an M1 (576 of 590 passing) with the 14 remaining failures classified, the SPIRV-Cross boykopovar#2704 MoltenVK build notes and the DOOM gameplay run. Its three code commits are already on macos/integration under other hashes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds macOS on Apple Silicon as a target of the online converter (Mach-O through Rosetta 2), so the fork's main carries the user-facing entry point together with the runtime it needs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The fork was 500 commits behind boykopovar/AnyPS5. Merging rather than rebasing keeps the published history and links valid. Conflicts, where both sides changed the same code: - Image registration: upstream split it into collectImagePages and registerImagePages and registers guest modules on demand. Its structure is kept; on macOS the main registration still reads the Mach-O segments, because dl_iterate_phdr there only reports relinked images, and per-module registration returns early for an image that registration already covers. - DoMprotect: upstream's on-demand module registration runs outside macOS; macOS keeps TrimToRegistered for dyld's 4 KiB slides. - DPP lane reads: upstream's EmitSubgroupShuffleInHalf is used, with the convergent store Metal needs when the host has subgroups. - Descriptor limits: the update-after-bind limits from this branch with upstream's detailed sampler limit errors. - GuestMemory test, BUILD.md and the libkernel debt: both sides kept. Upstream code that did not build on macOS: PF_R added to the macOS ELF types, the image search in DirectMemory and the link_map unregister in dlclose limited to the hosts that have them. ZArchive and zstd are new submodules. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Path resolution now asks the app archive whether a path is inside app0.zar, which locks the archive state's mutex. The state and the descriptor table were ordinary statics, destroyed while guest exit handlers still resolve paths. glibc keeps a destroyed mutex usable, so Linux never noticed; libc++ on macOS destroys it, and guest path calls during exit threw "mutex lock failed: Invalid argument" (guest_path_lifetime). They are now allocated once and never destroyed, like the path aliases and the working directory beside them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
connect on a listening stream socket must fail with EOPNOTSUPP whatever the address, as FreeBSD checks the listening state first. The runtime does that check, but asks the host through getsockopt(SO_ACCEPTCONN), which XNU rejects; the socket never looked like a listener, the address family check ran instead and returned EAFNOSUPPORT, and guest_socket_connect_listening failed. The state now comes from the kernel's so_options through proc_pidfdinfo, as getsockopt(SO_ACCEPTCONN) already does on macOS. The query lives in SocketOptions.cpp because libproc's headers define EVFILT_* macros that clash with Equeue.hpp in Udp.cpp. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… on macOS On FreeBSD and Linux, sceNetShutdown(SHUT_RD) on a datagram socket that was never connected still wakes a thread blocked in recvfrom, which returns 0, and later receives return 0 at once. Titles stop their network threads that way. XNU fails that shutdown with ENOTCONN and changes nothing, bound or not (measured), so the blocked thread never returned and guest_sce_net timed out. On macOS the read shutdown is now emulated when the host refuses it: the socket is bound to an ephemeral port if it had none and receives an empty datagram from a loopback sender, which wakes the blocked reader with 0, and later receives on that socket run without blocking and return 0 once nothing is queued. The shutdown still reports ENOTCONN, as Linux does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On Linux, libc.prx is the C++ runtime of both the host code and the guest, so a fatal host error (an exception leaving a noexcept export, an unhandled error on a runtime thread) reaches the terminate handler the title installed, which is how titles report fatal errors. On macOS host code keeps libc++abi, so such errors ended in libc++abi's own terminate and the guest handler never ran: guest_kernel_app_archive_mmap failed, and guest_itimer needed a special case in the alarm thread. libc.prx now installs a libc++abi terminate handler on macOS that rethrows the current host std::runtime_error or std::logic_error through libc.prx's __cxa_throw, so the guest's terminate path runs with it as the current exception, and calls the guest terminate directly for anything else. This covers every host thread, so the alarm thread's special case is removed, and the uncaught-exception report is again the "what():" form that guest_host_standard_error expects on every host. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… macOS Upstream added two checks at the top of sceKernelGetdirentries on Linux and Windows: a socket is EINVAL, and a file read from app0.zar throws not implemented instead of listing a placeholder descriptor. The macOS variant, which lists through a separate descriptor because APFS leaves d_seekoff at 0, is a separate function and did not get them, so guest_kernel_app_archive_archive failed on macOS. It now starts with the same two checks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 22, 2026
This was referenced Oct 22, 2026
This was referenced Oct 24, 2026
12 tasks done
This was referenced Oct 25, 2026
ycarogabriel-lgtm
added a commit
to ycarogabriel-lgtm/AnyPS5
that referenced
this pull request
Oct 25, 2026
Keeps the macOS port current with 260 upstream commits. - Draws whose pixel shader reads barycentrics take upstream's tessellation emulation when the device has no geometry shaders (the MoltenVK case); the emulation test keeps the fork's built-in path and only skips when none of the three paths exists. These resolutions are the ones the macOS pull request (boykopovar#7332) already carries. - Rect lists take upstream's multi-distance clip forwarding, so the fork's single-distance validation (f32[1]) is dropped; it refused the new arrays. - SpirvTarget keeps both the fork's fragmentBarycentricBuiltins and upstream's robustBufferAccess2; Time.cpp keeps both platforms' includes; the force-TLS-destructor test stays off macOS beside upstream's new inet address test; the new flexible memory tests run on every host. - GuestMath's Bessel references come from libm's jn and yn on macOS, whose libc++ has no C++17 special math functions. - The macOS relinker fixtures spell their attributes with [[gnu::]], as in the pull request, so check_conventions accepts them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ycarogabriel-lgtm
added a commit
to ycarogabriel-lgtm/AnyPS5
that referenced
this pull request
Oct 25, 2026
…on macOS
Relinked Mach-O modules bind every import by flat lookup, and dyld leaves images opened RTLD_LOCAL out of that lookup, while on the console and in ELF a module's dependencies resolve its imports whatever mode they were loaded with. sceKernelLoadStartModule and a plain dlopen open modules locally, so libfmodstudio could not find the libfmod it depends on ('symbol not found in flat namespace'), the load failed only through dlerror and both Planet of Lana (PPSA19450) and God of War: Sons of Sparta (PPSA28997) waited forever, as imellag traced on boykopovar#7332 and checked by opening modules globally.
On macOS the host dlopen now always uses RTLD_GLOBAL. The guest's own scope is unchanged: dlsym with the default handle skips the image of a module the guest opened without RTLD_GLOBAL, which GuestDynamicLoader now checks on every host. The remaining difference is in the libkernel debt file.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ycarogabriel-lgtm
added a commit
to ycarogabriel-lgtm/AnyPS5
that referenced
this pull request
Oct 25, 2026
…ocks from libc's own heap (@milescoviello) Brings the open upstream fix for the IL2CPP scripting heap hooks: without it God of War: Sons of Sparta (PPSA28997) ends with SIGSEGV at start-up through the IL2CPP free and abort chain, as imellag traced on boykopovar#7332, where boykopovar#6842 merged cleanly and its tests and the title check passed on macOS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ycarogabriel-lgtm
added a commit
to ycarogabriel-lgtm/AnyPS5
that referenced
this pull request
Oct 25, 2026
Keeps the fork's main on the same upstream base as the macOS pull request branch (boykopovar#7332), so the two do not drift apart and later community macOS merges resolve against current code. The merge was conflict-free here and leaves the code identical to the PR branch, including upstream's port-zero connect check, which the PR branch had to restore by hand after its boykopovar#7559 merge. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ycarogabriel-lgtm
added a commit
to ycarogabriel-lgtm/AnyPS5
that referenced
this pull request
Oct 25, 2026
…#7332 The fork's main had fallen behind the pull request branch on two fronts: the 169 upstream commits (53 on its first-parent line) since the last sync, and the commits made on the PR branch from the M4 Pro review (the precise wait capped at 6 ms of spin above 24 ms, the guest scope test loading a real .prx, the 0xfc0000000 range attributed to the macOS host rather than Rosetta) and the web converter's macOS batch fixes. Each conflict is resolved to the PR branch's version, which already combines upstream with the macOS paths, and the files the PR branch changed outside the conflicts are taken from it too. The relinker CLI now keeps --macos-fixed-base beside upstream's --patches and --verify-patches, and refuses it in verify mode like the other fixed bases. The code is identical to the PR branch afterwards; only the fork's own notes (docs/metal-exploration, the macOS validation section) differ. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ycarogabriel-lgtm
added a commit
to ycarogabriel-lgtm/AnyPS5
that referenced
this pull request
Oct 25, 2026
Brings the fork's main to the state of boykopovar#7332 after the upstream merges of today (main at d71853c), so the fork keeps the same code as the pull request. That includes the empty-vector write check living beside main's GPU flush in Stdio.cpp, the libkernel debt lines from both sides, and the multisample retirement test that skips storage promotion on devices without multisampled storage images. The fork keeps its own layout: the macOS validation section in TechnicalDebt.md and the guide under tools/macos/README.md, so the identical copy at docs/user/MACOS.md that the PR branch carries is removed here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ycarogabriel-lgtm
added a commit
to ycarogabriel-lgtm/AnyPS5
that referenced
this pull request
Oct 25, 2026
Keeps the fork's main on the state of boykopovar#7332 after it took 183 more upstream commits: the macOS build fixes main's new code needed (host stack pages, std::atomic<shared_ptr>, the main stack test), the retry of loopback connects XNU resets, worked out by jotitadev, and the GPU test fixes for MoltenVK. The fork's own notes and its guide under tools/macos stay as they were. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ycarogabriel-lgtm
added a commit
to ycarogabriel-lgtm/AnyPS5
that referenced
this pull request
Oct 25, 2026
Keeps the fork's main on the state of boykopovar#7332 after it took 118 more upstream commits: the serialization version that main's depth range remap and this branch's barycentric flag now share, the shutdown answers jotitadev traced on the M2 Max, and boykopovar#7706's refusal of branches into trapped GS instructions. The fork's own notes and its guide under tools/macos stay as they were. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
12 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
macOS on Apple Silicon as a host: relinked titles run as x86-64 Mach-O under Rosetta 2 and draw through MoltenVK. This branch brings the community's open macOS pull requests together on current
main, runs their test suites on an Apple Silicon Mac, and adds the fixes that only showed up once everything ran together. It is meant as one reviewable picture of the port; each part can still be taken from its own pull request, and I am glad to split it further, reduce it onto whichever of the overlapping PRs the maintainers prefer, or close it.Integrated pull requests (merged or cherry-picked, conflicts resolved against current
main)ci/macos-series-*): Mach-O TLS, main thread for AppKit, module info, memory protection and guest pages, MoltenVK device, AGC thread priority, single SDL audio, LoadExec (fix(libc): build the host-facing libc code on macOS #4627, feat(libkernel): sceKernelRaiseException on macOS hosts #4630, feat(libSceSystemService): LoadExec on macOS hosts #6248 and the rest of the series)mainPorted from #7201 (marion909's port; each commit is co-authored by @marion909, as @blawesom suggested reconciling the two)
forincrement and drops the header phi updates, which hung the GPUAPS5_DUMP_DRAW_SHADERdumps every stage of the draws that use one shaderexception_runtimenow runs on macOSANYPS5_VULKAN_LIBRARYNot ported from #7201, with the reason: AF_UNIX seqpacket pairs emulated over datagram sockets (XNU reports
ECONNRESETandEDESTADDRREQwhere FreeBSD's seqpacket gives EOF andEPIPE, so they stay refused as the debt file says);sendtowith an address on a connected UDP socket turned intosend(FreeBSD returnsEISCONN, whichguest_udpchecks); presenting from the host main thread and its own guest runtime base (this branch already has equivalent, tested paths from mugurc and yripper); the AvPlayer end-of-stream wake-up (generic logic gated on__APPLE__with no test that reproduces the problem).From the review and title runs on this PR (thanks @jotitadev and @imellag)
RTLD_GLOBALon the macOS host, because relinked modules bind imports by flat lookup and dyld leavesRTLD_LOCALimages out of it; this is what stopped FMOD Studio from loading in Planet of Lana and God of War: Sons of Sparta. The guest's owndlsymscope is unchanged andguest_dynamic_loadernow checks itprecise_waitnow passes 10 of 10 on the M1 (it was 3 of 6, and 0 of 10 on the M4 Pro)tools/macos/setup-game.shunwraps withtools/unwrap_self.py, which accepts both SELF magics, instead of a duplicate that refused0xEEF51454dumpsconnectthat getsECONNRESETis retried on a new socket put on the same descriptor, as @jotitadev worked out and measured (guest_refused_connect90/90 on his M2 Max against 0/30 without it); co-authoredshutdowncalls and ashutdownafter the peer closed answer as FreeBSD does, from @jotitadev's diagnosis and test; co-authoredguest_socket_read_write: the closed-peer write loop rides out XNU's asynchronous reset, from @jotitadev's root cause and test-only fix; co-authoredfmaon MoltenVK instead of SPIRV-Cross'soptnonehelper calls, as @imellag found and measured (menu 22.1 to 40.6 fps, GPU time per frame about halved in gameplay, eight fewer GPU failures); the commit (a243f0c93) is his change behind aSpirvTargetflag, as he proposedUpstream tests that only ran on Linux, now run on macOS
shm_open/shm_unlinkof named objects work on macOS as files in$TMPDIR/anyps5-shm(XNU's POSIX shm takes names of at most 31 characters and refusesfchmod,O_TRUNCand a secondftruncate);guest_named_shm_open,_lifecycle,_permissionsand_concurrencyrun there. Guestmmapof files and shm objects now uses the Linux path on macOS, andEBADFfor empty-vector writes on read-only descriptors matches the consolemprotectreportedENOENTinstead ofEACCES)sceLibcBacktraceGetBufferSize/sceLibcBacktraceSelfwork on macOS (guest_backtrace);exception_c_cleanupandguest_getlogin_no_sessionrun toocpu_topology,guest_image_anonymous,guest_module_infoand the ELF relinker execution tests read Linux-only interfaces (sched_getaffinity,/proc, ELF fixtures)Fixes added here (XNU and Apple libc++ differences, each with a test that failed before)
connectthat XNU resets on a full accept backlog is retried on a new socket put on the same descriptor (the retry @jotitadev worked out and measured, co-authored); a repeatedshutdown, or one after the peer closed, answers as FreeBSD does (his diagnosis and test, co-authored);SO_ACCEPTCONNthroughproc_pidfdinfo;shutdown(SHUT_RD)after the peer'sSHUT_WRand on unconnected datagram sockets; urgent TCP data reported topollthroughselect; datagram byte counts fromSO_NREADin kevent, fstat and ioctl, because XNU'sFIONREADadds the sender address; IPv4-mapped answers dropped from IPv6 lookupsmprotect;munlockallunlocks each recorded range; macOS AGC page checks cache the logical protection after write-watch handling, following the page generation and access serialacosfthrough double;mktimebefore 1900;fflushleaves reading streams alone; host terminations forwarded to the guest's terminate; statics that guest threads still use at exit kept alivegetdirentriesrefuses plain files withEINVAL, as upstream now requires--exclude-libs), so a program linking Mbed TLS keeps its own allocatorjn/yn, as Apple's libc++ has no C++17 special math functionspipe2, which the Xcode 27 SDK weak-links and macOS 26 lacks; the title launcher enables the nano allocator for Rosetta small allocations, withMallocNanoZone=0available for comparisondocs/user/MACOS.mdandtools/macosscripts to set up and launch a titleTASK_VM_INFO; sRGB storage images keep their UNORM format because Metal encodes stores to sRGB textures; the AGC driver memory that feat(agc): link calls through the AGC FS table #6160 maps at0xfe0000000is unavailable on this macOS host, so the driver starts without it and says so (AGC debt file)Known limits (in the debt files)
VK_KHR_shader_clock, so those GPU tests fail by design.Investigation notes (kept out of the repository): with MoltenVK 1.4.2, inline exact f32 FMA removes eight of the earlier AGC failures. The remaining failures in the last full run on the M1 were:
f32_constant_factor_tininessandf32_denormal_flush: Metal floating-point limitsshaderCullDistancetessellation: the instanced patch in column 0 does not take its colour from the relative patch indexpixel_interlock: MoltenVK does not compileraster_order_groupon an argument-buffer fieldrect_list_indirect: differs from the direct drawimage_plane_bias_on_single_level_volume: the device has no min/max sampler reductionpixel_sample_iteration: an attachment-less 4x draw runs the fragment shader per sample on MoltenVK although the Metal function asks for no sample inputagc_driver_pooled_buffer_rangefrom test(agc): load the Vulkan loader with portability enumeration on macOS #7886 exposes a MoltenVK robust-buffer read that returns stale pooled bytes; the test was previously skipped on macOSagc_driver_native_multisample_depthpath passes but reportsVUID-VkImageViewCreateInfo-imageViewFormatSwizzle-04465under Vulkan validation, because MoltenVK reportsimageViewFormatSwizzleunavailablecross_workgroup_flagremains timing-sensitive: its waiting workgroup reads coherently, while the other workgroup's GLC store becomes a plain Metal storeTitle runs by @imellag on an M4 Pro (details in the comments): Planet of Lana (PPSA19450) and God of War: Sons of Sparta (PPSA28997) stopped on the FMOD Studio load and, for God of War, the IL2CPP heap crash, both addressed above; with them they reach the menu and gameplay at about 10 and 15 to 27 fps, with background corruption that mostly follows the macOS write watch and is not solved here. ccleste (PPSA59322) stops on a pixel shader that reads barycentrics without a vertex shader before it, as in #5079. A native Metal backend and KosmicKrisp under a native arm64 host were assessed and are not part of this pull request.
Tested
Releasebuild withBUILD_TESTING=ONpassed atb5fddb65c, with upstreammainmerged through44e3389c8.8ee809880, the non-GPU suite (ctest -E "^agc|video_?out|flip|display" -j4) passed 842/843.patched_librariestimed out on the cold run and passed when repeated alone; the five focused host tests passed. The serial MoltenVK AGC suite passed 794/808. Eleven failures are established MoltenVK/M1 limits or the documentedpixel_sample_iterationgap;depth_bounds_stateandgraphicsexposed merge errors that were fixed, andsgpr_pattern_fill_keyspassed alone. The three fixed cases passed in a subsequent five-test run.43f0ba860, 13 focused tests passed:guest_interfaces_mac,guest_pthread_host_fault_mask,guest_raise_exception,guest_socket_read_write,guest_fstatfs,agc_driver_depth_bounds_state,agc_driver_graphics,agc_driver_pixel_barycentric_emulation,agc_driver_pooled_buffer_range,agc_driver_sgpr_pattern_fill_keys,agc_driver_stream_copy, and both gated-dispatch capture variants. After the subsequent seven-commit stdio merge, final headb5fddb65cbuilt successfully and 10 focused stdio, descriptor, exception and host-fault-mask tests passed. Full suites were run before the last two upstream merges; the final head has build and focused-test coverage, not a repeated full suite.FragCoordload follows Alexius0815's M4 validation. Neither title behavior nor M4 validation was reproduced on this M1.python3 tools/check_conventions.py --base origin/main: 0 errors.git merge-tree --write-tree HEAD origin/mainequals the committed tree.Checklist
main; no other open PR implements the same functions — it includes upstreammainthrough44e3389c8; it deliberately contains the open macOS PRs listed under Depends on and overlaps Macos port #7201, which ports macOS tooNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt filedocs/dev/debt/, without investigation attachmentsshaderFloat64test skips, credited to @MayankManas), fix(libc): build the host-facing libc code on macOS #4627, feat(libkernel): sceKernelRaiseException on macOS hosts #4630, fix(relinker): convert stack-guard and thread-pointer reads with an empty PT_TLS for macOS #6448, fix(agc): draw a last provoking vertex that no pixel input sees without the extension #6741, ci: run the macOS write watch and register context tests under Rosetta #3962, fix(relinker): lower ADCX and ADOX for Rosetta #7173, fix(relinker): preserve executable exports in macOS output #7361, test(relinker): run the macOS guest module argument check under Rosetta #7519, test(libc): check that the macOS guest arena keeps free space beside host regions #7634, fix(libkernel): recognize listening sockets on macOS hosts #7559, feat(libkernel): direct memory mappings on macOS hosts #7631, fix(relinker): refuse branches into trapped guest GS instructions on macOS #7706, test(agc): load the Vulkan loader with portability enumeration on macOS #7886, feat(libkernel): JIT shared memory on macOS hosts #7937, feat(libkernel): map files through the guest's mmap on macOS hosts #7974, feat(libkernel): process, thread and clock queries on macOS hosts #7804, feat(libkernel): UDP sockets and name resolution on macOS hosts #7850, fix(libc): let the macOS write watch fault handler go first #7695, fix(relinker): initialize MXCSR in macOS guest entry #7741, fix(relinker): ignore direct branch targets inside an instruction past its prefixes #7651, feat(agc): draw the last provoking vertex through the barycentric tessellation stages #7426, fix(agc): ignore Finder .DS_Store files in capture directories #7728, fix(tests): compare the Bessel exports with fixed reference values #7524 (contained here; merging any of them first only shrinks this branch; fix(relinker): report processor 0 from RDTSCP under --to-rosetta #6111, feat(libc): reserve the guest arena on macOS #6124, fix(agc): lower a fragment Layer input through the viewport index layer extension #6164, feat(libSceSystemService): LoadExec on macOS hosts #6248, fix(relinker): skip prefixed decodings inside an earlier instruction in the macOS TLS scan #6410, fix(relinker): rewrite ALU reads of guest TLS through %fs in macOS output #6419, fix(relinker): trap guest GS accesses in macOS output instead of refusing the module #6458, fix(agc): bind image and sampler tables through update-after-bind limits #6647, fix(libkernel_sys): build and check fchdir search permission on macOS #6667, fix(libSceLibcInternal): read statvfs by path on macOS #6668, fix(libSceNetCtl): read the default route from the routing table on macOS #6685, fix(libc): convert mktime before 1900 from the zone's own offsets on macOS #6686, fix(shader): interpolate 16-bit values with 64-bit integers on devices without Float64 #6767, feat(relinker): place macOS executables at a fixed base with --macos-fixed-base #6802, fix(libkernel): set the open file limit at load on macOS #6836, fix(libc): give the scripting heap hooks blocks from libc's own heap #6842, fix(libc): keep errno when strtol converts nothing on macOS #6853, fix(relinker): detect output aliases with a filesystem probe outside Windows #6927 and fix(tests): keep generic category vtable entries castable to functions #6969 are already inmain), and Macos port #7201 and feat(aot): consolidate native ARM64 compiler, runtime and consumers #5021 (overlapping ports and consolidations, per the overlap comment)🤖 Generated with Claude Code