I'm trying to understand the start and end of functions in ARM assembly:
PUSH {R0-R2, LR}
POP {R0-R2, PC}
Looking at this piece of code in IDA here's what I understood (Lets assume SP is 0x100):
PUSH R0 ; sp = 0xFC
PUSH R1 ; sp = 0xF8
PUSH R2 ; sp = 0xF4
PUSH LR ; sp = 0xF0
POP R0 ; sp = 0xF4
POP R1 ; sp = 0xF8
POP R2 ; sp = 0xFC
POP PC ; sp = 0x100
It seems like PC gets the value of R0, when it should get the value of LR.
Shouldn't PC get the value of LR?