LOGBOOK

HELP

Quiz Entry - updated: 2026.11.27

Function f(x, y) calls g(u, v) with call8. In which registers does f put u and v, and where does g find them?

f puts u and v in its own a10 and a11. After the window shifts by 8, those same physical registers are g's a2 and a3, exactly where any function expects its first two arguments.

Physical registers with f's names on the left and g's names on the right: f's a0 to a7 are hidden from g, f's a8 to a15 are g's a0 to a7, so u and v in f's a10 and a11 are g's a2 and a3

* One set of physical registers, two sets of names. *

A shift of 8 means every register name in the callee is 8 lower than the caller's name for the same physical register: the caller's a8 is the callee's a0, a9 is a1, a10 is a2, and so on up to a15 = a7.

Step by step:

  1. In f, x and y are in a2 and a3, f's return address is in a0 and its stack pointer in a1.
  2. f places the arguments two registers above the shift amount: u into a10, v into a11.
  3. call8 g stores the return address into f's a8 and jumps to g.
  4. g runs with the window moved by 8. Its a0 (the old a8) is its return address, its a1 (the old a9) gets its stack pointer, and its a2/a3 (the old a10/a11) are u and v.

Meanwhile f's a0–a7, including x and y, are behind the window. g has no name for them and cannot disturb them, so f doesn't have to save x or y anywhere before the call.

The rule generalises: with callN, arguments go in the caller's a(N+2) onwards. That is a6 for call4, a10 for call8 and a14 for call12.

Go deeper:

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