Commit Graph
1 Commits
Author SHA1 Message Date
Cryan209andClaude Opus 5 e12adb1de5 Take the CPU's own faults through the guest's handler, not out of the run
`65` and `db` were stopping two of the flash captures, and neither is a
missing instruction.

`65` is the 386's GS prefix and is undefined on this part. The 80C186EB
manual says what the CPU does with one: "Execution of an undefined opcode
causes an Invalid Opcode trap" (Type 6). That trap has a handler waiting for
it - the Australian captures install a stub at 8000:0f83 that loads a fault
code and jumps to the common reporter - so the faithful model is to vector
it, not to end the run. 0f, 63, 64, 66, 67, d6 and f1 are undefined on the
186 for the same reason and take the same path; the 386ex profile keeps them.

`db` is ESC, a real encoding. Whether it faults depends on RELREG's ET bit,
which resets to zero and which nothing in these firmwares sets, so on this
16-bit part it goes out to an 80C187 instead. There is no 80C187 on the
board, so the operand cycle is read and execution carries on. ET is
modelled as a flag and takes the Type 7 path when set, which is what the
8-bit 80C188 would always do.

A trap restarts its instruction rather than resuming past it, so it cannot
go out as a software interrupt: `Uc.fault` marks which it is and the machine
dispatches it with the faulting address. A fault is also not a controller
request, so it stays out of the EOI stack that a hardware interrupt enters.

Going past those two exposed the next stop, which was a real gap rather than
a fault: SAHF, LAHF, INT3, INTO, WAIT, DAS, AAA, AAS and 82 as the
documented alias of 80 are all defined 80186 instructions that were simply
missing. They are implemented, and the line is kept deliberately - BOUND and
INS/OUTS are still absent and still raise, because a gap in the model must
not be swallowed by a trap that would hide it.

Both 20.16 MHz captures now run a 60,000,000 instruction boot without
error where they used to stop at about 6.2M. Neither reaches its ATI7: the
divergence that sent them there is upstream of any opcode. In both, the last
instruction fetched from flash is the `cb` ending the routine at 9e8cb, and
that far return lands two bytes before the entry its own caller targets
(`9a 39 07 00 80`, CALL FAR 8000:0739, against a return to 7ff8:07b7). One
board then decodes a misaligned stream and the other runs into cleared RAM.
That is the thing to chase next.

The 2806's boot is byte-identical and still prints its profile, and the three
XMF images are identical against a matched baseline.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 23:19:29 +12:00