UD

Undefined Instruction

stableVMJITAOTinstruction

Encodings

OpcodeInstructionOp/En64-bitCompat/LegacyDescription
0F FF /rUD01 r32, r/m32RMValidValidRaise invalid opcode exception.
0F B9 /rUD1 r32, r/m32RMValidValidRaise invalid opcode exception.
0F 0BUD2ZOValidValidRaise invalid opcode exception.
D6UDBZOValidNot encodableRaise invalid opcode exception.

Operand encoding

Each mode is a value of the Op/En column above. It says which field of the encoded instruction carries each operand, in the order they are written, and whether the instruction reads it, writes it or both.

RM

  1. modrm.reg lecturaModRM byte, reg field (bits 5-3)
  2. modrm.rm lecturaModRM byte, r/m field (bits 2-0); with the SIB byte and the displacement when the mod field asks for them

Measured cost

Not measured: it does not run on 64-bit processors.

Description

Generates an invalid opcode exception. This instruction is provided for software testing to explicitly generate an invalid opcode exception. The opcodes for this instruction are reserved for this purpose. Other than raising the invalid opcode exception, this instruction has no effect on processor state or memory. Even though it is the execution of the UD instruction that causes the invalid opcode exception, the instruction pointer saved by delivery of the exception references the UD instruction (and not the following instruction). This instruction's operation is the same in non-64-bit modes and 64-bit mode.

Operation

#UD (* Generates invalid opcode exception *);

Flags affected

None.

Exceptions

Real address mode
#UDRaises an invalid opcode exception in all operating modes. (UDB does so only in 64-bit mode.)
Protected mode
#UDRaises an invalid opcode exception in all operating modes. (UDB does so only in 64-bit mode.)
Virtual-8086 mode
#UDRaises an invalid opcode exception in all operating modes. (UDB does so only in 64-bit mode.)
Compatibility mode
#UDRaises an invalid opcode exception in all operating modes. (UDB does so only in 64-bit mode.)
64-bit mode
#UDRaises an invalid opcode exception in all operating modes. (UDB does so only in 64-bit mode.)

Sources