80286 Protected Mode Test

Maciej W. Rozycki macro at orcam.me.uk
Sun Mar 14 20:41:50 CDT 2021


On Sun, 14 Mar 2021, Liam Proven via cctalk wrote:

> > I should also note, that the other way to get back to real mode from
> > protected mode is via a triple-fault.  What gets me (and I railed on
> > Intel when I worked there for a time) that it still existing in the
> > architecture even though they have a machine check architecture now
> > (which while at IBM pushed Intel to implement for the '386!).
> 
> (!)

 Well, software exists that relies on the triple-fault feature for reboots 
including current versions of Linux (you can trigger a triple-fault in the 
real mode too).  These days it is implemented by the southbridge catching 
the shutdown special cycle on PCI and asserting the reset pin to the CPU 
(the details might be slightly different for PCIe or HyperTransport).

 Back in the day I experimented with that stuff myself and all the weird 
ways to switch between modes with the x86, setting the IDTR in the real 
mode for interesting effects which would impress fellow students, etc.  I 
ended up writing this: <http://www.rcollins.org/articles/pvi1/pvi1.html> 
as a result.  I wrote a simple resident VM86 monitor for DOS too, just to 
fiddle with processor features.

 Also resetting the CPU with the shutdown code of 0xa put at the location 
0xf of the RTC/NVRAM chip was the only way to get the family, model, and 
stepping ID in the EDX register for old processors that did not have the 
CPUID instruction (i.e. all 80386 and many 80486 implementations), unless 
the system BIOS clobbered it for no good reason in the short bypass code 
involved (sadly sometimes that did happen).  I just double-checked my old 
DOS assembly code to see if I got the details right!

 NB I didn't know LOADALL would not work for switching from the protected 
to the real mode and did not find out about the instruction until after I 
already lost access to any 80286 hardware, so I never experimented with it 
myself.

  Maciej


More information about the cctalk mailing list