17.2.4 Handling Illegal Instructions
Another service provided by operating system is dealing properly with the attempt to execute instructions with "illegal" opcodes. Illegal is quotes because that just means opcodes whose operations aren't implemented directly by the hardware. As we'll see, it's possible extend the functionality of the hardware via software emulation. The action of the CPU upon encountering an illegal instruction (sometimes referred to as an unimplemented user operation or UUO) is very similar to how it processes interrupts. Think of illegal instructions as an interrupt caused directly by the CPU! As for interrupts, the execution of the current instruction is suspended and the control signals are set to values to capture PC+4 in the XP register and set the PC to, in this case, 0x80000004. Note that bit 31 of the new PC, aka the supervisor bit, is set to 1, meaning that the OS handler will have access to the kernel-mode context. Here's some code similar to that foun...