POOL32A 000000 |
000 0000 0011 0100 1101 |
POOL32AXf 111100 |
6 |
20 |
6 |
IRET |
microMIPS, MCU ASE |
Interrupt Return with automated interrupt epilogue handling |
Interrupt Return with automated interrupt epilogue handling
Optionally jump directly to another interrupt vector without returning to original return address.
IRET automates some of the operations that are required when returning from an interrupt handler and can be used in place of the ERET instruction at the end of interrupt handlers. IRET is only appropriate when using Shadow Register
Sets and the EIC Interrupt mode. The automated operations of this instruction can be used to reverse the effects of the automated operations of the Auto-Prologue feature.
If the EIC interrupt mode and the Interrupt Chaining feature are used, the IRET instruction can be used to shorten the time between returning from the current interrupt handler and handling the next requested interrupt.
If the Automated Prologue feature is disabled, then IRET behaves exactly like ERET.
If either the StatusERL or StatusBEV bits are set, then IRET behaves exactly like ERET.
If Interrupt Chaining is disabled:
Interrupts are disabled. COP0 Status, SRSCtl, and EPC registers are restored from the stack. GPR 29 is incremented for the stack frame size. IRET then clears execution and instruction hazards, conditionally restores
SRSCtlCSS from SRSCtlPSS, and returns at the completion of interrupt processing to the interrupted instruction
pointed to by the EPC register.
If Interrupt Chaining is enabled:
Interrupts are disabled. COP0 Status register is restored from the stack. The priority output of the External Interrupt Controller is compared with the IPL field of the Status register.
If StatusIPL has a higher priority than or equal to the External Interrupt Controller value:
COP0 SRSCtl and EPC registers are restored from the stack. GPR 29 is incremented for the stack frame size.
IRET then clears execution and instruction hazards, conditionally restores SRSCtlCSS from SRSCtlPSS, and returns to the interrupted instruction pointed to by the EPC register at the completion of interrupt processing.
If StatusIPL has a lower priority than the External Interrupt Controller value:
The value of GPR 29 is first saved to a temporary register then GPR 29 is incremented for the stack frame size. The EIC is signalled that the next pending interrupt has been accepted. This signalling will update the
CauseRIPL and SRSCtlEICSS fields from the EIC output values. The SRSCtlEICSS field is copied to the
SRSCtlCSS field, while the CauseRIPL field is copied to the StatusIPL field. The saved temporary register is
copied to the GPR 29 of the current SRS. The KSU and EXL fields of the Status register are optionally set to zero. No barrier for execution hazards or instruction hazards is created. IRET finishes by jumping to the interrupt vector driven by the EIC.
IRET does not execute the next instruction (i.e., it has no delay slot).
The operation of the processor is UNDEFINED if IRET is executed in the delay slot of a branch or jump instruction.
The operation ofthe processor is UNDEFINED ifIRET is executed when either Shadow Register Sets are not enabled, or when the EIC interrupt mode is not enabled.
An IRET placed between an LL and SC instruction will always cause the SC to fail.
The effective addresses used for stack transactions must be naturally-aligned. If either of the two least-significant bits of the address is non-zero, an Address Error exception occurs.
IRET implements a software barrier that resolves all execution and instruction hazards created by Coprocessor 0 state changes
(for Release 2 implementations,referto the SYNCIinstruction for additionalinformation on resolving instruction hazards created by writing the instruction stream). The effects of this barrier begin with the instruction fetch and decode of the instruction at the PC to which the IRET returns.
In a Release 2 implementation, IRET does not restore SRSCtlCSS from SRSCtlPSS if StatusBEV = 1 or StatusERL = 1, because any exception that sets StatusERL to 1 (Reset, Soft Reset, NMI, or cache error) does not save SRSCtlCSS in
SRSCtlPSS. If software sets StatusERL to 1,it must be aware of the operation of an IRET that may be subsequently executed.
The stack memory transactions behave as individual LW operations with respectto exception reporting. BadVAddr would report the faulting address for an unaligned access, and the faulting word address for unprivileged access, TLB
Refill, and TLB Invalid exceptions. For TLB exceptions, the faulting word address would be reflected in the Context and EntryHi registers. The CacheError register would reflect the faulting word address for Cache Errors.
if (( IntCtlAPE == 0) | (StatusERL == 1) | (StatusBEV== 1)) Act as ERET // read Operation section of ERET description else temp = 0x4 + GPR[29] tempStatus = LoadStackWord(temp) ClearHazards() if ( (IntCtlICE == 0) | ((IntCtlICE == 1) & (tempStatusIPL>= EICRIPL)) ) temp = 0x8 + GPR[29] tempSRSCtl = LoadStackWord(temp) temp = 0x0 + GPR[29] tempEPC = LoadStackWord(temp) endif Status = tempStatus if ( (IntCtlICE == 0) | ((IntCtlICE == 1) & (tempStatusIPL>= EICRIPL)) ) GPR[29] = GPR[29] + DecodedValue(IntCtlStkDec) SRSCtlPSS = tempSRSCtlPSS SRSCtlESS = tempSRSCtlESS EPC = tempEPC temp = EPC StatusEXL = 0 if (ArchitectureRevision >= 2) and (SRSCtlHSS > 0) and (StatusBEV = 0) then SRSCtlCSS = SRSCtlPSS endif if IsMicroMIPSImplemented() then PC = temp31..1 || 0 ISAMode = temp0 else endif LLbit = 0 CauseIC = 0 ClearHazards() else CauseRIPL = EICRIPL SRSCtlEICSS = EICSS temp29 = GPR[29] GPR[29] = GPR[29] + DecodedValue(IntCtlStkDec) StatusIPL = CauseRIPL SRSCtlCSS = SRSCtlEICSS NewShadowSet = SRSCtlEICSS GPR[29] = temp29 if (IntCtlClrEXL == 1) StatusEXL = 0 StatusKSU = 0 endif LLbit = 0 CauseIC = 1 ClearHazards() PC = CalcIntrptAddress() endif endif function LoadStackWord(vaddr) if vAddr1..0 != 02 then SignalException(AddressError) endif (pAddr, CCA) = AddressTranslation (vAddr, DATA, LOAD) memword = LoadMemory (CCA, WORD, pAddr, vAddr, DATA) LoadStackWord = memword endfunction LoadStackWord function CalcIntrptAddress() if StatusBEV == 1 vectorBase = 0xBFC0.0200 else if ( ArchitectureRevision >= 2) vectorBase = EBase31..12 || 011) else vectorBase = 0x8000.0000 endif endif if (CauseIV == 0) vectorOffset = 0x180 else if (StatusBEV = 1) or (IntCtlVS = 0) vectorOffset = 0x200 else if ( Config3VEIC == 1 and EIC_Option == 1) VectorNum = CauseRIPL elseif (Config3VEIC == 1 and EIC_Option == 2) VectorNum = EIC_VectorNum elseif (Config3VEIC == 0 ) endif if (Config3VEIC == 1 and EIC_Option == 3) vectorOffset = EIC_VectorOffset else vectorOffset = 0x200 + (VectorNum x (IntCtlVS || 05)) endif endif endif CalcIntrptAddress = vectorBase | vectorOffset if (Config3ISAOnExec) CalcIntrptAddress = CalcIntrptAddress31..1 || 1 endif endfunction CalcIntrptAddress
Coprocessor Unusable Exception, TLB Refill, TLB Invalid, Address Error, Watch, Cache Error, Bus Error
Exceptions