in AM335X_StarterWare_02_00_00_06\examples\evmAM335x\isr_reloc\exceptionhandler_ewarm.S
the IRQHandler does not appear to save the SPSR register, however the TRM (spurh73f section 6.2.2) suggest it should be saved
;******************************************************************************;* Function Definition of IRQ Handler;******************************************************************************;; The IRQ handler jumps to the ISR of highest priority pending IRQ.; This handler doesnot support nesting.;IRQHandler: STMFD r13!, {r0-r3, r12, r14} ; Save context in IRQ stack
;; ===================================== shouldnt the spsr be preserved here
LDR r0, =ADDR_SIR_IRQ ; Get the Active IRQ LDR r1, [r0] AND r1, r1, #MASK_ACTIVE_IRQ ; Mask the Active IRQ number LDR r0, =fnRAMVectors ; Load the base of the vector table ADD r14, pc, #0 ; Save return address in LR LDR pc, [r0, r1, lsl #2] ; Jump to the ISR MOV r0, #NEWIRQAGR ; Acknowledge the current IRQ LDR r1, =ADDR_CONTROL STR r0, [r1] DMB ; Barrier to complete the data write LDMFD r13!, {r0-r3, r12, r14} ; Restore registers from IRQ stack SUBS pc, r14, #0x4 ; Return to program before IRQ
Hi Rader,
for a non-reentrant handler, there is no need to save SPSR_IRQ because, it will never be changed till the exit of IRQ handler. SPSR_IRQ is only accessible in IRQ mode. Since it is a not a reentrant handler, no where else it will get changed.
Regards,
Sujith.