Special Register

When procedure P calls procedure Q , Q must preserve the values of these registers, ensuring that they have the same values when Q returns to P as they did when Q was called. (P call Q, Q preserve)

Procedure Q can preserve a register value by either not changing it at all or by pushing the original value on the stack, altering it, and then popping the old value from the stack before returning.

  • caller saved register
    • All but %rsp
    • they can be modified by any function.
    • hold temporary quantities that need not be preserved across calls. caller’s responsibility to save

  • frame pointer
    • points to the base of the current stack frame

  • argument X86-64 Architecture Guide

    • %rdi used to pass 1st argument
    • %rsi
    • %rdx
    • %rcx
    • %r8
    • %r9
  • 32-bit

    • %eax through %edx
    • %esi, %edi, %ebp, %esp
    • %r8d through %r15d
  • 64-bit

    • %rax through %rdx
    • %rsi, %rdi, %rbp, %rsp
    • %r8 through %r15