![Intel NIOS II Owner Reference Manual Download Page 67](http://html1.mh-extra.com/html/intel/nios-ii/nios-ii_owner-reference-manual_2071826067.webp)
The
sstatus
register is present in the Nios II core if both the EIC interface and
shadow register sets are implemented. There is one copy of
sstatus
for each shadow
register set.
When the Nios II processor takes an interrupt, if a shadow register set is requested
(RRS = 0) and the MMU is not in exception handler mode (
status.EH
= 0), the
processor copies
status
to
sstatus
.
For details about RRS, refer to "Requested Register Set”.
For details about
status.EH
, refer to the Nios II Processor Status After Taking
Exceptions Table.
Related Information
•
The status Register
on page 48
•
Exceptions and Processor Status
on page 91
•
Requested Register Set
on page 81
•
The status Register
on page 48
3.4.3.1.1. Changing Register Sets
Modifying
status.CRS
immediately switches the Nios II processor to another register
set. However, software cannot write to
status.CRS
directly. To modify
status.CRS
,
insert the desired value into the saved copy of the
status
register, and then execute
the
eret
instruction, as follows:
•
If the processor is currently running in the normal register set, insert the new
register set number in
estatus.CRS
, and execute
eret
.
•
If the processor is currently running in a shadow register set, insert the new
register set number in
sstatus.CRS
, and execute
eret
.
Before executing
eret
to change the register set, system software must set individual
external interrupt masks correctly to ensure that registers in the shadow register set
cannot be corrupted. If an interrupt is assigned to the register set, system software
must ensure that one of the following conditions is true:
•
The ISR is written to preserve register contents.
•
The individual interrupt is disabled. The method for disabling an individual external
interrupt is specific to the EIC implementation.
3.4.3.1.2. Stacks and Shadow Register Sets
Depending on system requirements, the system software can create a dedicated stack
for each register set, or share a stack among several register sets. If a stack is
shared, the system software must copy the stack pointer each time the register set
changes. Use the
rdprs
instruction to copy the stack register between the current
register set and another register set.
3.4.3.2. Initialization with Shadow Register Sets
At initialization, system software must carry out the following tasks to ensure correct
software functioning with shadow register sets:
3. Programming Model
NII-PRG | 2018.04.18
Nios II Processor Reference Guide
67