Search code examples
linuxassemblyx86-64calling-conventionabi

What registers are preserved through a linux x86-64 function call


I believe I understand how the linux x86-64 ABI uses registers and stack to pass parameters to a function (cf. previous ABI discussion). What I'm confused about is if/what registers are expected to be preserved across a function call. That is, what registers are guaranteed not to get clobbered?


Solution

  • Here's the complete table of registers and their use from the documentation [PDF Link]:

    table from docs

    r12, r13, r14, r15, rbx, rsp, rbp are the callee-saved registers - they have a "Yes" in the "Preserved across function calls" column.