tk_ret_int

Return from Interrupt Handler

[C Language Interface]

void tk_ret_int ( ) ;


* Although this system call is defined in the form of a C language interface, it will not be called in this format if a high-level language support routine is used.
[Parameters]

None.

[Return Parameters]

* Does not return to the context issuing the system call.
[Error Codes]

* The following kind of error may be detected, but no return is made to the context issuing the system call even if the error is detected. For this reason, the error code cannot be passed directly as a system call return parameter. If an error is detected, the behavior is implementation-defined.

E_CTX	Context error (issued from other than an interrupt handler (implementation-dependent error))

[Description]

Exits an interrupt handler.

System calls invoked from an interrupt handler do not result in dispatching while the handler is running; instead, the dispatching is delayed until tk_ret_int is called to end the interrupt handler processing (delayed dispatching). Accordingly, tk_ret_int results in the processing of all dispatch requests made while the interrupt handler was running.

tk_ret_int is invoked only if the interrupt handler was defined specifying the TA_ASM attribute. In the case of a TA_HLNG attribute interrupt handler, the functionality equivalent to tk_ret_int is executed implicitly in the high-level language support routine, so tk_ret_int is not (must not be) called explicitly. As a rule, the OS is not involved in the starting of a TA_ASM attribute interrupt handler. When an interrupt is raised, the defined interrupt handler is started directly by the interrupt system of the CPU hardware. The saving and restoring of registers used by the interrupt handler must therefore be handled in the interrupt handler.

For the same reason, the stack and register states at the time tk_ret_int is issued must be the same as those at the time of entry into the interrupt handler. When using a trap instruction to implement this, the function code may be unavailable in tk_ret_int. In this case, tk_ret_int may be implemented using a trap instruction with a vector different from that used for other system calls.

[Additional Notes]

tk_ret_int is a system call that does not return to the context from which it was called. Even if an error code is returned when an error of some kind is detected, normally no error checking is performed in the context from which the system call was invoked, leaving the possibility that the program will hang. For this reason, this system call does not return even if error is detected.

Using an assembly-language return (REIT) instruction instead of tk_ret_int to exit the interrupt handler is possible if it is clear no dispatching will take place on return from the handler (the same task is guaranteed to continue executing), or if there is no need for dispatching to take place.

Depending on the CPU architecture and method of configuring the OS, it may be possible to perform delayed dispatching even when an interrupt handler exits using an assembly-language REIT instruction. In such cases, the assembly-language REIT instruction may be interpreted as though it were a tk_ret_int system call.

When tk_ret_int is called from a time event handler, whether E_CTX error is checked or not is implementation-defined. Depending on the implementation, control may return from a different type of handler.

Comments

Click here to Post a Comment