3 ms·
The 8087 emulation did not work exactly as described in footnote 1. Instead of writing 8087 instructions, the compiler wrote INT (software interrupt, often used
by bonzini 6y ago
The 8087 emulation did not work exactly as described in footnote 1. Instead of writing 8087 instructions, the compiler wrote INT (software interrupt, often used for system or runtime calls) instructions. The first opcode of 8087 instructions only has eight possible values so you could for example use eight software interrupt vectors to encode the opcode into the second byte of the INT instruction.
If an 8087 was present, the interrupt handler simply patched in place the INT instruction, replacing it with an 8087 instruction. If the math coprocessor was absent, instead, the interrupt handler decoded the subsequent instruction bytes from the instruction stream and performed software emulation. All this was needed because the 8088 and 8086 didn't have undefined opcode exceptions!