WCU / Cybersecurity
~/CSC 471/Class 03/KP 12
Class 03 · KP 12 / 21

Passing Arguments (Recap)

System V AMD64 (Linux, macOS):

  • First 6 integer/pointer args: RDI, RSI, RDX, RCX, R8, R9.
  • Floating-point args: XMM0XMM7.
  • Additional args pushed on the stack, right to left.
  • Return value in RAX (and RDX for 128-bit).
  • 128-byte red zone below RSP usable by leaf functions.

Microsoft x64 (Windows):

  • First 4 args: RCX, RDX, R8, R9.
  • Caller allocates 32 bytes of shadow space for those 4 registers.
  • Extra args on the stack; return value in RAX.
Key Takeaway

Which ABI you are reading changes which registers hold the arguments — always confirm the platform first.