ud0
Undefined Instruction 0
UD0
Generates invalid opcode exception.
Details
Generates an invalid opcode exception (#UD). This instruction is reserved for generating intentional undefined instruction exceptions in all processor modes, useful for debugging and kernel routines. No flags are modified; execution terminates with a #UD fault.
Pseudocode Operation
RAISE_EXCEPTION(#UD)
Example
UD0
Encoding
Binary Layout
0F
+0
FF
+1
Operands
Reference (Intel® SDM)
Instruction Forms
| Opcode | Instruction | Op/En | 64/32-bit Mode | CPUID | Description |
|---|---|---|---|---|---|
| 0F FF /r | UD01 r32, r/m32 | RM | Valid Valid | Raise invalid opcode exception. | |
| 0F B9 /r | UD1 r32, r/m32 | RM | Valid Valid | Raise invalid opcode exception. | |
| 0F 0B | UD2 | ZO | Valid Valid | Raise invalid opcode exception. | |
| D6 | UDB | Valid N.E. | Z0 | Raise invalid opcode exception. |
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 (All Operating Modes) #UD Raises an invalid opcode exception in all operating modes. (UDB does so only in 64-bit mode.) UD—Undefined Instruction Vol. 2B 4-736