TRT
Sign in

Expert · Module 10 · Lesson 1 of 12

Hardware Stack Architecture, Stack Frames, and the System V AMD64 ABI

Dissect execution stack frames on x86-64, navigate the System V AMD64 ABI calling convention, inspect caller vs. callee-saved registers, and enforce 16-byte stack alignment.

Pro — members onlyAbout 16 minutes

By the end you can

  • Inspect stack frame growth, activation records, and stack pointer (%rsp) movements
  • Classify registers under the System V AMD64 ABI into caller-saved vs. callee-saved sets
  • Analyze the 128-byte x86-64 Red Zone and its implications for user-space context switches
  • Enforce strict 16-byte stack boundary alignment before call instructions to avoid SIMD faults

Builds on eBPF Performance Diagnostics: Kernel Tracepoints, kretprobes, and bpftrace.

01 · A question first

Why does calling a standard C function overwrite registers your code relies on, while leaving others completely intact? Understanding the System V AMD64 register contract and stack frame architecture is the prerequisite for crafting user-space context switches.

Make a guess before you read on.

02 · The idea

Members only

Unlock the full lesson

This lesson is part of the membership. Join to read it in full, along with every other premium deep dive.

What's inside

  • Start with the problem
  • How the idea works
  • Hands-On Code: Inspecting Stack Frames and Walking the Call Chain
  • Why it is correct
  • What it costs
  • Pitfalls and variations
  • Where it is used

03 · Practice

Something wrong with this lesson? Report a problem