High-Level Language Support Routines

High-level language support routine capability is provided so that even if a task or handler is written in a 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 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, first 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 different 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 “}”).

However, in the case of tasks, even if a high-level language support routine is used, tasks should not end by a return from 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

[Difference with T-Kernel]

Therefore, to ensure compatibility with T-Kernel, the task should not end by a return from function. In T-Kernel, the concept of protection level exists. However, in systems with MMU, it is difficult to achieve high-level language support routines in the tasks or task exception handlers working at a protection level different from the OS, although it is possible to achieve high-level language support routines with relative ease in interrupt handlers, etc. working at the same protection level as the OS. So, in T-Kernel, task ending by a return from function is supposed to be not guaranteed. In µT-Kernel, MMU is not a precondition and no protection level exists, so the implementation may allow you to end a task by a return from function. However, taking compatibility with T-Kernel into account, you should not use this feature even if it is possible.

Comments

Click here to Post a Comment