SPRUI30H November 2015 – May 2024 DRA745 , DRA746 , DRA750 , DRA756
In this programming model, the CSR[0]GIE bit is enabled within the interrupts service routine of maskable interrupts (INT15–INT4), SWI, or UNDEF interrupt. Hence, it is possible that maskable interrupts are nested. An NMI can always be taken with all other non-NMI interrupts.
Before enabling the CSR[0]GIE bit (in ISR), the software must ensure proper context save of all CPU registers onto the stack:
While adopting this programming model, the following points must be noted:
The following example illustrates the process of context save and restore within a maskable interrupt service routine. In this example, it is assumed that the
InterruptHandler()
is the actual software interrupt handler function and a single unified stack across background and interrupt handler code is intended.
__NonMaskableInterruptHandlerWrapper:
; Save off Arch regs first
STRF R7, R0
; Save off HLA shadow regs
MVS SLSA0, R0
MVS SLEA0, R1
MVS SLCNT0, R2
MVS SLSA1, R3
MVS SLEA1, R4
MVS SLCNT1, R5
MVS SLCNT0RLD, R6
STRF R6, R0
; Save off SCSR, IRP
MVC SCSR, R0
MVC IRP, R1
STRF R1, R0
; Now call the actual handler function
CALL InterruptHandler
NOP
; Restore SCSR, IRP
LDRF R0, R1
MVC R0, SCSR
MVC R1, IRP
; Restore HLA shadow regs
LDRF R0, R6
MVS R0, SLSA0
MVS R1, SLEA0
MVS R2, SLCNT0
MVS R3, SLSA1
MVS R4, SLEA1
MVS R5, SLCNT1
MVS R6, SLCNT0RLD
; Restore Arch regs into shadow copies
LDRF R0, R7
MVS R0, SR0
MVS R0, SR1
MVS R0, SR2
MVS R0, SR3
MVS R0, SR4
MVS R0, SR5
MVS R0, SR6
MVS R0, SR7
; Return from NMI ISR
BIRP
NOP