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.
A DWARF-mode index entry with no usable FDE, encoding 0, an unknown
personality, and a mode-3 immediate outside the function now fail the
unwind. A Linux test walks a synthetic __unwind_info blob.
Co-authored-by: devindevsec <[email protected]>
The code that ends or replaces the process already includes Shutdown.hpp,
so LogFileFlush_nid_no_patch and LogFileRelease_nid_no_patch are declared
there instead of in LogFile.hpp, which only the log copy and its test
include.
The runtime writes its log to the process's standard output and error
through hundreds of direct stdio calls, so copying it into a file has to
work on the descriptors (POSIX) or handles (Windows) themselves.
Add the platform layer for that: opening the file for appending (relative
paths resolve against the working directory, the error text carries the
operating system error), pipes whose read end can be polled, keeping a
duplicate of the original standard stream, diverting a standard stream
into a pipe and putting it back only while it still is that pipe, and a
direct write to a standard stream for the crash reporters. Windows reads
the variable and the path as UTF-16. Nothing calls these yet.
Follow the console libc.prx (PPSA02530) at 0xcb2d0: ignore the argument and throw the static bad_array_new_length object. Star Wars Racer (PPSA28416) imports it.
nanosleep on macOS wakes about 25% late up to roughly 5 ms, then a
roughly constant 2 to 5 ms late for longer waits. Keeping 30% of the wait
as margin made a 100 ms wait spin about 25 ms. The margin is now 30% of the
wait, capped at 5 ms, so long waits spin at most about 5 ms.
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
Evicting a resident run read every 16 KiB page to find the written ones. On Windows, reading a committed page that was never touched faults in a zeroed page, and 97% of the pages the game releases were never written, so the scan took 2.9 us per page and most of the time the guest-allocation lock was held (Soul Hackers 2: 7.1 s of every 10 s). While the run is write-watched, no collection has cleared the watch and no host import touched it, GetWriteWatch lists the only pages that can be non-zero, so only those are read. Runs that fail any of those conditions are scanned as before.