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

boneheadgeek picture boneheadgeek · Aug 2, 2013 · Viewed 26.1k times · Source

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 guarenteed not to get clobbered?

Answer

Carl Norum picture Carl Norum · Aug 2, 2013

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.