sots-engine/src/shim
alex d462513f84 shim: force and verify the x87 control word around the turn gate
New fpu_force module (4 register-transparent asm stubs, same pattern as the M0
Initialize hook, so the [unverified] prototypes of the turn-gate functions are
never relied on) plus two shim.cfg keys:

  fpu.force=<cw>|off      fldcw at StrategyClient::EndTurn and
                          StrategyServer::BeginProcessTurn, and nowhere else
  fpu.sample_ticks=on|off per-frame sampler, logs only when the word CHANGES

Forcing is deliberately one write per turn: re-forcing inside the pipeline would
guarantee the value is present without proving it ever held, which is the exact
false negative this experiment has to avoid. Verification is kept separate --
StrategyServer::ProcessTurn is hooked sample-only, and its reading plus the
existing per-hook fpu_cw fields (38 samples per turn across phases 4, 6 and 8)
are what establish that the setting lasted the whole turn.

Six shim.cfg variants, identical apart from the fpu.force line, and docs.

Used to settle STATE_CHECKSUM.md 3.5: 53-bit and 64-bit x87 produce byte-
identical turn results, so an x64/SSE port has no double-rounding budget to
preserve; 24-bit and round-up each move exactly one thing. Findings and evidence
live in the notes repo (findings/subsystems/fpu-precision-sensitivity.md).

clean_room_check.sh OK; host ctest 32/32.
2026-09-08 05:09:16 -04:00
..
hooks movefleet: reproduce the original's float32 normalise; 8 of 45 live divergences -> 0 2026-09-08 03:50:04 -04:00
trace harness: compile-time Coverage on every descriptor, guard regions, replace-mode records; audit of 23 undeclared side effects 2026-09-08 01:28:35 -04:00
binkw32.def m0: binkw32 proxy shim, minhook, trace hook on Application::Initialize; build/deploy tooling 2026-09-07 17:22:15 -04:00
fpu_force.cpp shim: force and verify the x87 control word around the turn gate 2026-09-08 05:09:16 -04:00
fpu_force.h shim: force and verify the x87 control word around the turn gate 2026-09-08 05:09:16 -04:00
main.cpp shim: force and verify the x87 control word around the turn gate 2026-09-08 05:09:16 -04:00
shim.cfg b3: research hook + RNG-snapshot compare design; fix draw mapping to y/(2^32-1), NextInt inclusive, float32 odds, spend floor, decay constants 2026-09-07 23:14:08 -04:00
shim.cfg.b4compare b4: colony + movement hooks; 22 formula corrections (growth curve has no capacity term, range margin +0.05f, ties-to-even rounding); 3 verified signatures 2026-09-08 00:57:55 -04:00
shim.cfg.b4scout b4: colony + movement hooks; 22 formula corrections (growth curve has no capacity term, range margin +0.05f, ties-to-even rounding); 3 verified signatures 2026-09-08 00:57:55 -04:00
shim.cfg.b4trace b4: colony + movement hooks; 22 formula corrections (growth curve has no capacity term, range margin +0.05f, ties-to-even rounding); 3 verified signatures 2026-09-08 00:57:55 -04:00
shim.cfg.fpu1a7f shim: force and verify the x87 control word around the turn gate 2026-09-08 05:09:16 -04:00
shim.cfg.fpu007f shim: force and verify the x87 control word around the turn gate 2026-09-08 05:09:16 -04:00
shim.cfg.fpu027f shim: force and verify the x87 control word around the turn gate 2026-09-08 05:09:16 -04:00
shim.cfg.fpu127f shim: force and verify the x87 control word around the turn gate 2026-09-08 05:09:16 -04:00
shim.cfg.fpu137f shim: force and verify the x87 control word around the turn gate 2026-09-08 05:09:16 -04:00
shim.cfg.fpuoff shim: force and verify the x87 control word around the turn gate 2026-09-08 05:09:16 -04:00
shim.cfg.recapb1 recapture: golden traces with guards on the live game 2026-09-08 03:04:34 -04:00
shim.cfg.recapb3 recapture: golden traces with guards on the live game 2026-09-08 03:04:34 -04:00
shim.cfg.recapmisc recapture: golden traces with guards on the live game 2026-09-08 03:04:34 -04:00
shim.cfg.recaptrace recapture: golden traces with guards on the live game 2026-09-08 03:04:34 -04:00