Run 40226437381 failed guest_floating_point (feholdexcept workers preserve the main environment). The test compared the whole fnstenv image (tag word, FIP/FDP) of the main thread before and after other threads ran; a context switch re-initialises that state when the x87 unit is idle, so it flakes (3 of 28 main builds). Compare control word, status word and MXCSR.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The trap checks unmask exceptions with feenableexcept and its relatives
and expect MXCSR to hold the new masks, and the enable and disable
results to report the traps enabled on both units. Under Rosetta 2
MXCSR keeps its six exception masks set, so no SSE trap is ever enabled
and every result reports none. The test now asks the host once whether
it keeps an unmasked MXCSR exception and, where it does not, expects
all six SSE masks set and no trap on both units; on other hosts the
expectations are the same as before. A debt entry records that the
trap functions change only the x87 masks under Rosetta.
Under Rosetta 2 the six MXCSR exception masks always read back set: a
write that unmasks an SSE exception is not kept, while the x87 masks and
the other MXCSR bits are. guest_floating_point unmasked the overflow
exception on both units and then expected MXCSR to equal the value it
wrote, so it failed on macOS although fesetexceptflag and feclearexcept
left the masks alone. The test now compares with the environment read
back after the write, which on other hosts is the value written. The
debt entry for the floating-point functions notes the Rosetta behaviour.
Raise the requested floating-point exceptions on the x87 and SSE units
and set errno as the console's libc.prx does.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
feenableexcept, fedisableexcept, their __ forms, fegettrapenable and
fesettrapenable unmask or mask exceptions in the x87 control word and
MXCSR, with the console's return values.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RbLgECLQ2bpDM7oe2urGZK