LOGBOOK

HELP

Quiz Entry - updated: 2026.11.27

A small windowed Xtensa function whose values all fit in registers never touches the stack, not even across a call. When does it have to use the stack after all?

When registers aren't enough: more than six argument words, a result larger than four words, more local data than fits in registers, or anything whose address is taken. And whenever the 64 physical registers fill up, the hardware spills older frames to the stack.

The first group is the program's own choice of data:

  • Arguments beyond six words. Only a2–a7 carry arguments, so the rest go on the stack.
  • Results beyond four words. a2–a5 carry results; a larger struct is returned through memory the caller provides.
  • Many or large locals, such as an array, which can't live in registers.
  • Locals whose address is taken (&x), because a register has no address.

The second case is invisible in the C code. Each call moves the window further along the 64 physical registers. After a few nested calls the next window would overlap registers that still belong to an older function. The processor then raises a window overflow exception: a short handler stores that older frame's registers into its stack frame, freeing them. When execution later returns to the spilled function, a window underflow exception reloads them.

So the register window doesn't remove stack traffic; it delays it until the call chain gets deep. Shallow, frequent calls, the common case, never touch memory.

Go deeper:

From Quiz: SIOT / Xtensa LX6 Registers, Calls and Branches in Assembly | Updated: Nov 27, 2026