fputws and wprintf write a UTF-16 surrogate pair as one four-byte
UTF-8 sequence, but fgetwc decoded that sequence into a single code
point above 0xFFFF, which is not a 16-bit guest wchar_t value, and
fgetws stored it truncated: fputws(u"A\U0001F600\n") read back as
A, U+F600, newline.
fgetwc now returns the high surrogate and keeps the low one in the
stream for the next read, so fgetws stores the pair, also when the
buffer fills between the two halves. A successful seek discards it,
as FreeBSD's fseeko resets the stream's mbstate. Sequences that
decode to an overlong form or above U+10FFFF, and lead bytes F8 to
FF, fail with EILSEQ instead of returning made-up characters; the
three-byte surrogates that fputwc writes for a single unit are still
read back as that unit.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QegaHM5QeCynUQ2ZLWHE4b
For |x| > 1, the infinities and NaN, titles' libc.prx stores EDOM and
raises FE_INVALID from acosf, quiet NaN included, and asinf also
raises FE_INVALID for a quiet NaN. acosf returned the same NaN bits
without either, and asinf set errno but raised nothing for a quiet NaN.
Both now call _Feraise with the invalid exception, which stores EDOM
and raises the flag in both units; the results are unchanged.
The acosf test asserted the old errno-preserving behaviour from a
FreeBSD reading; it now checks the titles' EDOM and FE_INVALID.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The explicit binary exponent stopped accumulating near 1e9 while the
digits add 4 per character without bound, so a subject with a few
hundred million digits was classified against the wrong exponent:
0x1 followed by 3e8 zeros and p-1200000005000 kept errno, and a long
zero fraction with p+1000000000000 underflowed instead of overflowing.
Saturate the explicit exponent at 2^62, beyond what any addressable
digit run can offset, so the sum never overflows or changes sign.
Record that _Stod and _Stodx follow the title libc.prx rule for
hexadecimal underflow, unverified for libSceLibcInternal.
Refs #9691
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Keep only the gaps: the rule is measured on one title-bundled libc.prx,
and on Linux glibc 2.35's strtod rounds some hexadecimal subnormal
results a unit low.
Refs #9691
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Classify hexadecimal strtod and wcstod input from its own digits rather
than a long double approximation. As measured on God of War Ragnarok's
bundled libc.prx, ERANGE is set only on overflow or when the exact value
is below 2^-1074, and a value between 2^-1075 and 2^-1074 becomes the
smallest subnormal only from 2^-1075 * (1 + 2^-52) up.
Refs #9691
Co-Authored-By: Claude Opus 5.5 <[email protected]>
rename and sceKernelRename now look the source up before they reject a
dot destination, as FreeBSD 11.4's kern_renameat does, so a missing
source onto dir/. fails with ENOENT. guest_filesystem covers it.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
macOS numbers gif and stf 0x37 and 0x39, where FreeBSD uses 0xf0 and 0xd7, and
has types FreeBSD lacks such as IFT_CELLULAR. The macOS AF_LINK type now maps
like the Linux one: Ethernet, loopback and PPP keep their numbers and the
others report IFT_OTHER.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
getifaddrs listed each interface's AF_LINK entry only on Linux. On macOS the
entry now comes from the host's own AF_LINK sockaddr_dl and if_data: index,
type (macOS and FreeBSD share the IFT_ numbers), hardware address, header
length, MTU, metric, baud rate and counters, with the link state from
SIOCGIFMEDIA, or from IFF_UP and IFF_RUNNING for an interface without media.
The interfaces test checks the link-level entries against the host's on macOS
too.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The only conflict was in GuestMath.cpp, where main's sinh tests and this
branch's asinh tests were inserted at the same place. Keep both: the asinh
checks follow the sinh ones.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>