On intel platforms, BP
is used to point to the beginning of the stack frame and to access the arguments [bp+0x??]
and local variables [bp-0x??]
.
Which register is used in ARM? Or, is the addressing based on SP only?
[I don't have infrastructure to compile and disassemble to see it by myself. Referring to AAPCS did not help me either]
the fp stands for the frame pointer which is used as a base pointer to local variables on the stack. Although sp (stack pointer) varies according to function calls from a function, fp holds a fixed value. The relationship between the sp and the fp is a just difference of offsets for the stack.
The processor uses full descending stacks, which means that register R13, the Stack Pointer, holds the address of the last stacked item in memory.
SP is the stack register a shortcut for typing r13. LR is the link register a shortcut for r14. And PC is the program counter a shortcut for typing r15. When you perform a call, called a branch link instruction, bl, the return address is placed in r14, the link register.
What you are looking for is the Frame Pointer. Generally, R7
acts as the frame pointer in THUMB mode and R11
acts as the frame pointer in ARM mode. But it is under the discretion of the OS to change this convention if it wishes to.
Read here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With