6.9. Undefined Instruction handlers

Instructions that are not recognized by the processor are offered to any coprocessors attached to the system. If the instruction remains unrecognized, an Undefined Instruction exception is generated. It might be the case that the instruction is intended for a coprocessor, but that the relevant coprocessor, for example a Floating-Point Accelerator (FPA), is not attached to the system. However, a software emulator for such a coprocessor might be available.

Such an emulator must:

  1. Attach itself to the Undefined Instruction vector and store the old contents.

  2. Examine the Undefined Instruction to see if it has to be emulated. This is similar to the way in which an SVC handler extracts the number of an SVC, but rather than extracting the bottom 24 bits, the emulator must extract bits [27:24].

    These bits determine whether the instruction is a coprocessor operation in the following way:

    • If bits [27:24] = b1110 or b110x, the instruction is a coprocessor instruction.

    • If bits [8:11] show that this coprocessor emulator has to handle the instruction, the emulator must process the instruction and return to the user program.

  3. Otherwise the emulator must pass the exception onto the original handler (or the next emulator in the chain) using the vector stored when the emulator was installed.

When a chain of emulators is exhausted, no further processing of the instruction can take place, so the Undefined Instruction handler must report an error and quit. See Chaining exception handlers for more information.

Note

The Thumb instruction set does not have coprocessor instructions, so there is no requirement for the Undefined Instruction handler to emulate such instructions.

Copyright © 2002-2006 ARM Limited. All rights reserved.ARM DUI 0203G
Non-Confidential