x86-64 Instructions API Reference
Core x86-64 instructions for data movement, arithmetic, control flow, and Linux system calls (Intel/NASM syntax).
Instructions
The fundamental x86-64 integer instructions. Sizes are 8/16/32/64-bit (byte/word/dword/qword); mnemonics follow Intel syntax (dst, src).
mov dst, srcCopy src into dst. Operand sizes must match; memory-to-memory moves are not allowed.
Returns: Sets dst = src. Does not modify flags.
add dst, src / sub dst, srcAdd (or subtract) src from dst, storing the result in dst and updating flags.
Returns: dst = dst +/- src. Sets CF, OF, SF, ZF, AF, PF.
imul dst, src[, imm] (two/three-operand form)Signed multiply. Two-operand: dst = dst * src (low 64 bits). Three-operand: dst = src * imm. One-operand form returns 128-bit result in rdx:rax.
Returns: dst = dst * src (or src * imm). Sets CF and OF if the result overflowed the low half.
cmp a, b / test a, bCompare (cmp) computes a-b and sets flags; test computes a&b and sets flags. Neither modifies operands — they set up flags for jcc.
Returns: Sets ZF, SF, CF, OF, AF, PF per the result. Operands unchanged.
jmp label / jcc labelUnconditional (jmp) or conditional (jcc) jump to a label or address. Conditional jumps test flags set by cmp/test/arithmetic.
Returns: Transfers control to label. No register/flag changes (jcc may consume flags).
push src / pop dstpush decrements rsp by 8 (64-bit mode) and stores src at [rsp]; pop loads [rsp] into dst and increments rsp by 8.
Returns: push: rsp -= 8, [rsp] = src. pop: dst = [rsp], rsp += 8. Flags unchanged.
call label / retcall pushes the return address (8 bytes) onto the stack and jumps to label. ret pops the return address back into rip, returning control to the caller.
Returns: call: rsp -= 8, [rsp] = return addr, rip = label. ret: rip = [rsp], rsp += 8.
syscall (Linux x86-64)Enter the kernel to perform a system call. The syscall number goes in rax; up to six arguments in rdi, rsi, rdx, r10, r8, r9. Returns in rax; clobbers rcx and r11.
Returns: Result in rax (negative value indicates -errno). rcx and r11 are clobbered.