
CHAPTER 8 INTERRUPT MANAGEMENT
User’s Manual U14833EJ2V0UM
93
8.3
Saving/Restoring Registers
Registers are saved in the initial section of the interrupt processing in accordance with the function call conventions
of the V
R
Series C compiler from either Green Hills Software, Inc. or Metrowerks Corp. When the interrupt processing
involves the execution of processing described in C language, because the function call conventions stipulate that the
preprocessing and postprocessing values stored in the save register (s0 to s7) must be the same, there is no
particular need to save this register. The kernel will save and restore the gp, fp, and sp registers as required. For
other registers (at, v0 to v1, t0 to t9, ra, epc, status), operation after being restored from an interrupt is not guaranteed
unless their values are saved when the interrupt is generated and then returned to their original values when restored
from interrupt processing.
Note that the size of stack consumed when these registers are saved is not included in the size of the stack
automatically augmented by the kernel when a task is created.
8.4
Interrupt Generation Notification
In order to utilize the services provided by the kernel, such as issuing service calls via interrupt processing carried
out when an interrupt is generated, the kernel must be notified of the activation of interrupt processing. However,
there may also be cases when it is desirable to terminate interrupt processing without receiving services from the
kernel in order to speed up the processing. Cautions to be observed when using these two types of processing are
outlined below.
(1) Terminating interrupt processing without using kernel’s services
In this case, it is unnecessary to inform the kernel of the activation of interrupt processing. However, the user
must describe the entire processing, from activate to finish. Because the kernel cannot participate at all,
service call issuance and multiple interrupt acknowledgement are completely disabled in the processing. Note
also that if the interrupt processing consumes the stack, unless stack switching is specified, operations will be
carried out on the task stack, making it imperative that the entire task stack be augmented by the size of the
stack consumed by this processing. It is therefore recommended to employ this type of processing only for
very light processing, such as simple reading and writing data from/to I/O.
(2) Using kernel’s services in interrupt processing
The kernel can be notified of the activation of interrupt processing by describing the kernel’s internal function
“_kernel_int_handle” in the initial section of the interrupt processing. Once notified, the kernel performs
processing such as switching the stack to the interrupt stack, and putting the service calls described later into
an activation enabled state. Interrupt processing performed by the user is enabled when the function
“_user_int_handle” is called back from the kernel.
In this function, issuance of service calls activation with i and multiple interrupt acknowledgement are enabled,
allowing execution of the main body of interrupt processing that uses the kernel’s services (without necessarily
having to activate an interrupt service routine).