JP2008305016A - Information processor - Google Patents

Information processor Download PDF

Info

Publication number
JP2008305016A
JP2008305016A JP2007149527A JP2007149527A JP2008305016A JP 2008305016 A JP2008305016 A JP 2008305016A JP 2007149527 A JP2007149527 A JP 2007149527A JP 2007149527 A JP2007149527 A JP 2007149527A JP 2008305016 A JP2008305016 A JP 2008305016A
Authority
JP
Japan
Prior art keywords
task
exception
kernel
routine
processing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2007149527A
Other languages
Japanese (ja)
Inventor
Hisaya Miyamoto
久也 宮本
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Toshiba Corp
Original Assignee
Toshiba Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Toshiba Corp filed Critical Toshiba Corp
Priority to JP2007149527A priority Critical patent/JP2008305016A/en
Publication of JP2008305016A publication Critical patent/JP2008305016A/en
Pending legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To provide an information processor for executing exception processing registered at each task with instantaneousness under the management of a kernel. <P>SOLUTION: An information processor 1 is provided with: a TCB 25 as a storage region managed by the kernel for controlling the execution of a plurality of tasks, and for storing attribute information showing whether or not each task has an exception processing route of each task; and the kernel 21. When any exception is generated, the kernel 21 decides whether or not the task when the exception is generated owns an exception processing routine of each task by referring to the attribute information of the TCB 25, and when deciding that the task when the exception is generated does not own the exception processing routine of each task, executes the exception processing managed by the kernel, and when deciding that the task when the exception is generated owns the exception processing routine of each task, executes the exception processing of each task owned by the task when the exception is generated. <P>COPYRIGHT: (C)2009,JPO&INPIT

Description

本発明は、情報処理装置に関し、特に、例外処理機能を有する情報処理装置に関する。   The present invention relates to an information processing apparatus, and more particularly to an information processing apparatus having an exception handling function.

従来より、コンピュータにおいてはいわゆる例外処理が行われている。例外処理とは、通常、中央処理装置(以下、CPUという)がプログラムを実行中に発生するもので、プロセスの中断をともなう。いわゆる例外処理には、2つのタイプがある。1つは、アプリケーションプログラムの継続的な実行を保証するための処理の実行要求をイベントとしてカーネル(本書において用語”カーネル”はいわゆる”オペレーティングシステム”或いは”OS”と同じ意味で用いられる)に通知するものであって、カーネルは発生したイベント、即ち例外要因、に対応する例外処理を起動するものである。この例外処理によって、発生した例外に対し適切な処理が施され、適切な処理が施された後、例外の発生元であるアプリケーションプログラムの実行が継続される。もう1つは、異常の検出であって、カーネルは発生したイベント、即ち、例外要因に対し、システム全体を停止させるべきか、或いは、例外を発生させたアプリケーションプログラムのみを停止すべきかを判断し、適切な処理を施すものである。どちらの例外処理もアプリケーションプログラムやシステムそれ自身を機能させるために、或いは、安定的に動作させるために重要な処理となる。   Conventionally, so-called exception processing has been performed in computers. Exception handling usually occurs during execution of a program by a central processing unit (hereinafter referred to as a CPU) and involves interruption of the process. There are two types of so-called exception handling. One is to notify the kernel (in this document, the term “kernel” is used in the same meaning as the so-called “operating system” or “OS”) as an event of a process execution request to guarantee continuous execution of an application program. The kernel starts exception processing corresponding to an event that has occurred, that is, an exception factor. By this exception processing, appropriate processing is performed on the generated exception, and after the appropriate processing is performed, the execution of the application program that is the generation source of the exception is continued. The other is the detection of an anomaly, and the kernel determines whether to stop the entire system or only the application program that generated the exception for the event that occurred, ie, the exception factor. Appropriate processing is performed. Both exception processes are important for making the application program and the system itself function or for stable operation.

一般に、例外処理では、発生し得る例外の要因1つに対し、対応する1つの専用の例外処理ルーチンが割り当てられる。この例外処理ルーチンは、システムによって規定されるものであって、アプリケーションプログラムが例外処理の内容を規定するものではない。   In general, in exception handling, a corresponding dedicated exception handling routine is assigned to one possible cause of exception. This exception handling routine is defined by the system, and the application program does not define the contents of exception handling.

例えば、MIPSアーキテクチャにおける例外処理の一般的な流れは次のようになる。先ず、タスクの実行中に例外が発生すると、ハードウェアであるプロセッサが例外の発生を検知し、例外の発生した時点において実行されていた命令の仮想アドレスがEPCレジスタに記録される。さらに、発生した例外の種別である例外コードがCauseレジスタの所定のフィールドに記録される。なお、このとき、例えば、アドレスの参照行為が例外の発生原因である場合には、BadVaddrレジスタにその参照先のアドレスが記録される。CPUの状態を制御するStatusレジスタには、例外状態を示すEXLbitが立ち、CPUの実行状態は、カーネルモードへと遷移する。以上が例外発生時のCPU内のコプロセッサレジスタの基本動作である。   For example, the general flow of exception handling in the MIPS architecture is as follows. First, when an exception occurs during the execution of a task, a hardware processor detects the occurrence of the exception, and the virtual address of the instruction being executed at the time when the exception occurs is recorded in the EPC register. Further, an exception code, which is the type of exception that has occurred, is recorded in a predetermined field of the Cause register. At this time, for example, when the address reference action is the cause of the exception, the address of the reference destination is recorded in the BadVaddr register. The EXLbit indicating the exceptional state is set in the Status register that controls the CPU state, and the CPU execution state transitions to the kernel mode. The above is the basic operation of the coprocessor register in the CPU when an exception occurs.

一方、ソフトウェアであるカーネルの基本動作は次のようになる。タスクの実行中に例外が発生すると、プロセッサにおいて例外の発生したアドレスがEPCレジスタに記録される。このとき、プログラムカウンタ(以下、PCという)は例外ベクタと呼ばれる所定のアドレスに遷移する。このアドレス遷移により、カーネルは例外の発生を検知し、例外処理を開始する。   On the other hand, the basic operation of the kernel, which is software, is as follows. If an exception occurs during task execution, the address where the exception occurred in the processor is recorded in the EPC register. At this time, the program counter (hereinafter referred to as PC) transitions to a predetermined address called an exception vector. With this address transition, the kernel detects the occurrence of an exception and starts exception processing.

カーネルは、コンテキストを退避させ、Causeレジスタに格納されている発生した例外の例外コードを読み出し、発生した例外の種類を特定して、発生した例外の例外コードに対応する例外処理を実行する。カーネルは、例外処理の実行が終わると、コンテキストを戻して例外処理からの復帰処理を実行する。これにより、例外の発生元のタスクに復帰してタスクの実行が継続される。   The kernel saves the context, reads the exception code of the generated exception stored in the Cause register, specifies the type of the generated exception, and executes exception processing corresponding to the exception code of the generated exception. When the execution of exception processing ends, the kernel returns the context and executes return processing from exception processing. As a result, the task is resumed by returning to the task from which the exception occurred.

実行される例外処理は、システム起動時に所定のアプリケーションプログラムインターフェイス(以下、APIという)を用いて登録された処理ルーチンである。ここでは、登録された例外処理の管理がテーブルによってなされていると仮定する。つまり、例外処理の登録は、この管理テーブルに対する例外処理ルーチンのアドレスの登録行為であって、この例外処理管理テーブルの参照は、例外コードをオフセット値として行われる。この例外処理管理テーブルは、カーネルによって管理され、例外処理管理テーブルを、アプリケーションプログラムが直接参照することは通常許されていない。   The exception processing to be executed is a processing routine registered using a predetermined application program interface (hereinafter referred to as API) when the system is activated. Here, it is assumed that registered exception handling is managed by a table. That is, the registration of exception processing is an act of registering the address of the exception processing routine with respect to this management table, and the exception processing management table is referred to using the exception code as an offset value. This exception handling management table is managed by the kernel, and it is normally not permitted for an application program to directly refer to the exception handling management table.

例外処理ルーチンはシステムの初期化段階においてカーネルに対し専用の手段によって登録される。例えば、μITRON仕様のカーネルであれば、”def_exc()”というAPIが例外処理の登録用に規定されている。このAPIの目的は、1つの例外要因に対して1つの例外処理ルーチンを対応付けることであって、この対応付けはシステムにおいて共通となる。   The exception handling routine is registered to the kernel by a dedicated means at the system initialization stage. For example, in the μITRON specification kernel, an API “def_exc ()” is defined for exception processing registration. The purpose of this API is to associate one exception processing routine with one exception factor, and this association is common in the system.

ところが、以上のような一般的な例外処理の実装においては、システム上で動作するアプリケーションプログラムが決まらないうちに、システムに例外処理が実装されることもある。そのため、システム上において動作するアプリケーションプログラムの特性及び要求を全て満たす例外処理を実装することは不可能である。つまり、システムが提供する各例外処理の処理内容と個別のアプリケーションプログラムが必要とする例外処理に対する要求は必ずしも一致しないこともある。   However, in general implementation of exception handling as described above, exception handling may be implemented in the system before an application program operating on the system is determined. Therefore, it is impossible to implement exception handling that satisfies all the characteristics and requirements of application programs that run on the system. In other words, the processing contents of each exception processing provided by the system may not necessarily match the requirements for exception processing required by individual application programs.

例えば、整数演算におけるオーバーフローが発生した場合、システムのオーバーフローに対する処理が例外の無効化とアプリケーションプログラムの継続処理とであったと仮定する。一方、あるアプリケーションプログラムにおいては、そのプログラム中の整数演算について飽和演算として扱いたいというニーズがあったと仮定する。より具体的に述べると、そのアプリケーションプログラムにおいて整数演算のオーバーフローが発生した場合、整数演算を強制終了し、更に、演算結果を特定の上限値として出力させる必要があるとする。すなわち、この場合は、システムに実装された例外処理とアプリケーションプログラムの要求する例外処理とのニーズが一致しない例である。   For example, when an overflow occurs in an integer operation, it is assumed that processing for the system overflow is invalidation of an exception and continuation processing of an application program. On the other hand, in an application program, it is assumed that there is a need to treat integer operations in the program as saturation operations. More specifically, when an integer operation overflow occurs in the application program, it is necessary to forcibly terminate the integer operation and to output the operation result as a specific upper limit value. That is, in this case, the needs of the exception processing implemented in the system and the exception processing required by the application program do not match.

このような問題に対し、例えばμITRON4.0仕様においてタスク例外処理という機能が規定されている。この機能は、実行中のタスク個別に定義されたタスク例外処理を実行要求された時点において、そのタスクコンテキスト上において実行、すなわちそのタスク自らが実行するための仕組みによって実現される。   For such problems, for example, a function called task exception handling is defined in the μITRON4.0 specification. This function is realized by a mechanism that is executed on the task context at the time when execution of task exception processing defined for each task being executed is requested, that is, the task itself executes.

しかしながら、アプリケーションプログラムの実行にかかわる例外処理とは、例外が発生した時点において適切に処理される必要があり、アプリケーションに依存する側面とアーキテクチャに依存する側面とを併せ持つ処理である。   However, exception processing related to execution of an application program is processing that needs to be appropriately processed when an exception occurs, and has both an application-dependent aspect and an architecture-dependent aspect.

従って、スタック、ヒープ等のタスクコンテキスト上において動作するコードとして個別の例外処理が規定することも可能であるが、そもそも例外処理は、即時性の観点からカーネルモードによって動作する特権ルーチンとすべきであり、更には、カーネルの権限を越えてカーネルの処理すべき例外処理がブロックされるべきではない。   Therefore, individual exception handling can be specified as code that operates on the task context such as stack and heap. However, exception handling should be a privileged routine that operates in kernel mode from the standpoint of immediateness. In addition, exception handling that should be handled by the kernel should not be blocked beyond kernel authority.

従来より、システムが提供する例外処理とアプリケーションプログラムが必要とする例外処理との不一致については問題視されている。そのため、複数の例外処理に対し識別子(以下、IDという)を付与し、その個別にIDが付与された複数の例外処理を管理するハードウェアが提案されている(例えば、特許文献1参照)。   Conventionally, the inconsistency between the exception handling provided by the system and the exception handling required by the application program has been regarded as a problem. For this reason, hardware has been proposed in which identifiers (hereinafter referred to as IDs) are assigned to a plurality of exception processes, and a plurality of exception processes to which IDs are individually assigned are managed (see, for example, Patent Document 1).

この提案によると、ソフトウェアは例外処理のIDをそのハードウェアに登録すると、該当する例外が発生した時に、発生した例外に対応するIDが参照され、参照されたIDと一致する例外処理が選択され、メモリへロードされる。その結果、ソフトウェアが必要とする例外処理がCPUによって実行され得る。   According to this proposal, when the software registers an exception handling ID in the hardware, when the corresponding exception occurs, the ID corresponding to the exception that occurred is referenced, and the exception handling that matches the referenced ID is selected. Loaded into memory. As a result, exception handling required by the software can be executed by the CPU.

この場合、システム設計時に静的にIDを例外処理に付与し、IDが付与された例外処理を複数のソフトウェア間において共有する。そのため、ソフトウェアを含めたシステム構成は限定的になるという問題がある。   In this case, an ID is statically assigned to exception processing at the time of system design, and the exception processing to which the ID is assigned is shared among a plurality of software. Therefore, there is a problem that the system configuration including software is limited.

また、アプリケーション毎に実装する例外処理をアーキテクチャに非依存なレベルまで抽象化し、複数の例外処理環境を容易に組み込むことが可能なデータ処理方法が提供されている(例えば、特許文献2参照)。   There is also provided a data processing method that can abstract exception processing implemented for each application to an architecture-independent level and easily incorporate a plurality of exception processing environments (see, for example, Patent Document 2).

この提案によると、アプリケーション毎に実装する例外処理は、アーキテクチャに非依存なレベルまで抽象化される。そして、例外が発生すると、カーネルオブジェクトとアプリケーション内の例外要求メッセージ受信オブジェクトとの間に例外の発生を通知するための通信が発生し、更に、例外要求メッセージ受信オブジェクトが、例外処理の実体であるオブジェクトに例外処理要求を送信するというオーバーヘッドが発生する。この方法によると、移植性は向上するが、本来、例外処理が担うアーキテクチャに依存した処理を実行できないという問題がある。   According to this proposal, exception handling implemented for each application is abstracted to an architecture-independent level. When an exception occurs, communication for notifying the occurrence of the exception occurs between the kernel object and the exception request message receiving object in the application, and the exception request message receiving object is the entity of the exception processing. The overhead of sending an exception handling request to the object occurs. According to this method, portability is improved, but there is a problem that processing that depends on the architecture that exception handling is originally performed cannot be executed.

また、例外が発生したPCのアドレスを基にカーネルが対応する例外処理を選択する情報処理装置が提供されている(例えば、特許文献3参照)。   Further, an information processing apparatus is provided that selects an exception process corresponding to a kernel based on the address of a PC in which an exception has occurred (see, for example, Patent Document 3).

しかし、この提案によると、1つの例外要因に対し、アドレス毎に例外処理を規定することが可能となるが、アドレスに一致する例外処理の検索が膨大となり、例外の発生から対応する処理の起動までの時間を保証できないという問題がある。
特開2003−58381号公報 特開平11−53223号公報 特開平7−44398号公報
However, according to this proposal, it is possible to specify exception processing for each address for one exception factor, but the search for exception processing that matches the address becomes enormous, and the corresponding processing is started when an exception occurs. There is a problem that the time until is not guaranteed.
JP 2003-58381 A Japanese Patent Laid-Open No. 11-53223 JP 7-44398 A

そこで、本発明は、タスク毎に登録された例外処理をカーネルの管理の下、即時性を持って実行することができる情報処理装置を提供することを目的とする。   Accordingly, an object of the present invention is to provide an information processing apparatus that can execute exception processing registered for each task with immediateness under the management of the kernel.

本発明の一態様によれば、システムに含まれる複数のタスクの実行を制御するためにカーネルによって管理される記憶領域であって、各タスクに対応して設けられ、前記各タスクがタスク毎の例外処理ルーチンを有するか否かを示す属性情報を記憶可能なタスク属性情報記憶部と、例外が発生したときに前記タスク属性情報記憶部の前記属性情報を参照し、前記例外が発生したときのタスクが、前記タスク毎の例外処理ルーチンを有するか否かを判定し、前記例外が発生したときのタスクが前記タスク毎の例外処理ルーチンを有しない場合は、前記カーネルの管理する例外処理を実行し、前記例外が発生したときのタスクが前記タスク毎の例外処理ルーチンを有する場合は、前記例外が発生したときのタスクの有する前記タスク毎の例外処理ルーチンを実行する例外処理実行部とを有することを特徴とする情報処理装置を提供することができる。   According to one aspect of the present invention, a storage area managed by a kernel for controlling execution of a plurality of tasks included in a system, provided corresponding to each task, wherein each task is provided for each task. A task attribute information storage unit capable of storing attribute information indicating whether or not to have an exception handling routine, and referring to the attribute information in the task attribute information storage unit when an exception occurs, and when the exception occurs It is determined whether or not the task has an exception handling routine for each task. If the task when the exception occurs does not have the exception handling routine for each task, the exception handling managed by the kernel is executed. If the task when the exception occurs has an exception processing routine for each task, the exception processing for each task included in the task when the exception occurs It is possible to provide an information processing apparatus characterized by having a exception process execution unit for executing routines.

本発明の情報処理装置によれば、タスク毎に登録された例外処理をカーネルの管理の下、即時性を持って実行することができる。   According to the information processing apparatus of the present invention, exception processing registered for each task can be executed with immediacy under the management of the kernel.

以下、図面を参照して本発明の実施の形態を説明する。
(第1の実施の形態)
まず図1及び図2に基づき、本実施の形態に係る情報処理装置の構成を説明する。図1は、本実施の形態に係る情報処理装置のハードウェアの構成を示す構成図である。
Embodiments of the present invention will be described below with reference to the drawings.
(First embodiment)
First, based on FIG.1 and FIG.2, the structure of the information processing apparatus which concerns on this Embodiment is demonstrated. FIG. 1 is a configuration diagram showing a hardware configuration of the information processing apparatus according to the present embodiment.

本実施の形態の情報処理装置1は、CPU11と、RAM12と、ROM13と、入力インターフェイス(以下、入力I/Fという)14と、出力インターフェイス(以下、出力I/Fという)15と、通信インターフェイス(以下、通信I/Fという)16と、バス17とを備えて構成されている。CPU11と、RAM12と、ROM13と、入力I/F14と、出力I/F15と、通信I/F16とは、互いに、バス17を介して接続されている。また、入力部18としてのキーボード及びマウスが入力I/F14に接続され、出力部19としてのディスプレイ及びプリンタが出力I/F15に接続されている。   The information processing apparatus 1 according to the present embodiment includes a CPU 11, a RAM 12, a ROM 13, an input interface (hereinafter referred to as an input I / F) 14, an output interface (hereinafter referred to as an output I / F) 15, and a communication interface. (Hereinafter, referred to as a communication I / F) 16 and a bus 17. The CPU 11, RAM 12, ROM 13, input I / F 14, output I / F 15, and communication I / F 16 are connected to each other via a bus 17. A keyboard and mouse as the input unit 18 are connected to the input I / F 14, and a display and a printer as the output unit 19 are connected to the output I / F 15.

ユーザが入力部18を操作すると、入力部18から出力される信号が入力I/F14及びバス17を介してCPU11へ入力される。CPU11は、入力された信号に基づきRAM12上の対応するプログラムを実行する(同RAM12上のプログラムはシステムの起動時にROM13に格納されていたプログラムを展開したものであったり、必要に応じてハードディスクドライブのような外部記憶装置に格納されていたプログラムを上記入力に応じて動的に展開するものであったりする)。その後、プログラムの実行結果は、バス17及び出力I/F15を介して出力部19へ出力される。従って、ユーザが入力部18から実行すべきアプリケーションプログラムを指定すると、その指定されたアプリケーションプログラムがCPU11によって実行され、その実行結果が出力部19に出力される。   When the user operates the input unit 18, a signal output from the input unit 18 is input to the CPU 11 via the input I / F 14 and the bus 17. The CPU 11 executes a corresponding program on the RAM 12 based on the input signal (the program on the RAM 12 is an expanded version of the program stored in the ROM 13 when the system is started up, or a hard disk drive as necessary. In other words, the program stored in the external storage device is dynamically expanded according to the input). Thereafter, the execution result of the program is output to the output unit 19 via the bus 17 and the output I / F 15. Accordingly, when the user designates an application program to be executed from the input unit 18, the designated application program is executed by the CPU 11, and the execution result is output to the output unit 19.

図2は、本実施の形態に係る情報処理装置のソフトウェアの構成を示すブロック図である。情報処理装置1は、図2に示すように、CPU11と、CPU11上において実行されるプログラム群とから構成されているアプリケーションシステムである。そのシステムにおいて実行されるプログラム群は、カーネル21と、カーネル21上に設けられたAPI22と、API22上に設けられた複数のタスク24a〜24nと、システムの例外処理プログラム26と、割り込みサービスルーチン(以下、ISRという)27とを含んで構成されている。   FIG. 2 is a block diagram showing a software configuration of the information processing apparatus according to the present embodiment. As illustrated in FIG. 2, the information processing apparatus 1 is an application system including a CPU 11 and a program group executed on the CPU 11. A program group executed in the system includes a kernel 21, an API 22 provided on the kernel 21, a plurality of tasks 24a to 24n provided on the API 22, an exception handling program 26 of the system, and an interrupt service routine ( (Hereinafter referred to as “ISR”) 27.

システムの例外処理プログラム26は、後述するclassic属性のタスクの例外処理を実行するためのプログラムが記述されている。ISR27は、カーネルによって検出された割り込みの要因に対応して実行される割り込み処理ルーチン(Interrupt Service Routine)である。   The system exception handling program 26 describes a program for executing exception handling of a task having a classic attribute, which will be described later. The ISR 27 is an interrupt processing routine (Interrupt Service Routine) that is executed in response to an interrupt factor detected by the kernel.

また、タスク24bは、タスク内に定義された同タスク専用の例外処理プログラム23を有する。例外処理プログラム23は、後述するenhanced属性のタスクの例外処理を実行するためのプログラムが記述されている。   Further, the task 24b has an exception processing program 23 dedicated to the task defined in the task. The exception processing program 23 describes a program for executing exception processing of an enhanced attribute task described later.

複数のタスク24a〜24nは、それぞれカーネル21がタスクの制御を行うことを目的とした所定のデータ構造を有するタスク制御部ブロック(以下、TCBという)25a〜25nを含んで構成されている。   Each of the plurality of tasks 24a to 24n includes task control block (hereinafter referred to as TCB) 25a to 25n having a predetermined data structure for the purpose of the kernel 21 controlling the task.

TCB25a〜25nは、後述するように、カーネルによって管理される記憶領域である。TCB25a〜25nには、各タスクに対応して設けられ、各タスクがタスク毎の例外処理ルーチンを有すか否かを示す属性情報と、発生した例外と例外処理ルーチンとの対応を示す対応情報とが記憶される。対応情報は、テーブル形式の情報として、例外処理管理テーブルに記憶される。従って、TCB25a〜25nは、タスクの属性情報を記憶するタスク属性記憶部を構成する。   The TCBs 25a to 25n are storage areas managed by the kernel, as will be described later. The TCBs 25a to 25n are provided corresponding to each task, attribute information indicating whether each task has an exception handling routine for each task, and correspondence information indicating a correspondence between the generated exception and the exception handling routine, Is memorized. The correspondence information is stored in the exception handling management table as table format information. Therefore, the TCBs 25a to 25n constitute a task attribute storage unit that stores task attribute information.

また、カーネル21は、システム全体の例外処理、すなわちカーネルが管理する例外処理ルーチンを実行するための、発生した例外と例外処理ルーチンとの対応を示す対応情報が記憶された例外処理管理テーブル21tを有する。   Further, the kernel 21 stores an exception processing management table 21t in which correspondence information indicating correspondence between the generated exception and the exception processing routine for executing the exception processing of the entire system, that is, the exception processing routine managed by the kernel is stored. Have.

カーネルがアプリケーションに対して提供する機能であるAPI22及びカーネル自身は、TCB25a〜25nへのタスクコンテキストの保存、タスクの属性及び状態の記述、特定の状態を管理するためのキューへの接続等を行う。
例えば、μITRON仕様のカーネルが提供するタスク生成に関するAPIとして、”cre_tsk()”が規定されている。プログラマは、この”cre_tsk()”を用い、プログラマが作成した関数をタスクとしてカーネルに登録する。このAPIが実行されると、タスクの属性に合わせたコンテキストの初期化及びスタック領域の確保が行われ、その生成されるタスクの属性を上記APIの引数として記述することができる。
The API 22 and the kernel itself, which are functions provided to the application by the kernel, store task contexts in the TCBs 25a to 25n, describe task attributes and states, connect to queues for managing specific states, and the like. .
For example, “cre_tsk ()” is defined as an API related to task generation provided by the μITRON specification kernel. The programmer uses “cre_tsk ()” to register the function created by the programmer in the kernel as a task. When this API is executed, context initialization and a stack area are secured in accordance with the task attributes, and the generated task attributes can be described as arguments of the API.

本実施の形態では、タスクの属性が拡張され、従来のタスクにはclassic属性が付与され、本実施の形態の対象となるタスクにはenhanced属性が付与される。タスク生成時にenhanced属性が付与された場合、TCBが拡張され、カーネルの有する例外処理管理テーブル21tと同じ構造のテーブルがコピーされ、TCBに追加される。すなわち、enhanced属性のタスクのコンテキストの初期化時に、カーネルの有する例外処理管理テーブル21tの内容がコピーされて、enhanced属性のタスクのTCB上に構成された例外処理管理テーブルに登録される。ゆえに、enhanced属性のタスクの生成は、システムが提供する例外処理プログラムのカーネルへの登録完了後に実施しなければならないという制約条件が存在する。この制約条件は、enhanced属性のタスクがシステムの構成要素ではなく、アプリケーションプログラムである前提があり、実質制約とはならない。   In the present embodiment, task attributes are expanded, a classic attribute is assigned to a conventional task, and an enhanced attribute is assigned to a task that is a target of the present embodiment. When the enhanced attribute is given at the time of task generation, the TCB is expanded, and a table having the same structure as the exception handling management table 21t of the kernel is copied and added to the TCB. That is, when the context of the enhanced attribute task is initialized, the contents of the exception handling management table 21t of the kernel are copied and registered in the exception handling management table configured on the TCB of the enhanced attribute task. Therefore, there is a constraint that generation of an enhanced attribute task must be performed after the registration of the exception handling program provided by the system in the kernel is completed. This constraint condition assumes that an enhanced attribute task is not a system component but an application program, and is not a substantial constraint.

以上のように、タスク固有の例外処理ルーチンを有するタスクに対して、発生した例外と例外処理ルーチンとの対応付けるための対応情報を有する例外処理管理テーブルが、タスクの属性情報と共に、対応するTCBに記憶される。   As described above, for a task having a task-specific exception handling routine, an exception handling management table having correspondence information for associating the generated exception with the exception handling routine is displayed in the corresponding TCB along with the task attribute information. Remembered.

カーネルは、一般に実行中のタスクを管理する機能を有している。この機能は実行中のタスクに付与されたIDを専用の管理領域に記録し、タスク間で実行権が移り変わる度に実行権を得たタスクのIDが記録される。さらに、カーネルは実行中のプログラムがタスクであるか、割り込み処理及び例外処理等のタスク独立部であるかの区別を行う。この実行中のプログラムの管理はカーネルの基本機能であり、特殊な機能ではない。   The kernel generally has a function of managing a task being executed. This function records the ID assigned to the task being executed in a dedicated management area, and records the ID of the task that has obtained the execution right every time the execution right changes between tasks. Further, the kernel distinguishes whether the program being executed is a task or a task-independent portion such as interrupt processing and exception processing. Management of this running program is a basic kernel function, not a special function.

図3は、初期化における例外処理の登録の手順を説明するための図である。ここで、図2に示すタスク24aにclassic属性が付与されたものとする。以下、タスク24aは、タスクAと呼ぶ。タスクAの属性は、タスクの生成用APIの”cre_tsk()”により指定することができる。例えば、タスクAがclassic属性であれば、この”cre_tsk(A,…)”において、タスクAをclassic属性として指定することができる。タスクAの生成過程において、カーネルはタスクAを制御するためのデータ構造を有するTCB Aを生成する。TCB Aには、タスク制御情報及びコンテキストが格納される。   FIG. 3 is a diagram for explaining a procedure for registering exception processing in initialization. Here, it is assumed that the classic attribute is given to the task 24a shown in FIG. Hereinafter, the task 24a is referred to as a task A. The attribute of task A can be specified by "cre_tsk ()" of the task generation API. For example, if the task A has the classic attribute, the task A can be designated as the classic attribute in this “cre_tsk (A,...)”. In the process of generating task A, the kernel generates TCB A having a data structure for controlling task A. TCB A stores task control information and context.

一方、図2に示すタスク24bにenhanced属性が付与されたものとする。以下、タスク24bは、タスクBと呼ぶ。例えば、タスクBがenhanced属性であるので、この”cre_tsk(B,…)”において、タスク生成用のAPIにより、タスクBをenhanced属性として指定することができる。さらに、そのAPIにより、タスクBの生成過程において、カーネル21は、タスクBを制御するためのデータ構造を有するTCB Bを生成するが、classic属性のタスクに付与されるTCBを拡張し、タスクB専用の対応情報を登録するための例外処理管理テーブル25btがTCB Bに生成される。   On the other hand, it is assumed that the enhanced attribute is given to the task 24b shown in FIG. Hereinafter, task 24b is referred to as task B. For example, since the task B has the enhanced attribute, the task B can be specified as the enhanced attribute by the task generation API in the “cre_tsk (B,...)”. Further, by the API, in the process of generating task B, the kernel 21 generates a TCB B having a data structure for controlling task B, but extends the TCB assigned to the task with the classic attribute, An exception handling management table 25bt for registering dedicated correspondence information is generated in TCB B.

いま、実行中のプログラムがclassic属性のタスク、又は初期化ハンドラ等のタスク独立部であったとする。この実行中のプログラムから例外処理プログラムを登録するためのAPIである”def_exc()”が実行された場合、カーネル21はカーネル21が管理する例外処理管理テーブル21tに対し例外処理を登録する。   Assume that the program being executed is a task having a classic attribute or a task-independent portion such as an initialization handler. When “def_exc ()” that is an API for registering an exception handling program from this program being executed is executed, the kernel 21 registers exception handling in the exception handling management table 21 t managed by the kernel 21.

一方、実行権を得たタスクがenhanced属性のタスクであったとする。enhanced属性のタスクが、初期化ルーチンにおいて例外処理プログラムを登録するためのAPIである”def_exc()”を実行した場合、カーネル21は、このenhanced属性のタスクBのTCB B中に専用に用意されている例外処理管理テーブル25btに対し、そのタスク独自の例外処理を登録する。   On the other hand, it is assumed that the task having the execution right is a task having the enhanced attribute. When a task with the enhanced attribute executes “def_exc ()”, which is an API for registering an exception handling program in the initialization routine, the kernel 21 is prepared exclusively in the TCB B of the task B with the enhanced attribute. The exception processing unique to the task is registered in the exception processing management table 25bt.

次に、例外処理の実行の手順について説明する。図4は、classic属性のタスクの例外処理の実行の流れを説明するための図であり、図5は、enhanced属性のタスクの例外処理の実行の流れを説明するための図である。   Next, a procedure for executing exception processing will be described. FIG. 4 is a diagram for explaining a flow of execution of exception processing for a task with a classic attribute, and FIG. 5 is a diagram for explaining a flow of execution of exception processing for a task with an enhanced attribute.

いま、実行権を得たタスクが、図4に示すようにclassic属性のタスクAとする。このタスクAを実行中に例外が発生すると、CPU11が例外の発生を検知し、例外の発生した時点において実行されていた命令の仮想アドレスがEPCレジスタに記録される。さらに、発生した例外の種別である例外コードがCauseレジスタの所定のフィールドに記録される。なお、このとき、アドレスの参照行為が例外の発生原因である場合には、BadVaddrレジスタにその参照先のアドレスが記録される。CPU11の状態を制御するStatusレジスタには、例外状態を示すEXLbitが立ち、CPU11の実行状態は、カーネルモードへと遷移する。   Now, it is assumed that the task that has obtained the execution right is task A having a classic attribute as shown in FIG. If an exception occurs during the execution of task A, the CPU 11 detects the occurrence of the exception, and the virtual address of the instruction being executed at the time when the exception occurred is recorded in the EPC register. Further, an exception code, which is the type of exception that has occurred, is recorded in a predetermined field of the Cause register. At this time, if the address reference action is the cause of the exception, the reference destination address is recorded in the BadVaddr register. The EXLbit indicating the exceptional state is set in the Status register that controls the state of the CPU 11, and the execution state of the CPU 11 transitions to the kernel mode.

CPU11において例外の発生したアドレスがEPCレジスタに記録されると、PCは例外ベクタと呼ばれる所定のアドレスに遷移する。このアドレス遷移により、例外処理実行部の機能を有するカーネル21は例外の発生を検知し、例外処理を開始する。   When the address where the exception occurs in the CPU 11 is recorded in the EPC register, the PC transits to a predetermined address called an exception vector. With this address transition, the kernel 21 having the function of the exception processing execution unit detects the occurrence of an exception and starts exception processing.

カーネル21は、コンテキストを退避させ、Causeレジスタに格納されている発生した例外の例外コードを読み出し、発生した例外の種別を特定する。カーネル21は、実行中のタスクAのIDから、タスクAのTCB Aにアクセスし、タスクAがclassic属性であることを認識する。カーネル21は、実行中のタスクAがclassic属性であると認識すると、カーネル21は、カーネル21が管理する例外処理管理テーブル21tを、発生した例外コードをオフセットとして用いて、参照し、実行すべき例外処理ルーチンのアドレスを読み出す。読み出されたシステム固有の例外処理プログラムは、カーネル21の管理の下で実行される。   The kernel 21 saves the context, reads the exception code of the generated exception stored in the Cause register, and identifies the type of the generated exception. The kernel 21 accesses the TCB A of the task A from the ID of the task A being executed, and recognizes that the task A has the classic attribute. When the kernel 21 recognizes that the task A being executed has the classic attribute, the kernel 21 should refer to and execute the exception processing management table 21t managed by the kernel 21 using the generated exception code as an offset. Read the address of the exception handling routine. The read system-specific exception handling program is executed under the management of the kernel 21.

カーネル21は、システム固有の例外処理の実行が終わると、タスクAのコンテキストを戻して例外処理からの復帰処理を実行する。これにより、例外の発生元のタスクAに復帰してタスクAの実行が継続される。これは通常の例外処理の流れである。   When the execution of system-specific exception processing ends, the kernel 21 returns the context of task A and executes return processing from exception processing. As a result, the task A is resumed by returning to the task A from which the exception occurred. This is the normal exception handling flow.

一方、実行権を得たタスクが、図5に示すようにenhanced属性のタスクBとする。このタスクBを実行中に例外が発生すると、CPU11ではclassic属性と同じ処理が実行される。   On the other hand, the task that has obtained the execution right is task B having the enhanced attribute as shown in FIG. If an exception occurs during execution of task B, the CPU 11 executes the same processing as the classic attribute.

カーネル21は、コンテキストを退避させ、Causeレジスタに格納されている発生した例外の例外コードを読み出し、発生した例外の種別を特定する。カーネル21は、実行中のタスクBのIDから、タスクBのTCB Bにアクセスし、タスクBがenhanced属性であることを認識する。カーネル21は、実行中のタスクBがenhanced属性であると認識すると、カーネル21は、このタスクBのTCB B内にタスクB用の例外処理管理テーブル25btが存在することを認識し、TCB B内の例外処理管理テーブル25btを、発生した例外コードをオフセットとして用いて、参照し、実行すべき例外処理ルーチンのアドレスを読み出す。読み出されたタスク固有の例外処理プログラムは、カーネル21の管理の下で実行される。この場合の例外処理ルーチンは、タスクB内に記述されており、カーネル21によって読み出されて実行される。   The kernel 21 saves the context, reads the exception code of the generated exception stored in the Cause register, and identifies the type of the generated exception. The kernel 21 accesses the TCB B of the task B from the ID of the task B being executed, and recognizes that the task B has the enhanced attribute. When the kernel 21 recognizes that the task B being executed has the enhanced attribute, the kernel 21 recognizes that the exception handling management table 25bt for the task B exists in the TCB B of the task B, and in the TCB B The exception handling management table 25bt is referenced using the generated exception code as an offset, and the address of the exception handling routine to be executed is read. The read task-specific exception handling program is executed under the management of the kernel 21. The exception handling routine in this case is described in the task B and is read and executed by the kernel 21.

カーネル21は、タスク固有の例外処理の実行が終わると、タスクBのコンテキストを戻して例外処理からの復帰処理を実行する。これにより、例外の発生元のタスクBに復帰してタスクBの実行が継続される。   When the execution of task-specific exception processing ends, the kernel 21 returns the context of task B and executes return processing from exception processing. As a result, the task B returns to the task B from which the exception occurred and the execution of the task B is continued.

ここで、例外処理実行部の機能を有するカーネル21が実行する、上述した例外処理の流れについて説明する。図6は、カーネル21が実行する例外処理の流れの例を示すフローチャートである。この例外処理は、例外の発生により開始される。   Here, the flow of the above-described exception processing executed by the kernel 21 having the function of the exception processing execution unit will be described. FIG. 6 is a flowchart showing an example of the flow of exception processing executed by the kernel 21. This exception processing is started when an exception occurs.

まず、あるプログラムを実行中に例外が発生する(ステップS1)と、実行中のプログラムが中断される。
次に、例外の発生したときのPCのアドレスがEPCレジスタに記録され、PCのアドレスは例外ベクタと呼ばれる所定のアドレスに遷移する。PCのアドレスが例外ベクタに遷移すると、例外ベクタに配置されたルーチンを経由し、カーネル21の例外ハンドラが起動し、例外処理がカーネル21によって開始される(ステップS2)。
First, when an exception occurs during execution of a certain program (step S1), the program being executed is interrupted.
Next, the PC address when an exception occurs is recorded in the EPC register, and the PC address transitions to a predetermined address called an exception vector. When the PC address transitions to the exception vector, the exception handler of the kernel 21 is activated via the routine arranged in the exception vector, and exception processing is started by the kernel 21 (step S2).

カーネル21が例外処理を開始すると、カーネル21は、発生した例外によって中断されたプログラムのコンテキストの退避を行い、CPU11のCauseレジスタにアクセスし、例外の要因を判定する(ステップS3)。続いて、カーネル21は、例外を発生させたプログラムがタスクかを判定する(ステップS4)。例外を発生させたプログラムがタスクではない場合、NOとなり、ステップS8に進む。一方、例外を発生させたプログラムがタスクの場合、YESとなり、カーネル21は、カーネル21の管理情報から実行中のタスクのIDを読み出す(ステップS5)。カーネル21は、このIDを基に、このIDの指すタスクのTCBにアクセスする。カーネル21は、タスクのTCBにアクセスし、タスクの属性を読み出す(ステップS6)。そのTCBには、そのタスクの属性が記載されている。   When the kernel 21 starts exception processing, the kernel 21 saves the context of the program interrupted by the generated exception, accesses the Cause register of the CPU 11, and determines the cause of the exception (step S3). Subsequently, the kernel 21 determines whether the program that generated the exception is a task (step S4). If the program that generated the exception is not a task, the determination is NO and the process proceeds to step S8. On the other hand, if the program that generated the exception is a task, the determination is YES, and the kernel 21 reads the ID of the task being executed from the management information of the kernel 21 (step S5). Based on this ID, the kernel 21 accesses the TCB of the task pointed to by this ID. The kernel 21 accesses the TCB of the task and reads the task attribute (step S6). The attribute of the task is described in the TCB.

次に、カーネル21は、例外の発生したタスクがenhanced属性か否か、すなわち例外の発生したときのタスクが、タスク固有の例外処理ルーチンを有するか否か、を判定する(ステップS7)。タスクの属性がclassic属性の場合には、NOとなり、カーネル21が管理する例外処理管理情報を有する例外処理管理テーブル21tを参照する(ステップS8)。タスクの属性がenhanced属性の場合には、YESとなり、例外を発生させたタスクのTCB内に定義された例外処理管理情報を有する例外処理管理テーブルを参照する(ステップS9)。   Next, the kernel 21 determines whether or not the task in which the exception has occurred has the enhanced attribute, that is, whether or not the task in which the exception has occurred has a task-specific exception handling routine (step S7). If the task attribute is the classic attribute, the result is NO, and the exception handling management table 21t having exception handling management information managed by the kernel 21 is referred to (step S8). If the task attribute is the enhanced attribute, YES is set, and the exception handling management table having the exception handling management information defined in the TCB of the task causing the exception is referred to (step S9).

次に、カーネル21は、カーネル21が管理する例外処理管理情報又は例外を発生させたタスクのTCB内に定義された例外処理管理情報から、例外要因に該当する例外処理ルーチンを実行する(ステップS10)。すなわち、例外が発生したときのタスクが、タスク毎の例外処理ルーチンを有しない場合は、カーネルの管理する例外処理を実行し、例外が発生したときのタスクが、タスク毎の例外処理ルーチンを有する場合は、例外が発生したときのタスクの有するタスク毎の例外処理ルーチンを実行する。   Next, the kernel 21 executes an exception handling routine corresponding to the exception cause from the exception handling management information managed by the kernel 21 or the exception handling management information defined in the TCB of the task that generated the exception (step S10). ). In other words, if the task when the exception occurs does not have an exception handling routine for each task, the exception handling managed by the kernel is executed, and the task when the exception occurs has an exception handling routine for each task In this case, an exception handling routine for each task of the task when the exception occurs is executed.

最後に、例外処理が実行されると、カーネル21は、コンテキストの復帰を行い、例外処理からの復帰処理を行う(ステップS11)。復帰処理が行われると、例外処理から例外の発生元のプログラムに復帰して、このプログラムの実行が継続される。   Finally, when exception processing is executed, the kernel 21 returns context and performs return processing from exception processing (step S11). When the return process is performed, the process returns from the exception process to the program that generated the exception, and the execution of this program is continued.

以上のように、実行権を得たタスクがenhanced属性のタスクであり、enhanced属性のタスクにおいて例外処理プログラムを登録するためのAPIである”def_exc()”が実行された場合、カーネルは、このenhanced属性のタスクのTCB中に専用に用意されている例外処理管理テーブルに対し、そのタスク独自の例外処理を登録することが可能となる。   As described above, the task that has obtained the execution right is an enhanced attribute task, and when the "def_exc ()" API for registering an exception handling program is executed in the enhanced attribute task, the kernel It is possible to register the exception handling unique to the task in the exception handling management table prepared exclusively in the TCB of the task with the enhanced attribute.

更に、enhanced属性のタスクの実行中に例外が発生した場合には、カーネルは、このタスクのTCB内にタスク独自に登録された例外処理によって、発生した例外を処理することが可能となる。   Furthermore, when an exception occurs during the execution of a task having the enhanced attribute, the kernel can process the generated exception by the exception processing registered in the task in the TCB of this task.

上述した例では、enhanced属性のタスクの場合、タスクの生成段階においてカーネル21の例外処理管理テーブルがTCB内の同タスク専用の例外処理管理テーブルにコピーされるが、独自の例外処理を実装及び登録させたいときには、タスク内に独自の例外処理ルーチンを記述し、そのルーチンを実行するように同タスクのTCB内に存在する例外処理管理テーブルにおける実行ルーチンのアドレスを書き換える。このようにすれば、タスク独自の例外処理を容易に実行させることができる。   In the example described above, in the case of an enhanced attribute task, the exception processing management table of the kernel 21 is copied to the exception processing management table dedicated to the task in the TCB at the task generation stage. When it is desired to do so, a unique exception handling routine is described in the task, and the address of the execution routine in the exception handling management table existing in the TCB of the task is rewritten so that the routine is executed. In this way, task-specific exception handling can be easily executed.

一方、classic属性のタスク及びタスク独立部において例外が発生した場合には、カーネルが管理する例外処理管理テーブルに登録された例外処理によって、発生した例外を処理することが可能となる。   On the other hand, when an exception occurs in a task having a classic attribute and a task-independent portion, the generated exception can be processed by exception processing registered in the exception processing management table managed by the kernel.

よって、本実施の形態の情報処理装置によれば、実行されるアプリケーションプログラムの仕様に合致した例外処理をタスク毎に登録できることにより、1つのカーネル環境上に異なる思想の下に設計された複数のアプリケーションプログラムを実装することができ、且つ、登録された例外処理をカーネルの管理の下、即時性を持って実行することができる。   Therefore, according to the information processing apparatus of the present embodiment, it is possible to register exception processing that matches the specification of the application program to be executed for each task, thereby enabling a plurality of designs designed under different ideas on one kernel environment. An application program can be implemented, and registered exception handling can be executed with immediacy under the management of the kernel.

(第2の実施の形態)
次に、第2の実施の形態について説明する。第1の実施の形態において、各enhanced属性のタスクは、独自の例外処理を各タスクの例外処理管理テーブルに規定している。しかし、あるタスクが独立した、共有可能な関数をcallして利用する場合、その関数がどのような例外処理を必要とするかを事前に把握し、その例外処理を実装し、検証するのではシステム開発の効率は向上しない。即ち、共有ルーチンを利用するタスクが、そのタスクに共有ルーチン固有の例外処理を実装するべきではない。共有ルーチンが、特殊な例外処理を必要としているのであれば、その例外処理は、共有ルーチンが供給すべきであり、その共有ルーチンの開発過程において、その例外処理が十分検証されている必要がある。
(Second Embodiment)
Next, a second embodiment will be described. In the first embodiment, each enhanced attribute task defines its own exception handling in the exception handling management table for each task. However, if a task calls and uses an independent and sharable function, it is necessary to know in advance what kind of exception processing that function requires, implement that exception processing, and verify it. The efficiency of system development is not improved. That is, a task using a shared routine should not implement exception handling specific to the shared routine in that task. If a shared routine requires special exception handling, the exception handling should be provided by the shared routine, and the exception handling must be fully validated during the development of the shared routine. .

そこで、本実施の形態では、複数のタスク間において共有されるライブラリルーチンにおいても固有の例外処理の設定を可能とする。具体的には、カーネルが、共有ルーチンの入り口及び出口において、enhanced属性のタスクのTCB内にある例外処理管理テーブルの書き換え及び書く戻しを行う。特定の例外処理を要求する共有ルーチンをcallすることが許されるタスクとは、enhanced属性のタスクであって、classic属性のタスク及びタスクから独立した処理からの実行は許されない。   Therefore, in this embodiment, it is possible to set unique exception handling even in a library routine shared among a plurality of tasks. Specifically, the kernel rewrites and writes back the exception handling management table in the task TCB of the enhanced attribute at the entry and exit of the shared routine. A task that is allowed to call a shared routine that requires specific exception handling is a task with an enhanced attribute, and execution from a task that has a classic attribute and processing independent of the task is not allowed.

本実施の形態に係る情報処理装置1のハードウェア及びソフトウェアの構成は、第1の実施の形態と同様なため説明を省略する。
図7は、共有ルーチンにおける例外処理の登録の手順を説明するための図である。ここで、図2に示すタスク24b及びタスク24nに、それぞれenhanced属性が付与されたものとする。以下、タスク24b及びタスク24nは、それぞれタスクB及びタスクNと呼ぶ。タスクBは、enhanced属性のため、TCB B内にタスクB専用の例外処理管理テーブル25btを有し、同様に、タスクNも、TCB N内にタスクN専用の例外処理管理テーブル25ntを有する。
Since the hardware and software configurations of the information processing apparatus 1 according to this embodiment are the same as those in the first embodiment, description thereof is omitted.
FIG. 7 is a diagram for explaining a procedure for registering exception processing in the shared routine. Here, it is assumed that the enhanced attribute is assigned to each of the task 24b and the task 24n illustrated in FIG. Hereinafter, task 24b and task 24n are referred to as task B and task N, respectively. Since task B has an enhanced attribute, task B has an exception processing management table 25bt dedicated to task B in TCB B. Similarly, task N also has an exception processing management table 25nt dedicated to task N in TCB N.

図7に示すように、タスクB及びタスクNの間において、”fft_SIMD”なる関数が共有されている。この共有ルーチンは、タスクB及びタスクNから独立な存在であり、タスクB及びタスクNの設計者は共有ルーチン”fft_SIMD”の機能は知っているが、この共有ルーチンが内部でどのような例外処理を必要としているかについては十分な情報を得ていない。従って、共有ルーチンは、その機能と同時に必要な例外処理を提供する必要がある。   As shown in FIG. 7, the function “fft_SIMD” is shared between the task B and the task N. This shared routine is independent from task B and task N, and the designers of task B and task N know the function of the shared routine “fft_SIMD”, but what kind of exception handling does this shared routine internally? Not enough information about what you need. Therefore, shared routines must provide the necessary exception handling at the same time as their function.

そこで、この共有ルーチンの入り口において、例外処理を登録するためのAPIである”def_exc(FPE,&Ex_SIMD)”を実行し、共有ルーチンが持つ関数”Ex_SIMD”を”FPE”要因の例外として登録している。この共有ルーチンをcallしているタスクB及びタスクNは、それぞれenhanced属性であり、例外処理ルーチン”Ex_SIMD”は、TCB B及びTCB N内に生成されているそれぞれの例外処理管理テーブルに登録される。   Therefore, at the entrance of this shared routine, execute “def_exc (FPE, & Ex_SIMD)”, which is an API for registering exception handling, and register the function “Ex_SIMD” of the shared routine as an exception for the “FPE” factor. Yes. Task B and task N calling this shared routine have enhanced attributes, and the exception handling routine “Ex_SIMD” is registered in each exception handling management table generated in TCB B and TCB N. .

図8は、共有ルーチンの実行中に発生した例外処理の実行の流れを説明するための図である。図8に示すように、タスクNが共有ルーチンをcallすると、共有ルーチンの先頭では、この共有ルーチンが必要とする固有の例外処理の登録が行われる。例えば、μITRON仕様であれば、”def_exc()”を実行することにより、タスクNのTCB N内に存在する例外処理管理テーブル25ntに共有ルーチンが指定する例外処理が登録される。   FIG. 8 is a diagram for explaining the flow of execution of exception processing that occurs during execution of the shared routine. As shown in FIG. 8, when task N calls a shared routine, registration of unique exception processing required by the shared routine is performed at the head of the shared routine. For example, in the case of the μITRON specification, by executing “def_exc ()”, the exception processing specified by the shared routine is registered in the exception processing management table 25nt existing in the TCN of task N.

タスクNによりcallされた共有ルーチンが実行されているときに例外が発生すると、カーネル21は、実行中のタスクNのIDから、タスクNのTCB Nにアクセスし、タスクNがenhanced属性であることを認識する。カーネル21は、実行中のタスクNがenhanced属性であると認識すると、このタスクNのTCB N内にタスクN用の例外処理管理テーブル25ntが存在することを認識し、TCB N内の例外処理管理テーブル25ntを発生した例外コードをオフセットとして用いて参照し、実行すべき例外処理ルーチンのアドレスを読み出す。読み出された共有ルーチン固有の例外処理プログラムは、カーネル21の管理の下において実行される。カーネル21は、共有ルーチン固有の例外処理プログラムを実行後、例外処理からの復帰処理を行う。   If an exception occurs while the shared routine called by task N is being executed, kernel 21 accesses TCB N of task N from the ID of task N being executed, and task N has the enhanced attribute. Recognize When the kernel 21 recognizes that the task N being executed has the enhanced attribute, the kernel 21 recognizes that the task N exception handling management table 25nt exists in the task N TCB N, and manages the exception handling in the TCB N. The exception code that generated the table 25nt is referred to as an offset, and the address of the exception processing routine to be executed is read. The read exception handling program specific to the shared routine is executed under the management of the kernel 21. The kernel 21 executes a return processing from the exception processing after executing the exception processing program specific to the shared routine.

また、タスクBが共有ルーチンを実行しているときに例外が発生すると、同様に、共有ルーチン固有の例外処理プログラムがカーネル21の管理の下において実行される。タスクB及びタスクNは、共有ルーチン”fft_SIMD”がTCB B及びTCB Nそれぞれに生成された例外処理管理テーブルの一部を書き換える場合、その書き換えられた例外要因に対し、必要に応じて登録内容の上書きによる無効化、即ち、書き換えられる前の例外処理を再登録することができる。   If an exception occurs while task B is executing a shared routine, an exception handling program specific to the shared routine is executed under the management of the kernel 21 in the same manner. When the shared routine “fft_SIMD” rewrites a part of the exception handling management table generated for each of TCB B and TCB N, task B and task N have the registration contents as necessary for the rewritten exception factor. Invalidation by overwriting, that is, exception processing before rewriting can be re-registered.

以上のように、共有ルーチンの入り口において例外処理プログラムを登録するためのAPIである”def_exc()”が実行されると、その共有ルーチンをcallするタスクは、共有ルーチンの関数が必要とする例外処理を独自に保有することなしに、共有ルーチン固有の例外処理を実行することができる。   As described above, when “def_exc ()”, which is an API for registering an exception handling program at the entrance of a shared routine, is executed, the task that calls the shared routine is the exception required by the shared routine function. Exception handling specific to the shared routine can be executed without owning the processing.

よって、本実施の形態の情報処理装置によれば、第1の実施の形態と同様に実行されるアプリケーションプログラムの仕様に合致した例外処理をタスク毎に登録できることにより、1つのカーネル環境上に異なる思想の下に設計された複数のアプリケーションプログラムを実装することができ、且つ、登録された例外処理をカーネルの管理の下、即時性を持って実行することができる。   Therefore, according to the information processing apparatus of the present embodiment, it is possible to register exception processing that matches the specification of the application program executed in the same manner as in the first embodiment, so that it differs on one kernel environment. A plurality of application programs designed based on the idea can be implemented, and registered exception processing can be executed with immediacy under the management of the kernel.

更に、共有ルーチンを実行中に発生した例外については、そのタスクの実行中にcallされる共有ルーチンの入り口において、共有ルーチン固有の例外処理を実行中のタスクの例外処理管理テーブルに登録することにより、このタスクの設計者は、共有ルーチンがどのような例外処理を必要とするかを事前に把握する必要がなく、システム開発の効率を向上させることができる。   Furthermore, for exceptions that occur during execution of a shared routine, register the exception handling specific to the shared routine in the exception handling management table of the executing task at the entry of the shared routine that is called during the execution of the task. The designer of this task does not need to know in advance what kind of exception processing the shared routine requires and can improve the efficiency of system development.

(第3の実施の形態)
次に、第3の実施の形態について説明する。本実施の形態に係る情報処理装置1は、マルチOSを有する。本実施の形態に係る情報処理装置1のハードウェア構成は、第1の実施の形態と同様のため、説明を省略する。図9は、マルチOSのソフトウェア構成の例を示すブロック図である。このマルチOSは、リアルタイムカーネルの1つのタスクとして汎用OSを実装する方式であり、公知例US5,995,745において提案されている。
(Third embodiment)
Next, a third embodiment will be described. The information processing apparatus 1 according to the present embodiment has a multi-OS. Since the hardware configuration of the information processing apparatus 1 according to the present embodiment is the same as that of the first embodiment, description thereof is omitted. FIG. 9 is a block diagram illustrating an example of the software configuration of the multi-OS. This multi-OS is a method for implementing a general-purpose OS as one task of a real-time kernel, and is proposed in publicly known examples US5,995,745.

図9に示すように、マルチOSは、リアルタイムカーネル31上で動作する1つのタスクとして別のOSが実装されている。以下、このタスクとして実装されたOSは、OSタスク32と呼ぶ。OSタスク32にenhanced属性が付与されると、OSタスク32の動作を管理するリアルタイムカーネル31は、OSタスク32のTCB33内にOSタスク32専用の例外処理管理テーブルを生成する。   As shown in FIG. 9, the multi-OS is implemented with another OS as one task that operates on the real-time kernel 31. Hereinafter, the OS implemented as this task is referred to as an OS task 32. When the enhanced attribute is given to the OS task 32, the real-time kernel 31 that manages the operation of the OS task 32 generates an exception processing management table dedicated to the OS task 32 in the TCB 33 of the OS task 32.

OSタスクを実行中に例外が発生したときの例外処理の実行の手順を説明する。図10は、OSタスク32を実行中に例外が発生したときの例外処理の流れの例を説明するための図である。   The procedure for executing exception processing when an exception occurs during execution of an OS task is described. FIG. 10 is a diagram for explaining an example of the flow of exception processing when an exception occurs during execution of the OS task 32.

OSタスク32を実行中に例外が発生すると、リアルタイムカーネル31は、実行中のOSタスク32のIDから、OSタスク32のTCB33にアクセスし、OSタスク32がenhanced属性であることを認識する。リアルタイムカーネル31は、実行中のOSタスク32がenhanced属性であると認識すると、このOSタスク32のTCB33内にOSタスク32用の例外処理管理テーブルが存在することを認識し、TCB33内の例外処理管理テーブルを発生した例外コードをオフセットとして用いて参照し、実行すべき例外処理ルーチンのアドレスを読み出す。読み出されたOSタスク固有の例外処理プログラムは、リアルタイムカーネル31の管理の下において実行される。リアルタイムカーネル31は、OSタスク32固有の例外処理プログラムを実行後、例外処理からの復帰処理を行う。   When an exception occurs during execution of the OS task 32, the real-time kernel 31 accesses the TCB 33 of the OS task 32 from the ID of the OS task 32 being executed, and recognizes that the OS task 32 has the enhanced attribute. When the real-time kernel 31 recognizes that the OS task 32 being executed has the enhanced attribute, the real-time kernel 31 recognizes that the exception processing management table for the OS task 32 exists in the TCB 33 of the OS task 32, and the exception processing in the TCB 33 The exception code that generated the management table is referenced as an offset, and the address of the exception processing routine to be executed is read. The read exception handling program specific to the OS task is executed under the management of the real-time kernel 31. The real-time kernel 31 performs a return process from the exception process after executing the exception process program specific to the OS task 32.

以上のように、マルチOS環境において、リアルタイムカーネル31上において1つのタスクとして実装されるOSタスクにenhanced属性が付与されると、このOSタスクのTCB内に、このOSタスク専用の例外処理管理テーブルが生成される。この場合、OSタスクの初期化ルーチン内において、OSタスクに相当する汎用OS固有の例外処理を、このOSタスク専用の例外処理管理テーブルに登録することができる。従って、この汎用OSが、このリアルタイムカーネルのタスクとして実行権を得ている間に発生した例外については、この汎用OSに対応するタスクのTCB内の例外処理管理テーブルに登録された汎用OS固有の例外処理が実行される。   As described above, in the multi-OS environment, when the enhanced attribute is given to an OS task implemented as one task on the real-time kernel 31, an exception processing management table dedicated to this OS task is included in the TCB of this OS task. Is generated. In this case, in the OS task initialization routine, exception processing specific to the general-purpose OS corresponding to the OS task can be registered in the exception processing management table dedicated to this OS task. Therefore, for exceptions that occur while this general-purpose OS obtains the execution right as a task of this real-time kernel, it is specific to the general-purpose OS registered in the exception handling management table in the TCB of the task corresponding to this general-purpose OS. Exception handling is executed.

よって、上述した各実施の形態の情報処理装置によれば、実行されるアプリケーションプログラムの仕様に合致した例外処理をタスク毎に登録できることにより、1つのカーネル環境上に異なる思想の下に設計された複数のアプリケーションプログラムを実装することができ、且つ、登録された例外処理をカーネルの管理の下、即時性を持って実行することができる。   Therefore, according to the information processing apparatus of each embodiment described above, it is possible to register exception processing that matches the specification of the application program to be executed for each task, so that it is designed under a different concept on one kernel environment. A plurality of application programs can be implemented, and registered exception handling can be executed with immediacy under the management of the kernel.

なお、リアルタイムカーネル上においてタスクとして実装される汎用OSは、複数あってよい。この場合にも、本実施の形態の例外処理により、複数の汎用OSが実装されるマルチOS環境においても適切に汎用OS毎の例外の振り分けが実施され、実装された複数の汎用OS環境を矛盾することなく安定に実行することが可能となる。   There may be a plurality of general-purpose OSs implemented as tasks on the real-time kernel. Even in this case, the exception handling of this embodiment allows appropriate exception distribution for each general-purpose OS even in a multi-OS environment where multiple general-purpose OSs are implemented, and contradicts the multiple general-purpose OS environments that are implemented. It becomes possible to execute stably without doing.

以上のように、上述した各実施の形態によれば、アプリケーションプログラムの実行時に発生し得る例外処理は、システム固有の例外処理だけに限定されず、タスク毎に規定することができる。タスク毎に規定された例外処理ルーチンを有する、拡張されたタスクと、従来のカーネルの管理するシステム固有の例外処理ルーチンだけを実行するタスクとを、各タスクに付与されるタスク管理情報としての属性により区別することができる。その属性情報を参照することにより、拡張された属性を有するタスクに対して、そのタスク固有の例外処理を実行させることが出来る。   As described above, according to the above-described embodiments, exception processing that can occur during execution of an application program is not limited to system-specific exception processing, and can be defined for each task. Attribute as task management information given to each task, an extended task having an exception handling routine defined for each task and a task that executes only an exception handling routine unique to the system managed by the conventional kernel Can be distinguished. By referring to the attribute information, task-specific exception processing can be executed for a task having an extended attribute.

そのために、カーネルは拡張された属性を有するタスクを管理するためのデータ構造を拡張し、カーネルが有する例外処理管理テーブルと同じデータ構造を拡張された属性を有するタスクに付加する。また、カーネルはこの拡張属性を与えたタスク用の例外処理管理テーブルにそのタスク独自の例外処理を登録するための手段、具体的には上述したAPIを提供する。よって、各アプリケーションプログラムの要求仕様に合致した例外処理をタスク毎に実装可能であり、かつ、カーネルは例外発生時に実行中のタスクの属性情報に基づいて適切な例外処理を実行することが可能となる。   For this purpose, the kernel extends the data structure for managing the task having the extended attribute, and adds the same data structure as the exception handling management table included in the kernel to the task having the extended attribute. In addition, the kernel provides means for registering the exception processing unique to the task in the exception processing management table for the task to which the extended attribute is given, specifically, the above-described API. Therefore, exception handling that matches the required specifications of each application program can be implemented for each task, and the kernel can execute appropriate exception handling based on the attribute information of the task being executed when an exception occurs. Become.

以上のように、上述した各実施の形態によれば、複数のアプリケーションプログラムを動的に生成し、かつ実行できるカーネル環境において、1つの例外要因に対し複数の例外処理を登録する手段が提供され、そして、発生する例外に対し実行中のアプリケーションプログラムに合わせて実行されるべき例外処理を切り替えて実行することができる情報処理装置が実現できる。   As described above, according to each of the above-described embodiments, there is provided means for registering a plurality of exception processes for one exception factor in a kernel environment in which a plurality of application programs can be dynamically generated and executed. In addition, it is possible to realize an information processing apparatus capable of switching and executing exception processing to be executed in accordance with an application program being executed for an exception that occurs.

本発明は、上述した実施の形態に限定されるものではなく、本発明の要旨を変えない範囲において、種々の変更、改変等が可能である。   The present invention is not limited to the above-described embodiment, and various changes and modifications can be made without departing from the scope of the present invention.

第1の実施の形態に係る情報処理装置のハードウェアの構成を示す構成図である。It is a block diagram which shows the structure of the hardware of the information processing apparatus which concerns on 1st Embodiment. 第2の実施の形態に係る情報処理装置のソフトウェアの構成を示すブロック図である。It is a block diagram which shows the structure of the software of the information processing apparatus which concerns on 2nd Embodiment. 例外処理の登録の手順を説明するための図である。It is a figure for demonstrating the procedure of registration of exception processing. classic属性のタスクの例外処理の実行の流れを説明するための図である。It is a figure for demonstrating the flow of execution of the exception process of the task of a classic attribute. enhanced属性のタスクの例外処理の実行の流れを説明するための図である。It is a figure for demonstrating the flow of execution of the exception process of the task of enhanced attribute. カーネルが実行する例外処理の流れの例を示すフローチャートである。It is a flowchart which shows the example of the flow of the exception process which a kernel performs. 共有ルーチンにおける例外処理の登録の手順を説明するための図である。It is a figure for demonstrating the procedure of registration of the exception process in a shared routine. 共有ルーチンの実行中に発生した例外処理の実行の流れを説明するための図である。It is a figure for demonstrating the flow of execution of the exception process which occurred during execution of a shared routine. マルチOSのソフトウェア構成の例を示すブロック図である。FIG. 3 is a block diagram illustrating an example of a software configuration of a multi-OS. OSタスクを実行中に例外が発生したときの例外処理の流れを説明するための図である。It is a figure for demonstrating the flow of exception processing when an exception generate | occur | produces during execution of OS task.

符号の説明Explanation of symbols

1 情報処理装置、11 CPU、21 カーネル、22 API、23 例外処理プログラム 24a 24b 24n タスク、25a 25b 25n TCB、21t 25bt 25nt 例外処理管理テーブル DESCRIPTION OF SYMBOLS 1 Information processing apparatus, 11 CPU, 21 kernel, 22 API, 23 Exception processing program 24a 24b 24n Task, 25a 25b 25n TCB, 21t 25bt 25nt Exception processing management table

Claims (5)

システムに含まれる複数のタスクの実行を制御するためにカーネルによって管理される記憶領域であって、各タスクに対応して設けられ、前記各タスクがタスク毎の例外処理ルーチンを有するか否かを示す属性情報を記憶可能なタスク属性情報記憶部と、
例外が発生したときに前記タスク属性情報記憶部の前記属性情報を参照し、前記例外が発生したときのタスクが、前記タスク毎の例外処理ルーチンを有するか否かを判定し、前記例外が発生したときのタスクが前記タスク毎の例外処理ルーチンを有しない場合は、前記カーネルの管理する例外処理を実行し、前記例外が発生したときのタスクが前記タスク毎の例外処理ルーチンを有する場合は、前記例外が発生したときのタスクの有する前記タスク毎の例外処理ルーチンを実行する例外処理実行部と
を有することを特徴とする情報処理装置。
A storage area managed by the kernel to control the execution of a plurality of tasks included in the system, provided corresponding to each task, and whether each task has an exception handling routine for each task A task attribute information storage unit capable of storing attribute information indicating;
Refer to the attribute information in the task attribute information storage unit when an exception occurs, determine whether the task when the exception occurs has an exception processing routine for each task, and the exception occurs If the task at the time does not have an exception handling routine for each task, execute the exception handling managed by the kernel, and if the task when the exception occurs has an exception handling routine for each task, An information processing apparatus comprising: an exception processing execution unit that executes an exception processing routine for each task included in a task when the exception occurs.
前記タスク毎の例外処理ルーチンを有するタスクに対して、前記例外と前記例外処理ルーチンとの対応付けるための対応情報が設けられていることを特徴とする請求項1記載の情報処理装置。   The information processing apparatus according to claim 1, wherein correspondence information for associating the exception with the exception handling routine is provided for a task having an exception handling routine for each task. 前記タスク毎の例外処理ルーチンを前記対応情報に登録するためのアプリケーションプログラムインターフェースを有することを特徴とする請求項2に記載の情報処理装置。   The information processing apparatus according to claim 2, further comprising an application program interface for registering the exception handling routine for each task in the correspondence information. 前記タスクが複数存在しかつライブラリルーチンを共有する場合、該ライブラリルーチン内で定義される専用の例外処理ルーチンは、前記ライブラリルーチンを呼び出したタスクの前記対応情報に基づいて決定されることを特徴とする請求項2に記載の情報処理装置。   When a plurality of the tasks exist and share a library routine, a dedicated exception handling routine defined in the library routine is determined based on the correspondence information of the task that called the library routine. The information processing apparatus according to claim 2. 前記対応情報は、前記システムの初期化時において、前記例外と前記カーネルの管理する例外処理ルーチンとの対応付けるためのカーネルの対応情報をコピーすることにより、前記タスク制御ブロックに記憶されることを特徴とする請求項3に記載の情報処理装置。   The correspondence information is stored in the task control block by copying kernel correspondence information for associating the exception with an exception handling routine managed by the kernel at the time of initialization of the system. The information processing apparatus according to claim 3.
JP2007149527A 2007-06-05 2007-06-05 Information processor Pending JP2008305016A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2007149527A JP2008305016A (en) 2007-06-05 2007-06-05 Information processor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2007149527A JP2008305016A (en) 2007-06-05 2007-06-05 Information processor

Publications (1)

Publication Number Publication Date
JP2008305016A true JP2008305016A (en) 2008-12-18

Family

ID=40233720

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2007149527A Pending JP2008305016A (en) 2007-06-05 2007-06-05 Information processor

Country Status (1)

Country Link
JP (1) JP2008305016A (en)

Similar Documents

Publication Publication Date Title
US9304794B2 (en) Virtual machine control method and virtual machine system using prefetch information
EP2443553B1 (en) Annotating virtual application processes
US6820155B1 (en) Interruption managing device and interruption managing method
JP4954281B2 (en) Exception handling system, exception handling method, conversion device, and storage medium for handling exceptions during binding to native code
JP5026494B2 (en) Computer that starts at high speed
JP2730007B2 (en) Data processing device and computer program execution method
US9009716B2 (en) Creating a thread of execution in a computer processor
JP5382450B2 (en) Access control apparatus, method and information recording medium
US20100306766A1 (en) Adding aspects to virtual machine monitors
JP2539913B2 (en) Data processing system
JP2009157684A (en) Virtualization program, simulation device, and virtualization method
JP4026667B2 (en) Multi-OS configuration method
JP2005316599A (en) Interrupt controller
US8578368B2 (en) Injecting a file from the bios into an operating system
US7412597B2 (en) Computer system and booting method thereof
JP2002297556A (en) Multiprocessor system, control method and program for multiprocessor, and computer readable recording medium with the program recorded thereon
JP2008305016A (en) Information processor
JP4846226B2 (en) Information processing apparatus, information processing method, and program
TWI682323B (en) Server and setting method thereof
WO2023144939A1 (en) Computer, control method, and control program
JP7257407B2 (en) External exception handling
JP2005284925A (en) Computer system and program update method
JP2023071103A (en) Process schedule method
JP2020525957A (en) Contextual data management
JP2011118830A (en) Multitasking system and program