80286 Protected Mode Test
Maciej W. Rozycki
macro at orcam.me.uk
Sun Mar 14 10:32:20 CDT 2021
On Sun, 7 Mar 2021, Noel Chiappa via cctalk wrote:
> > The 286 can exit protected mode with the LOADALL instruction.
> Really? So why all the hullabaloo about Triple Faults:
> back in the day; and why did IBM set up the keyboard controller so it could
> send a RESET signal (so people could get out of protected mode)? Or is it
> that LOADALL (which was also undocumented early on, so maybe that's why the
> IBM thing) could be used to cause a triple fault?
The existence of LOADALL (used for in-circuit emulation, a predecessor
technique to modern JTAG debugging and the instruction the modern x86 RSM
instruction grew from) in the 80286 wasn't public information for a very
long time, and you won't find it in public Intel 80286 CPU documentation
even today. Even if IBM engineers knew of its existence at the time the
PC/AT was being designed, surely they have decided not to rely in their
design on something not guaranteed by the CPU manufacturer to exist.
As to why they choose to add the keyboard controller hack I think the
article referred gives a hypothesis that is as good as you can get: they
were not clever enough. Back in the day this wasn't the only fault they
made and it was a harmless one anyway, because you didn't have to use the
hack in your software if you knew the proper way.
Much worse was the mess around the incorrect wiring of the FPU exception
line (to IRQ #13 via additional glue logic rather than its dedicated CPU
input), which could have been easily avoided while retaining PC/XT
compatibility in a manner similar to how it was implemented in the BIOS
for IRQ #13. Consequently functionality of the exception was lost (the
exception was supposed to be precise unlike obviously the external IRQ)
and also if you were not careful enough in handling it, the machine would
lock up hard and you'd have to hit the reset button.
The mess with the FPU exception was actually one of the two reasons to
drop 32-bit x86 Linux support for the original 80386 CPU several years ago
(the other one was the lack of write protection in the kernel mode for
user pages). Support now starts from the 80486:
$ uname -mrsv
Linux 5.11.0+ #13 Mon Mar 8 00:14:59 CET 2021 i486
More information about the cctech