Using cortex-a9 (zynq 7010)With the gcc toolchain.I'm working on porting our RTOS scheduler to this platform.In a privileged exception state (SVC,IRQ,FIQ etc..) trying to restore a saved context.
ldm r0,{r0-r12,sp,lr,pc}^
Does not seem to be restoring the user/system mode sp and lr.I thought that the ^ would force this to operate on the user/system registers, not the banked registers.The following code DOES work,I'm just trying to understand why the code above does not.
add r0,#52 ldm r0,{sp,lr}^ /* This works why doesn';'t it work in the previous statement */ nop sub r0,#52 ldr r1,[r0,#60] mov lr,r1 ldm r0,{r0-r12} movs pc,lr
Take a look at "srsdb" and "rfeia". Those are better suited for this.