Skip to content

Instantly share code, notes, and snippets.

@bgamari
Created March 30, 2018 13:27
Show Gist options
  • Save bgamari/445d46ae5eb24d0575c57b0bbb1ab299 to your computer and use it in GitHub Desktop.
Save bgamari/445d46ae5eb24d0575c57b0bbb1ab299 to your computer and use it in GitHub Desktop.

STG Registers

STG amd64 ARM description


Base r13 Base register (StgRegTable*) Sp rbp Stack pointer SpLim r15 Stack limit Hp r12 Heap pointer R1 rbx Current closure, return value R2 r14 arg1 R3 rsi arg2 R4 rdi arg3 R5 r8 arg4 R6 r9 arg5

Other arguments on stack

SysV AMD64 Registers

C amd64 Preserved across function calls


return rax No arg1 rdi No arg2 rsi No arg3 rdx No arg4 rcx No arg5 r8 No arg6 r9 No

  •     `r10`             No
    

stack rsp Yes frame rbp Yes

  •     `rbx`             Yes
    
  •     `r12` - `r14`     Yes
    
  •     `xmm*`            No
    

x86 flags and jumps

Flag Name Description


CF carry flag Set on high-order bit carry or borrow PF parity flag Set if low-order eight bits contain an even number of ones ZF zero flag Set if result is zero SF sign flag Set if high-order bit of result is one OF overflow flag Set if result overflows or underflows

Instruction Description Flags


JO Jump if overflow OF = 1 JNO Jump if not overflow OF = 0 JS Jump if sign SF = 1 JNS Jump if not sign SF = 0 JE Jump if equal ZF = 1 JZ Jump if zero
JNE Jump if not equal ZF = 0 JNZ Jump if not zero
JB Jump if below CF = 1 JNAE Jump if not above or equal
JC Jump if carry unsigned comparison JNB Jump if not below CF = 0 JAE Jump if above or equal
JNC Jump if not carry JBE Jump if below or equal CF=1 || ZF=1 JNA Jump if not above
JA Jump if above CF=0 && ZF=0 JNBE Jump if not below or equal signed comparison JL Jump if less SF != OF JNGE Jump if not greater or equal JGE Jump if greater or equal SF = OF JNL Jump if not less
JLE Jump if less or equal ZF = 1 || SF != OF JNG Jump if not greater
JG Jump if greater ZF=0 && SF = OF JNLE Jump if not less or equal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment