Hi,
bluemoon wrote:Seems plausible but not practical. In fact that is the official way to detect CPU fault.
It's the official way to detect software faults. The official way to detect CPU/hardware faults is with either NMI or the machine check exception.
Now think about virtual memory tricks (including "copy on write", swapping, etc), virtual8086 mode, emulation of unsupported instructions and debugging. When a page fault, general protection fault, invalid opcode fault or debugging fault (e.g. "instruction fetch breakpoint") occurs, you determine the cause of the problem, and (where appropriate) fix the problem and let everything continue as if the fault had never occurred. The "enable unreal mode within the general protection fault handler" idea is no different to this (widely accepted) practice.
However, I would suggest that any software that overrides the BIOS "interrupt 0x0D" handler should ask the PIC chip if IRQ5 occurred and pass control to the original BIOS handler if it did.
bluemoon wrote:Unreal mode is activated by not following the manual(at least for IA processors), thus unofficial.
Unfortunately, a lot of things are "de facto standards" and not mentioned in any official standard. This includes various BIOS functions, the MBR partitioning scheme, the BPB, anything where there is a specification that isn't specific enough (parts of ACPI, parts of PXE, etc) and unreal mode.
The difference between "official" and "de facto" is mostly irrelevant in practice. What is relevant is whether or not it works and whether or not it will continue to work in the foreseeable future. Unreal mode does work on every "80x86 compatible" CPU that supports 32-bit protected mode. Unreal mode will also continue to work on every "80x86 compatible" CPU in the foreseeable future; not just because of backward compatibility, but because it relies on the only sane way of implementing segmentation in silicon (especially now that the internal/"hidden" state of segment registers has been made visible by official standards due to SMM and hardware virtualisation).
Looking beyond the foreseeable future (into the un-foreseeable future); I do hope that one day (after everyone has moved to UEFI) Intel/AMD are brave enough to discard real mode completely (and a lot of legacy hardware baggage - A20 gate, PIC chips, etc). If that ever actually does happen, then unreal mode will stop working at that time.
Cheers,
Brendan