call8 and a0 (access / modify the return address)
Posted: Tue Sep 23, 2025 9:29 am
Hello!
Was reading about windowed calling conventions and found that a0, the return address is not accessible from within called function. E.g. if I would like to modify the return address, should I:
1. Manually move window left, change a0, move window right or
2. Provoke window spill, make a few nested dummy function calls, so my a0 can be found on the stack and modified there
I am asking this just for better understanding of how it all works. Xtensa is new for me so I want to learn the basics.
Also, regarding "entry aX, N"
Am I right in the assumption that it is "entry" who actually rotates the window, so register a0 (return address) is accessible from the called function before "entry" call? I.e. if I change function prologue from "entry aX, N" to
mov a13, a0
entry ...
then I can get my return address value in a13 (which becomes a5 after rotation by 8)
Is this correct?
Thank you!
Was reading about windowed calling conventions and found that a0, the return address is not accessible from within called function. E.g. if I would like to modify the return address, should I:
1. Manually move window left, change a0, move window right or
2. Provoke window spill, make a few nested dummy function calls, so my a0 can be found on the stack and modified there
I am asking this just for better understanding of how it all works. Xtensa is new for me so I want to learn the basics.
Also, regarding "entry aX, N"
Am I right in the assumption that it is "entry" who actually rotates the window, so register a0 (return address) is accessible from the called function before "entry" call? I.e. if I change function prologue from "entry aX, N" to
mov a13, a0
entry ...
then I can get my return address value in a13 (which becomes a5 after rotation by 8)
Is this correct?
Thank you!