4.3 Task Exception Handling Functions

Task exception handling functions handle exception events occurring in a task, in the context of that task, interrupting normal task processing.

A task exception handler is executed as a part of the task where the task exception occurred, in the context of that task and at the protection level specified when the task was created. The task states in a task exception handler, except for those states concerning task exceptions, are the same as the states when running an ordinary task portion; and the same system calls are available.

A task exception handler can be started only when the target task is running a task portion. If the task is running any other portion when a task exception is raised, the task exception handler is started only after the task returns to the task portion. If a quasi-task portion (extended SVC) is executing when a task exception is raised, a break function corresponding to that extended SVC is called. The break function interrupts the extended SVC processing, and the task returns to the task portion. Requested task exceptions are cleared when the task exception handler is called (when the task exception handler starts running).

Task exceptions are specified by task exception codes from 0 to 31, of which 0 is the highest priority and 31 the lowest. Task exception code 0 is handled di.erently from the others, as explained below.

Task exception codes 1 to 31 :
  • These task exception handlers are not nested. A task exception (other than task exception code 0) raised while a task exception handler is running will be made pending.
  • On return from a task exception handler, the task resumes from the point where processing was interrupted by the exception.
  • It is also possible to use longjmp() or the like to jump to any point in the task without returning from the task exception handler.
Task exception code 0:
  • This exception can be nested even while a task exception handler is executing for an exception of task exception code 1 to 31. Execution of task exception code 0 handlers is not nested.
  • A task exception handler runs after setting the user stack pointer to the initial setting when the task was started. In a system without a separate user stack and system stack, however, the stack pointer is not reset to its initial setting.
  • A task exception code 0 handler does not return to task processing. The task must be terminated.

Comments