Re:Pentium FDIV bug reverse-engineered which costed Intel $475M
by hakfoo on Friday December 13, 2024 @09:59PM
(#42414307)
It's interesting that there's no "trap instruction/sequence" feature built into the CPU architecture. That would presumably be valuable for auditing and debugging, or to create a custom instruction by trapping an otherwise unused bit sequence.
[ Parent
| on HN ]
Re:Pentium FDIV bug reverse-engineered which costed Intel $475M
by j16sdiz on Saturday December 14, 2024 @02:21AM
(#42415301)
> create a custom instruction by trapping an otherwise unused bit sequence. ..
... until a new CPU support an instruction extension that use the same bit sequence.
Re:Pentium FDIV bug reverse-engineered which costed Intel $475M
by immibis on Saturday December 14, 2024 @08:49AM
(#42417118)
That's why architectures - including x86! - have opcodes they promise will always be undefined.
Re:Pentium FDIV bug reverse-engineered which costed Intel $475M
by colejohnson66 on Sunday December 15, 2024 @01:27PM
(#42425008)
Those undefined opcodes are more for testing your fault handler or for forcing a trap in an “unreachable” part of your code, not to implement custom instructions.
Re:Pentium FDIV bug reverse-engineered which costed Intel $475M
by phire on Sunday December 15, 2024 @06:48PM
(#42426804)
Yeah...
Part of the reason why existing functionality is limited and nobody uses them to implement custom instructions, is that trapping is actually quite expensive.
The switch to kernel space and back is super expensive, but even if a CPU did implemente fast userspace trap handlers, it wouldn't be fast.
Re:Pentium FDIV bug reverse-engineered which costed Intel $475M
by immibis on Sunday December 15, 2024 @08:20PM
(#42427182)
They can be used for anything you want. The CPU treats them as described in the document.
They're not fast, though. You probably don't want to run trapped fake instructions in tight loops, but you don't want that no matter how they're implemented.