LOGBOOK

HELP

Quiz Entry - updated: 2026.12.01

An ESP32 crash dump shows PC : 0x400e14ed but A0 : 0x800d0805. Why does the return address in a0 start with 0x8 when code lives at 0x400…?

The top two bits of a windowed return address hold the call's window shift, not part of the address. 0x8 in front means call8; the real return address is 0x400d0805.

The value 0x800d0805 split into the top two bits 10, the call8 window shift, and the low 30 bits of the return address; retw refills the top bits to return to 0x400d0805

* The return address and the window shift share one register. *

When call8 stores the return address, it overwrites the two most significant bits with the window increment (01 for call4, 10 for call8, 11 for call12). The return instruction retw needs that number to know how far to rotate the window back, and storing it in the address itself costs no extra register.

a0 value Top two bits Meaning
0x800d0805 10 returned to from a call8
0x400d0805 01 from a call4
0xc00d0805 11 from a call12

When retw returns, it replaces those two bits with the top two bits of its own address. So the real address is 0x400d0805, in the same region as the code that is running. A side effect: a windowed call can't jump to code in a different 1 GB quarter of the address space, because those two address bits are lost.

Debuggers and ESP-IDF's backtrace decoder strip the bits automatically. You only meet the raw value when you read a0 yourself, in a register dump or with info registers in GDB, and you should mentally swap the leading 8 for a 4 before looking the address up.

Go deeper:

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