Hello,
Kindly
refer code at path UBOOT / u-boot / cpu / pxa / start.S
Code:
.macro irq_save_user_regs
sub sp,
sp, #S_FRAME_SIZE
stmia sp,
{r0 - r12} /*
Calling r0-r12 */
add r8,
sp, #S_PC
stmdb r8,
{sp, lr}^ /*
Calling SP, LR */
str lr,
[r8, #0] /*
Save calling PC */
mrs r6,
spsr
str r6,
[r8, #4] /*
Save CPSR
*/
str r0,
[r8, #8] /*
Save OLD_R0
*/
mov r0,
sp
.endm
Why there is need to save R0? If we refer ARM
architecture (section what all happens when interrupt comes) there is no need
to save R0.
Moreover, there is no need of writing such big piece
of code it can be replaced with below given four liner code:
Sub lr,
lr, #4
Stmfd
sp! , {r0-r12, lr}
MRS r1,
spsr
Stmfd sp!
, {r1}
Similarly we can write small code for restore of stack
.macro
irq_restore_user_regs
Ldmfd sp! , {r1}
MSR cpsr_c
, R1
ldmfd sp!, {r0-r12, pc}^
.endm
Can anybody clarify?
Regards
Amit Kumar