iret

Interrupt return, default size

Returns from an interrupt by popping the instruction pointer, cs and the flags, and in 64-bit mode the stack pointer and ss as well, then continuing at the popped address.

8086 and later

Intel's reference: IRET/IRETD/IRETQ

CFPFAFZFSFTFIFDFOF ●●●●●●●●●
  • ● loaded from the stack
  • IF Loaded only when the program has the privilege to change it. A program in the editor does not, so IF keeps its value.

Forms

  • iret

Only the flags the privilege level allows are restored.

Under BITS 64, NASM assembles iret with the 32-bit operand size, as iretd: it pops 4-byte slots and loads only eip and esp. A 64-bit handler returns with iretq. A Linux program has no interrupt handlers of its own to return from.