Skip to content

Merge upstream/main (2481 commits, up to f5bba246ce) into the macOS port - #238

Open
utkuhalis wants to merge 2482 commits into
mainfrom
merge/upstream-2026-12-06
Open

utkuhalis wants to merge 2482 commits into
mainfrom
merge/upstream-2026-12-06

Conversation

@utkuhalis

Copy link
Copy Markdown
Collaborator

Brings boykopovar/AnyPS5 main from 809a271 (where #209 stopped) to f5bba24: 2481 commits, with the fork's macOS changes kept on top. The reason for this merge now is upstream boykopovar#27590 (be0dc25, "fix(libkernel): place the AMM ranges in a reserved window outside the guest arena"), which removes the GTA VI start-up abort fixed mapping ... overlaps a registered guest allocation. tools/dev/merge-checks.py reports 0 problems (165 C/C++ files both sides changed), on the work tree before the commit and on the merge commit.

boykopovar#27590 on macOS

  • Upstream reserves the 512 GiB AMM window at 0x80000000000 in Arena::SeedHostUsedRanges, which is shared by Linux and macOS. On macOS its ReserveNoReplace is the mach_vm_map(VM_FLAGS_FIXED, VM_PROT_NONE) path the guest arena already uses, so upstream did not leave macOS out and nothing had to be ported for the reservation itself. If the host cannot reserve the window, sceAmprAmm* throws with the OS error, as upstream does.
  • Apr.cpp: the fork's "no guest arena (macOS)" fallback, which put the AMM range wherever the host placed it, is replaced by upstream's window. It dates from before the macOS guest arena existed; since then GuestArenaRange never returned a zero base on macOS.
  • DirectMemory.cpp PlaceMapping: the arena-containment check (now upstream's GuestArenaFixedTarget) stays Linux-only, as before. On macOS the fixed branch calls GuestArenaRequireMapperAccess instead, so a title's own fixed map into the AMM window stops with NotImplemented there too (upstream does the same on Windows before its no-overwrite walk). A fixed map that the arena contains, now including the window, is marked used and committed in the arena on macOS as before.
  • PosixMemory.cpp: upstream's GuestArenaRequireMapperAccess for fixed anonymous maps runs on every platform; the containment check stays Linux-only and macOS keeps its page-zero check.
  • guest_amm_placement was skipped on macOS (if(NOT APPLE), from the time before the macOS arena). It now builds and runs there as upstream has it (skip code 77 when the window is not reserved), so CI shows whether the window reserves under Rosetta.

Conflicts (67 files)

File Kept from the fork Taken from upstream
libc/include/GuestArena.hpp GuestArenaBeginImportWrite and HostWrite(…, Import) GuestArenaTryBeginHostWrite, HostWrite::Try (4131f51), the AMM mapper window declarations
libc/src/GuestArena.cpp APS5_NO_HOST_WRITE_FLUSH, TraceHostWrite, the BeginHostWrite/BeginImportWrite split Both sides refused a macOS host write over a read-only watched page. Upstream's check (93edeb5) now runs in GuestArenaBeginHostWrite before the import part, so the fork's partial-write handling in the write watch only sees direct GuestWriteWatchBeginHostWrite callers
libc/include/GuestWriteWatch.hpp, libc/src/GuestWriteWatch.cpp BeginUntrapped and its detached trap resolution (#226, #233), OpenImport/CloseImport, HostWrites, ChainSignal, the lock sites, the host write that leaves unwritable pages alone and opens the writable ones compared (openCompared, #213, #216), resolveDetached with DetachedSlots and _resolverRunning TryBeginHostWrite and openHostWrite (4131f51), which now hold the fork's partial-write body; BeginOwnStore/EndOwnStore and the fault-ahead stop at a driver's own store (422efbb). Both sides added resolveDetached: the fork's is kept and takes upstream's skip of a page already queued. Upstream's new Lock uses get the fork's lock sites (SiteBeginHost, SiteEndHost)
libSceAgcDriver/Execution/src/GuestMemory.cpp HostWrite::Try in ImportWatched (both sides built the refusal of an import over read-trapped pages: the fork in #226/#233 for #201 via UntrappedImport, which stays, upstream in boykopovar#26221); std::min<std::size_t> in CompareMapped (both fixed the same type mismatch). The hook Try calls is a no-op there (OwnHostWrite), so the fork's reason for Import no longer applies; Import is now unused
libc/include/GuestAllocations.hpp GuestAllocationsHeldByThisThread GuestAllocationsMapGeneration
libkernel/DirectMemory/DirectMemory.cpp MapPlaced(kind, …) with its failure trace (#199), PlaceMapping, the macOS fixed-mapping path GuestArenaFixedTarget (Linux only, see above), MapAligned's watch argument and !InMapperWindow for reservations
libkernel/DirectMemory/PosixMemory.cpp The macOS branch (no containment check) GuestArenaRequireMapperAccess, GuestArenaFixedTarget on Linux
libkernel/Apr/src/Apr.cpp The AMM range in the mapper window (boykopovar#27590)
libSceAmpr/CMakeLists.txt guest_amm_placement on every platform, SKIP_RETURN_CODE 77 TIMEOUT 60
libs/tests/GuestAmpr.cpp The range lies above the user arena
libs/tests/guest_arena/CMakeLists.txt exhausted mapper-window
libc/include/General.hpp, libc/src/General.cpp UnresolvedImport_nid_no_patch GuestFault_nid_no_patch, GuestFaultAt_nid_no_patch
libc/include/specifics/itanium/CxxAbi.hpp Both added libstdc++'s __sub_kind values; upstream's enum (same values)
libc/src/specifics/linux/CrashReport.cpp The 16 bytes at rip for SIGILL Upstream moved the rip report out of ReportRegistersAndStack; the fork's byte dump moved with it
libc/src/specifics/windows/CrashReport.cpp HandleCacheFlush HandleClzero, after it
libkernel/System/src/Exception.cpp HostRip, mainImage and the early write watch start on macOS SiginfoFault(const Fault&) (the macOS call sites use it too), FaultAction()
libkernel/Socket/src/Udp.cpp NoteConnectError on macOS, the INADDR_ANY comment DroppedTcpConnection (a9af1f2): a reconnect after a dropped connection returns ECONNREFUSED; it is checked first, then the fork's never-connected EISCONN case
libkernel/Time/Time.cpp Both fixed CLOCK_THREAD_CPUTIME_ID under Rosetta; upstream's unit probe (HostMachThreadCpuNanos) replaces the fork's thread_info reader
libSceNet/Export.cpp Player (p2p) bind, the virtual-route receive paths, UnmodelledPeerDescriptor NET_SOCKET_BUFFER_LIMIT/RESERVATION_LIMIT (the fork's NET_SOCK_RAW stays where it moved), the multicast stream bind refusal, zero-length receives, MSG_WAITALL (ReceiveAll), the #endif upstream dropped in ReceiveMessage
libSceNpManager/Export.cpp The Online::Call wrappers, requestResults, the sign-in helpers RequestKind and liveRequests as a map; sceNpPollAsync refuses a sync request with INVALID_ID
libSceUserService/Export.cpp, libSceAppContent/Export.cpp <algorithm>, DiskAddons.hpp GuestArena.hpp, File.hpp, KernelStatfs.hpp
libSceFont/src/Text.cpp Both stepped text characters by cluster; upstream's guarded ReadCharacter/ClusterStart replaces the fork's PrevTextCharacter/NextTextCharacter (removed, unused)
libSceFreeTypeOl/Export.cpp FT_Attach_Stream_nid_postfix. The fork kept the old stub off macOS because the bundled FreeType's own symbols were exported; the library now exports only *_nid_* on macOS (25832a5), so there is one export of that NID
libSceVideoOut/src/PadInput.cpp Every joystick is opened controllerSubsystem = true
libSceVideoOut/src/VideoOutDriver.cpp hdrProbe.Poll on the main thread The headless surface attach
libSceVideoOut/tests/PadSdl.cpp stick0 The shared PadInput subsystem check, before it
libSceAgc/DcbState/src/Display.cpp, libSceAgc/Acb/src/Control.cpp WriteFlip, shared by DCB and ACB The unregistered video output refusal, now in WriteFlip
libSceAgc/tests/Commands.cpp testAcbFlip (runs while the outputs are registered) testUnregisteredFlipHandle after unregisterOutputs
libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp The skipped mesh draw without mesh shaders, the mesh pass-through vertex stage The late-test merge split (DrawVerdict::Split), splitPrepare
libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp LeaveOutTableCallee and the unlinked callees it leaves out, traced.descriptorAddress LinkedTableCallees, the !split record flags, SplitTableCallMaxCalleeBytes (counted outside the fork's try block)
libSceAgcDriver/Graphics/include/Pipeline.hpp BarycentricPatchStages ReadsFrontFacing
libSceAgcDriver/Graphics/include/ShaderResources.hpp, Graphics/src/ShaderResources.cpp The [draw-bindings] profile, writeDrawSets returning its write count and timings, the previous draw's sets reused Upstream dropped selected for Snapshot::allocation (bb1670a). The reuse check now compares each snapshot's allocation, and lastDrawSelected is gone
libSceAgcDriver/Graphics/include/VertexInput.hpp IndexedFetchRecords, RedirectIndicesPastRecords, LastVertexFirstList SoloZeroPaddedFetchIndices with binding ends
libSceAgcDriver/Graphics/src/Draw.cpp inputs.emulatedMesh == nullptr in the recipe check Multisampled recipes when every target is multisampled
libSceAgcDriver/Graphics/src/GuestSamplerResource.cpp The UnrenderableDraw wrapper The S# words in the message
libSceAgcDriver/Graphics/src/Recorder.cpp WrittenSince OnValidated
libSceAgcDriver/Graphics/src/Sampler.cpp validateSampler with refuseSampler, the LOD bias clamp The min/max reduction with a linear mip filter check, added to validateSampler
libSceAgcDriver/tests/Recorder.cpp, tests/execution/F16ScalarArithmeticNan.cpp, tests/execution/SampleMultisampleTarget.cpp Both reworded the same skip lines; upstream's
libSceAgcDriver/tools/ShaderReplay.cpp --relaxed Wide-character arguments (arguments)
shader/recompiler/ControlFlow/src/RequestSerializer.cpp The fork's fields (subgroupStages, meshAsCompute) Upstream's versions 65 (windowSelects) and 66 (eleven target and context flags). The fork's fields move to version 67, after them
shader/recompiler/tests/RequestSerializerTests.cpp, libSceAgcDriver/tests/ShaderMemory.cpp StripForkTail/stripForkTail, now from 67 to 66, also on upstream's new decodes (VerifySampleContexts, VerifyReplayOptions, the version 65 checks, VerifySplitState) Upstream's Version65Bytes/Version64Bytes and its version 66 cuts (- 26u). The "unsupported version" probes move to 68
shader/recompiler/SpirvBackend/src/SpirvEmitter.cpp singleLane, singleSampleImages windowSelectsRequested
shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cpp The single-sample size query The level range check (levels, inRange)
shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvModuleSetup.cpp meshAsCompute narrowImageAtomicLocks
relinker/elfpatcher/include/elfpatcher/macos/MacOsMachOPatcher.hpp The class comment DefaultFixedBase
relinker/elfpatcher/src/macos/MacOsGuestModuleWriter.cpp, MacOsMachOPatcher.cpp The weak fallback binds of unresolved function imports (Fallbacks) PlatformTlsResolverImports, and the executable's __tls_get_addr import bound to Aps5GuestTlsGetAddr_nid_no_patch (5237bf4)
relinker/relinker/src/guest/GuestModuleBuilder.cpp The two-argument declaresHost (macOS stub exports) --executable-module (d1ecb3c). The fork's guestModuleImport also counts an import from a module bound to the executable, so those imports keep their plain NID as upstream keeps them
relinker/relinker/tests/test_macos_output.py LOAD_RVA, the segment-limit fixtures IMAGE_BASE = 0x3F0000
libcurl/CMakeLists.txt The deployment target for the backend build, the comments The `
libs/tests/GuestAgcDriverResources.cpp, GuestShmOpen.cpp, GuestSystemService.cpp, libSceIcu/tests/DataMemoryClose.cpp Their includes and declarations Theirs, both kept
libSceNKWebKit/tests/HistoryItem.cpp Upstream dropped the buffer-reuse check the fork had kept off macOS
tools/frame_capture_minimize.py The return on macOS EPERM Both handled macOS EPERM; upstream polls until its deadline, which a group of unreaped zombies never passes, so the fork's return stays
README.md The fork's title
docs/dev/ENVIRONMENT.md APS5_GUEST_COPY_SYSCALL on macOS APS5_HANG_DUMP_SECS on Linux
docs/user/USAGE.md The macOS app packaging paragraph, the Linux rip bytes sentence The install_name_tool text, cache flushes as NOPs on every relink

Upstream behaviour the fork now has

  • macOS executables load at 0x400000 by default (df1aab2, upstream fix(relinker): load macOS executables at 0x400000 by default boykopovar/AnyPS5#24967), with a no-access __APS5LOW reserve up to 4 GiB. It came in without a conflict in MacOsImage.cpp and Conversion.cpp. The fork's packaging and launcher pass no --macos-fixed-base, so every relinked title moves from 0x140010000 to 0x400000; the macOS guest arena starts at 0x200000000, above the reserve. Upstream measured it on macOS 27 / M4 (94 homebrew titles, DOOM Native Port).

On our side

  • Launcher parity: upstream added the relinker option --executable-module <name>. It joins withValue in tools/macos/launcher/Sources/AnyPS5Core/CustomOptions.swift. AnyTogether/AnyPS5-Desktop lib/core/custom_options.dart needs the same line in a PR there.
  • No line was added to ctest-known-failures.txt.

CI

  • Pending.

oneandonlydean and others added 30 commits December 6, 2026 14:11
…vice-displaysafearea-unmapped

docs(libSceSystemService): record the valid-buffer and unmapped-pointer results of sceSystemServiceGetDisplaySafeAreaInfo on firmware 11.60
…r-profile-dirty-state

fix(input-mapper): track unsaved profile title IDs
…queuelevel-depth-measured

docs(libSceAudioOut): record the queue level and result of sceAudioOut2ContextGetQueueLevel at full depth
…sfs-mount-retry

fix(libSceUsbStorage): mark sysfs device seen only after valid mount probe
fix(libkernel): sceKernelUuidCreate returns a time based version 1 UUID
…ll-descriptors

test(agc): skip the null image size check without nullDescriptor
…n-memory-decode

test(shader): pin the fields GCN SMRD, MUBUF and MIMG keep in RDNA
…am-broadcast

fix(libkernel): keep the socket options Winsock refuses for a socket type, as FreeBSD 11.4's sosetopt does
…ows-pipe-sigpipe

fix(libkernel): raise SIGPIPE for a Windows write to a pipe without a reader, as FreeBSD 11.4's dofilewrite does
…cos-rename-over-unreadable-dir

fix(libc): replace an unreadable empty directory on rename on macOS
…ide-store-32bit-ea

fix(relinker): guard wide-store 32-bit spill frame and test 4 GiB boundary
…length-changing-rewriter

feat(relinker): adjust relocations, FDEs, and jump tables on length-changing rewrites
…ped-bytes

fix(tools): count skipped frame replay bytes exactly
…ounter-from-main

test(agc): bound the PM4 system counter by the time since main
…utline-reverse-check

fix(libSceFreeType): match the console for FT_Outline_Reverse and FT_Outline_Check
…n-scalar-decode

test(shader): pin GCN SOP1, SOPC and SOPP decoding
…n-vop1-export-decode

test(shader): pin GCN VOP1 and export decoding
…rst-lane-table-column-addend

test(shader): plan an image table column from first-lane offsets through a select
fix(libkernel): read a socket number as closed while its close releases it
…t-fault-pointers

fix(libcairo): fault context pointers that Cairo dereferences
…an unchanged tail

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…everse

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…missing-vulkan-loader

fix(video-out): skip tests without Vulkan loader
…x-stringbuf-getter

feat(libc): implement libc++ string buffer contents getter
…-thread-cpu-time

fix(libkernel): read the calling thread's CPU time in nanoseconds on macOS
…-recipe

fix(libc): record a repeated ANYPS5 variable once in the run recipe
…x-wide-string-grow

feat(libc): implement libc++ wide string growth
…-fix-agc-keep-read-trapped-pages-in-linux

fix(agc): keep read-trapped pages in Linux frame captures
…ate-console

docs(debt): record that a PS5 does not check the key pointer of pthread_key_create
oneandonlydean and others added 30 commits December 7, 2026 00:36
…er-load-addressing

test(hw-oracle): probe buffer swizzle and lane-adjusted addressing
* feat(libSceLibcInternal): implement inet_neta
* test(libSceLibcInternal): cover the inet_neta buffer boundary
* fix(libSceLibcInternal): restore the full ISC notice in inet_neta
* ci: rerun checks
* fix(libSceLibcInternal): report inet_neta EMSGSIZE through the guest errno

Co-authored-by: Dean <158058829+oneandonlydean@users.noreply.github.com>
…siginfo-sigfpe-faults

feat(libkernel): run SA_SIGINFO SIGFPE handlers for guest divide errors, as FreeBSD 11.4 does
…play-cache-diagnostics

test(agc): show what the replays logged when the cold pipeline check fails
…opovar#28126)

* fix(tools): read frame replay logs up to the recipe's log bound
* fix(tools): parse the host report without keeping every log line
…-environment

fix(tools): recognize literal SwitchOn environment reads
…er-store-formats

test(hw-oracle): probe buffer store conversion and bounds
…fios2-archive-mount-throw

fix(libSceFios2): throw from the archive mount exports and record the cache decisions
…oykopovar#27887)

* fix(shader): emulate image atomics on 8- and 16-bit integer texels
* fix(shader): offer no multisampled mode for 8- and 16-bit image atomics
* test(agc): check narrow image atomics on two neighbours of one word and from one lane
* docs(shader): state that narrow image atomics are not atomic against plain image stores
* fix(shader): keep helper invocations out of texel and qword lock loops
* test(agc): run narrow image atomics in whole quad mode with helper lanes
* test(agc): skip the pixel helper image atomics test without formatless storage image access
…e-load-formats

test(hw-oracle): probe image load formats and destination selection
fix(libSceLibreSsl3): report OCSP_resp_find_status guest-input throws as faults
…bressl3-reject-oversized-x509-der

fix(libSceLibreSsl3): reject oversized X509 DER inputs
…erence-array-constants

fix(tools): resolve environment names held in character array constants
…erence-suffixless-names

fix(tools): read computed environment names that end with to_string
…-executable-dtpmod64

fix(relinker): resolve an executable's dynamic TLS in macOS output
fix(relinker): preserve RELRO with nonconflicting lazy slots
…udit-safe-wrappers

fix(tools): recognize checked guest copy wrappers
…etbuf

feat(libc): configure narrow libc++ filebuf storage
…ntries

fix(agc): look up guest ranges and residency only for memory-address fault entries
…eline-present-title-text

fix(trace_timeline): escape invalid XML characters in present titles
…ace-address-bare-cr-lines

fix(memory_trace_address): count only line feeds as line breaks
…rt-pending-fragments

fix(debt_report): apply pending debt fragments
…nter-audit-more-dereferences

fix(guest_pointer_audit): report dereferences after more operators and else
…nter-audit-restrict-parameters

fix(guest_pointer_audit): accept restrict and volatile after the asterisk
…n-sync-long-pathspec

fix(check_main_sync): query merged pull requests in path chunks
…ence-named-defaults

fix(env_reference): read integer readers whose default is not a literal
…dit-extended-path

fix(import_audit): keep already-extended Windows paths unchanged
Brings boykopovar/AnyPS5 main from 809a271 to f5bba24, with the fork's macOS changes kept on
top. Conflicts were resolved keeping both sides; the PR description lists each one.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.