IA32 Cheat Sheet
IA32 Cheat Sheet
IA32 Cheat Sheet
movl Src, Dest addl Src, Dest subl Src, Dest sall Src, Dest sarl Src, Dest shrl Src, Dest xorl Src, Dest andl Src, Dest orl Src, Dest incl Dest decl Dest negl Dest notl Dest leal Src, Dest Dest = Src Dest (long) = Src (byte), sign extend Dest = Dest + Src Dest = Dest Src Dest = Dest * Src Dest = Dest << Src Dest = Dest >> Src Dest = Dest >> Src Dest = Dest ^ Src Dest = Dest & Src Dest = Dest | Src Dest = Dest + 1 Dest = Dest - 1 Dest = Dest Dest = ~ Dest Dest = address of Src Sets CCs Src1 Src2 Sets CCs Src1 & Src2 jump jump equal jump not equal jump negative jump non-negative jump greater (signed) jump greater or equal (signed) jump less (signed) jump less or equal (signed) jump above (unsigned) jump below (unsigned) %esp = %esp 4, Mem[%esp] = Src pop Dest call label ret Dest = Mem[%esp], %esp = %esp + 4 push address of next instruction, jmp label %eip = Mem[%esp], %esp = %esp + 4 arithmetic shift logical shift movsbl Src,Dest
Addressing modes
Immediate $val Val val: constant integer value movl $17, %eax Normal (R) Mem[Reg[R]] R: register R specifies memory address movl (%ecx), %eax Displacement D(R) Mem[Reg[R]+D] R: register specifies start of memory region D: constant displacement D specifies offset movl 8(%ebp), %edx Indexed D(Rb,Ri,S) Mem[Reg[Rb]+S*Reg[Ri]+D] D: constant displacement 1, 2, or 4 bytes Rb: base register: any of 8 integer registers Ri: index register: any, except %esp S: scale: 1, 2, 4, or 8 movl 0x100(%ecx,%eax,4), %edx
cmpl Src2, Src1 jmp label je label js label jg label jl label ja label jb label push Src jne label jns label jge label jle label
Instruction suffixes
b w l byte word (2 bytes) long (4 bytes)
Condition codes
CF ZF SF OF Carry Flag Zero Flag Sign Flag Overflow Flag
Registers
%eax %ecx %edx %ebx %esi %edi %esp %ebp