immX
means a X-bit immediate value.regX
means a X-bit register. (Note: af
isn't part of the reg16
group)opX
means either a regX
, or an immX
.mem16
means a 16-bit immediate value, that is used to address memory.-
means 'unaffected', 0
or 1
means the flag is set to that value, and anything else describes what value the flag is set to.64-bit register | Low 32-bits | Low 16 bits | Low 8 bits | Byte 7* |
---|---|---|---|---|
%rax | %eax | %ax | %al | %ah |
%rsi | %esi | %si | %sil | n/a |
%r8 | %r8d | %r8w | %r8b | n/a |
Instruction | Description |
---|---|
mov %rxx, %ryy | Copy data from register %rxx to %ryy |
inc %rxx | Add one to %rxx |
dec %rxx | Subtract one from rxx |
neg %rxx | Negate %rxx |
not %rxx | Bitwise NOT %rxx |
add %rxx, %ryy | %ryy += %rxx |
sub %rxx, %ryy | %ryy -= %rxx |
or %rxx, %ryy | %ryy = %rxx OR %ryy (bitwise) |
and %rxx, %ryy | %ryy = %rxx AND %ryy (bitwise) |
imul %rxx | %rdx:%rax = %rax * %rxx |
imul %rxx, %ryy | %ryy = %ryy * %rxx (truncated to 64-bits) |
idiv %rxx | %rax = %rdx:%rax / %rxx; %rdx = quot |
Instruction | Description |
---|---|
cmp %rxx, %ryy | Compares the two registers, updating the flags register |
je label | Jump if equal (if previous cmp set equal flag; %rxx %ryy) |
jne label | Jump if not equal (%rxx != %ryy) |
jl label | Jump if less than (%rxx < %ryy) |
jle label | <= |
jg label | > |
jge label | >= |
sete %rzz | Set %rzz if %rxx %ryy in the previous cmp, else clear it. |
setg %rzz | Set %rzz if %rxx > %ryy |
setl %rzz | Set %rzz if %rxx < %ryy |
Instruction | Description |
---|---|
push %rxx | Copy %rxx to stack @ %rsp, move down %rsp |
pop %rxx | Copy from stack @ %rsp to %rxx, move up %rsp |
enter $NN, $0 | Allocate a stack frame with NN bytes of space |
leave | Deallocate a stack frame |
call label | Push $rip and jump to the address of the “label” function |
Example Instruction | Description |
---|---|
add (%rcx), %rdx | %rdx = %rdx + (value at address in %rcx) |
add $10, %rdx | %rdx = %rdx + 10 |
addq $10, 2(%e10, %e11, 2) | (the value at %e10+2*%e11) += 10 |
add -16($rsp), %rax | %rax += the value 16 bytes below where %rsp points |
lea
, that calcuates an address as if it weregoing to access an argument in memory but gives you the address as its output.Example Instruction | Description |
---|---|
lea -16($rsp), %rax | %rax = %rsp - 16 |
Example Instruction | Description |
---|---|
movw $10, (%rdx) | Move a 16-bit (2 byte, short) int to the address in %rdx |
movq %10, (%rdx) | Move a 64-bit (8 byte, long) int to the address in %rdx |
break
to set breakpoints on labels or line numbers.p $rax
or p/x $rax
.info reg