30.12.2013 Views

T-Kernel Specification (1.B0.02)

T-Kernel Specification (1.B0.02)

T-Kernel Specification (1.B0.02)

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

4.3. TASK EXCEPTION HANDLING FUNCTIONS 69<br />

4.3 Task Exception Handling Functions<br />

Task exception handling functions handle exception events occurring in a task, in the context of that<br />

task, interrupting normal task processing.<br />

A task exception handler is executed as a part of the task where the task exception occurred, in the<br />

context of that task and at the protection level designated when the task was created. The task states in<br />

a task exception handler, except for those states concerning task exceptions, are the same as the states<br />

when running an ordinary task portion; and the same system calls are available.<br />

A task exception handler can be started only when the target task is running a task portion. If the task<br />

is running any other portion when a task exception is raised, the task exception handler is started only<br />

after the task returns to the task portion. If a quasi-task portion (extended SVC) is executing when<br />

a task exception is raised, a break function corresponding to that extended SVC is called. The break<br />

function interrupts the extended SVC processing, and the task returns to the task portion.<br />

Requested task exceptions are cleared when the task exception handler is called (when the task exception<br />

handler starts running).<br />

Task exceptions are designated by task exception codes from 0 to 31, of which 0 is the highest priority<br />

and 31 the lowest. Task exception code 0 is handled differently from the others, as explained below.<br />

Task exception codes 1 to 31 :<br />

• These task exception handlers are not nested. A task exception (other than task exception<br />

code 0) raised while a task exception handler is running will be made pending.<br />

• On return from a task exception handler, the task resumes from the point where processing<br />

was interrupted by the exception.<br />

• It is also possible to use longjmp() or the like to jump to any point in the task without<br />

returning from the task exception handler.<br />

Task exception code 0:<br />

• This exception can be nested even while a task exception handler is executing for an exception<br />

of task exception code 1 to 31. Execution of task exception code 0 handlers is not nested.<br />

• A task exception handler runs after setting the user stack pointer to the initial setting when<br />

the task was started. In a system without a separate user stack and system stack, however,<br />

the stack pointer is not reset to its initial setting.<br />

• A task exception code 0 handler does not return to task processing.<br />

terminated.<br />

The task must be<br />

Copyright c○ 2002, 2003 by T-Engine Forum<br />

T-<strong>Kernel</strong> <strong>1.B0.02</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!