leaveq

Destroy 64-bit stack frame

Releases a 64-bit stack frame by setting rsp to rbp and popping the saved rbp, undoing enter.

x86-64 and later

Intel's reference: LEAVE

CFPFAFZFSFDFOF –––––––
  • Changes no flag

Forms

  • leaveq

It has the effect of mov rsp, rbp followed by pop rbp and leaves flags unchanged. It can match an enter frame or the usual explicit frame setup. leaveq explicitly selects the 64-bit form.

global _start

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

        leaveq

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