Commit Graph
2114 Commits
Author SHA1 Message Date
Dean b2620e56d1 Merge pull request #11733 from verusferro/feat/libc-wide-string-to-number
feat(libc): convert wide strings with _WStoull, _WStoll, _WStod, _WStof and _WStold as the console's libc does
2026-11-02 00:33:30 +13:00
Dean 4d58a666e9 Merge pull request #12892 from StoneDC/b41/wide-length-protected
test(libc): bound UTF-16 length scans with protected pages
2026-11-02 00:23:34 +13:00
Adrià 26fa1212b8 Merge pull request #13819 from Ninot1Quyi/fix/libc-nearbyint-inexact
fix(libc): match nearbyint inexact flags to guest libc
2026-11-01 09:56:57 +01:00
Adrià 5c9837bfe7 Merge pull request #13442 from Gonic0/feat/libc-write-watch-read-trap
feat(libc): trap guest reads of write-watched pages on macOS
2026-11-01 09:13:34 +01:00
Adrià 53fbe59956 Merge pull request #13732 from SnekPolylepis/feat/libc-radix64-conversions
feat(libc): implement a64l, l64a, and l64a_r radix-64 integer conversions
2026-11-01 08:30:07 +01:00
Qu Yi 4a65ddf97c chore(libc): synchronize nearbyint fix with main
Preserve the nearbyint implementation and regression coverage while incorporating current main. The write-watch registration prerequisite is now part of main.

Validation: freshly compiled production MathExact.cpp regression passes; ASan/UBSan passes with detect_leaks=0. The same fixture compiles against main Math.cpp and fails at the FE_INEXACT assertion (exit 134). Conventions, whitespace and 235 script registrations pass. Full product build and full CTest were not rerun for this synchronization.
2026-11-01 14:56:40 +08:00
Dean 0b2c52e9c2 Merge pull request #12597 from JJenkx/windows/libc-fopen-s-constraints
fix(libc): report fopen_s and freopen_s argument errors to the constraint handler
2026-11-01 19:48:43 +13:00
Adrià 21e65cc7b3 fix(libc): keep write-watch fault-ahead off read-trapped pages 2026-11-01 07:33:03 +01:00
Nicolas GonzalezandClaude Opus 5.5 671c14acba fix(libc): bound untrapped read retries per untrap when the cache spills
The per-thread retry entries are a 64-entry cache. More threads faulting in
turn on a page whose protection does not explain the fault evict each
other's entries before their next attempt, so each count restarted at 1 and
the faults were retried forever. Retries between two untraps are now also
counted in total, up to 64 times the per-thread budget.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-01 07:33:03 +01:00
Nicolas GonzalezandClaude Opus 5.5 fb1f80fb38 feat(libc): make a read trap of an already trapped range a no-op
A caller that traps the same range at every label then needs no record of
its own of which ranges are trapped, which registering memory again could
leave stale.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-01 07:33:03 +01:00
Nicolas GonzalezandClaude Opus 5.5 586445642d fix(libc): count retries of untrapped read faults per thread
A fault that reaches the handler after its page was given back is retried.
The budget for that was shared by every thread faulting on the page, so the
17th delayed reader of one untrap was passed on as a crash. Each thread now
has its own budget per page and untrap, which still bounds a fault the page's
protection does not explain.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-01 07:33:02 +01:00
Nicolas GonzalezandClaude Opus 5.5 6b16f90d5a feat(libc): trap guest reads of write-watched pages on macOS
GuestWriteWatchTrapReads takes all access to the pages of a range until
the resolver set with GuestWriteWatchSetReadTrapResolver has run for it.
A fault on a trapped page waits while the resolver runs on the watch's
own thread; host writes and GuestWriteWatchProtect run it first on the
calling thread. Collections keep trapped pages inaccessible, and
registering or unregistering memory drops its traps.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-01 07:33:02 +01:00
Dean db8825e4b6 Merge pull request #7938 from JJenkx/perf/guest-arena-prefix
perf(libc): skip the known occupied guest arena prefix
2026-11-01 19:17:49 +13:00
Dean 803889adab Merge pull request #8937 from UnhealthyKraken/feat/libc-fesetenv
feat(libc): implement fesetenv
2026-11-01 19:16:41 +13:00
SnekPolylepisandClaude Opus 5.5 23bff0dd7d fix(libc): match FreeBSD a64l and l64a_r, use HostThreadLocal for l64a
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-01 00:18:47 -05:00
Nicolas GonzalezandClaude Opus 5.5 132bceac18 Merge remote-tracking branch 'upstream/main' into perf/libc-write-watch-fault-ahead
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-01 00:49:29 -03:00
Dean 88b7503129 Merge pull request #10222 from JJenkx/windows/libc-expm1f-msun
fix(libc): compute expm1f with FreeBSD msun's algorithm, as titles' libc.prx does
2026-11-01 14:57:48 +13:00
Qu Yi 4c41442276 fix(libc): match nearbyint inexact flags to guest libc 2026-10-31 15:51:17 +08:00
Nicolas GonzalezandClaude Opus 5.5 2c15fa59b4 fix(libc): keep write-watch fault-ahead inside the faulting page's 64 KiB block
libSceAgcDriver decides per 64 KiB block whether a pending storage image
keeps the CPU's bytes. A window that ran into the next block marked it
CPU-written and dropped the GPU results there (agc_storage_write_back,
agc_idle_publish_wait, array layer and depth plane tests).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 02:32:46 -03:00
Zain 6b358fe4b4 fix(libc): use guest long width for radix64 exports 2026-10-30 22:24:05 -05:00
Zain 02bcf26141 feat(libc): implement a64l, l64a, and l64a_r radix-64 integer conversions 2026-10-30 21:54:02 -05:00
Nicolas GonzalezandClaude Opus 5.5 54080056ff perf(libc): unprotect the pages ahead of a sequential write fault on macOS
A guest thread that writes a large watched range in order takes one
write-watch fault per page. Under Rosetta 2 each fault is a Mach
exception round trip. When the two pages before the faulting one were
written since the last collection, the handler now unprotects up to 32
pages from it that have the same protection and records them as
written. APS5_WRITE_WATCH_FAULT_AHEAD sets the count; 0 or 1 keeps one
page per fault.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 23:13:12 -03:00
Adrià 21a556f567 Merge pull request #12553 from JJenkx/codex/libc-unscaled-hex-parser-20261028
fix(libc): match unscaled hexadecimal Dinkumware conversion
2026-10-30 21:24:48 +01:00
Adrià 3465fa32fc Merge pull request #13025 from JJenkx/fix/libc-stream-scan-eof-errno
fix(libc): preserve errno on stream scan input exhaustion
2026-10-30 16:29:12 +01:00
Adrià 91cd8ac6fd Merge pull request #13049 from JJenkx/fix/libc-character-scan-lengths
fix(libc): ignore non-wide lengths on character scans
2026-10-30 16:25:56 +01:00
Adrià d6401d794e Merge pull request #13105 from Queuse/codex/test-memccpy-boundaries-20261029
test(libc): guard memccpy stop boundaries
2026-10-30 15:08:47 +01:00
Adrià 280bbad426 Merge pull request #12659 from JJenkx/codex/libc-scaled-nan-subject-20261028
fix(libc): parse scaled NaN subjects without numeric conversion
2026-10-30 13:45:37 +01:00
JJenkx a87ce79892 perf(libc): skip the known occupied guest arena prefix 2026-10-30 08:14:30 -04:00
Adrià cc7e348334 Merge pull request #12524 from JJenkx/codex/libc-unscaled-hex-range-20261028
fix(libc): preserve errno for unscaled hexadecimal range results
2026-10-30 13:05:20 +01:00
Dean 99f7b51d2b Merge pull request #12541 from oneandonlydean/licence-notices-ported-code
docs(libc): add upstream licence notices to ported math and siglist code
2026-10-31 00:50:17 +13:00
Adrià 8304ccaedb Merge pull request #11341 from SteelCrab/review/emscripten-libraries
build(libs): support Emscripten memory64 compilation
2026-10-30 12:49:20 +01:00
JJenkx 250f5b51de fix(libc): integrate expm1f on refreshed tanhf parent 2026-10-30 07:33:46 -04:00
JJenkx a06ed844e3 fix(libc): integrate current main into tanhf port 2026-10-30 07:32:57 -04:00
Adrià c547272c4c Merge pull request #13057 from JJenkx/fix/libc-short-stream-character-scans
fix(libc): retain short stream character scan fields
2026-10-30 11:43:01 +01:00
Adrià 20b386bd89 Merge pull request #13012 from JJenkx/fix/libc-scan-eof-errno
fix(libc): preserve errno on string scan input exhaustion
2026-10-30 10:42:10 +01:00
Adrià b3773d1a18 Merge pull request #12589 from JJenkx/windows/libc-strerror-s-constraints
fix(libc): report strerror_s violations as titles' libc.prx does
2026-10-30 10:19:26 +01:00
Adrià 1764ec5c60 Merge pull request #12420 from JJenkx/windows/libc-swscanf-ranges
fix(libc): read swscanf scanset ranges and string lengths as titles do
2026-10-30 07:16:41 +01:00
Adrià 49788dbb70 Merge pull request #12435 from plexerPK/codex/macos-write-watch-truncation
fix(libc): forward writes to truncated macOS mappings
2026-10-30 06:41:06 +01:00
Adrià 0362b1521c Merge pull request #12861 from heditrigui/feat/libc-recallocarray
feat(libc): implement recallocarray
2026-10-30 06:36:10 +01:00
Adrià 0a2cda921d Merge pull request #12933 from heditrigui/feat/libc-dprintf
feat(libc): implement dprintf and vdprintf
2026-10-30 06:33:00 +01:00
Adrià 84368bddb2 Merge pull request #12160 from AlexFigas/feat/libc-pmr-resources
feat(libc): provide the pmr new-delete, null and default memory resources
2026-10-30 06:30:55 +01:00
Adrià 902c6ebfe9 Merge pull request #12111 from wanderingbug/cursor/upstream-macos-unwind-e22f
fix(libc): walk the Mach-O compact unwind index
2026-10-30 05:52:53 +01:00
Adrià b48afc66fb Merge pull request #12845 from heditrigui/feat/libc-qsort-r
feat(libc): implement qsort_r
2026-10-30 05:52:07 +01:00
Adrià 84e114e4eb Merge pull request #12715 from MarcZX10/feat/log-to-file
feat(libc): copy the runtime log into a file with ANYPS5_LOG_FILE
2026-10-30 05:51:34 +01:00
JJenkx 1768c1821b fix: integrate current main into PR #12597 2026-10-29 23:20:02 -04:00
JJenkx 58fddd82c6 fix: integrate current main into PR #12659 2026-10-29 23:20:02 -04:00
pista 98248606d4 fix(libs): reject host region release on WebAssembly 2026-10-30 10:50:58 +09:00
pista baedb114f9 test(libs): build Emscripten adapters and check guest long doubles in CI 2026-10-30 10:50:57 +09:00
pista d64e85164b build(libs): let the system libraries compile with Emscripten
Emscripten targets wasm64 without x86 assembly, Linux-only headers or the
x87 long double. These changes add __EMSCRIPTEN__ paths beside the host
ones; native builds compile the same code as before.

- libc: long doubles in guest varargs and scanf go through
  GuestLongDouble, a plain copy where long double is the x87 format;
  APS5_EXPORT emits no assembler alias; the guest arena is one aligned
  allocation that zeroes pages when they are committed again; getifaddrs
  keeps its link-level entries on Linux; /proc lookups and the host
  stderr duplicate are left out.
- libkernel: file-backed mmap, EVFILT_VNODE watches, getcontext and
  setcontext throw; getdents replaces the raw getdents64 syscall;
  getdtablesize takes the resource limit alone.
- VideoOut leaves SDL, the display window and the HDR probe out,
  Sysmodule asks libkernel for unwind information and Net includes
  sys/time.h.
2026-10-30 10:50:57 +09:00
Dean 99b571f879 Merge pull request #11468 from valenciana-nc/fix/guest-heap-header-validation
fix(libc): validate guest heap block headers before freeing
2026-10-30 14:50:19 +13:00