3.3 High-Level Language Support Routines
High-level language support routine capability is provided so that even if a task or handler is written in high-level language, the kernel-related processing can be kept separate from the language environment-related processing. Whether or not a high-level language support routine is used is specified in TA_HLNG, one of thE_OBJect attributes and handler attributes.
When TA_HLNG is not specified, a task or handler is started directly from the start address passed in a parameter to tk_cre_tsk or tk def ?; whereas when TA_HLNG is specified, .rst the high-level language startup processing routine (high-level language support routine) is started, then from this routine an indirect jump is made to the task start address or handler address passed in a parameter to tk_cre_tsk or tk def ?. Viewed from the OS, the task start address or handler address is a parameter pointing to the high-level language support routine. Separating the kernel processing from the language environment processing in this way facilitates support for di.erent language environments.
Use of high-level language support routines has the further advantage that when a task or handler is written as a C language function, a system call for task exit or return from a handler can be executed automatically, simply by performing a function return (return or “}”).
In a system that uses an MMU, however, whereas it is relatively easy to realize a high-level language support routine in the case of an interrupt handler or the like that runs at the same protection level as the OS, it is more di.cult in the case of a task or task exception handler running at a di.erent protection level than the OS. For this reason, when a high-level language support routine is used for a task, there is no guarantee that the task will exit by a return from the function. In the case of a task exception handler, the high-level language support routine is supplied as source code and is to be embedded in the user program.
The internal working of a high-level language support routine is as illustrated in Figure 3.1.
Figure 3.1: Behavior of High-Level Language Support Routine

Comments