iretd

Interrupt return, 32-bit

Returns from an interrupt by popping eip, cs and eflags as 4-byte values, and in 64-bit mode esp and ss as well.

386 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

  • iretd

In 64-bit mode it also pops esp and ss, 20 bytes in all, and loads only 32-bit eip and esp, so a 64-bit handler returns with iretq instead.

global _start

section .text
_start:
        mov rax, 12
        mov rbx, 5
        mov rcx, 3
        mov rsi, 9

        iretd

        mov rax, 60         ; syscall 60: exit
        xor rdi, rdi
        syscall