JPH11134204A - Stack protecting device - Google Patents

Stack protecting device

Info

Publication number
JPH11134204A
JPH11134204A JP9297218A JP29721897A JPH11134204A JP H11134204 A JPH11134204 A JP H11134204A JP 9297218 A JP9297218 A JP 9297218A JP 29721897 A JP29721897 A JP 29721897A JP H11134204 A JPH11134204 A JP H11134204A
Authority
JP
Japan
Prior art keywords
task
stack
page
information
protection
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
JP9297218A
Other languages
Japanese (ja)
Inventor
Hideyuki Okamoto
秀行 岡本
Kenichiro Aikawa
健一郎 相川
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.)
Hitachi Ltd
Original Assignee
Hitachi Ltd
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 Hitachi Ltd filed Critical Hitachi Ltd
Priority to JP9297218A priority Critical patent/JPH11134204A/en
Publication of JPH11134204A publication Critical patent/JPH11134204A/en
Pending legal-status Critical Current

Links

Landscapes

  • Memory System Of A Hierarchy Structure (AREA)

Abstract

PROBLEM TO BE SOLVED: To prevent a task from hanging up by halting a currently executed task and providing a page protection exception process when there is not page information on an address where a page fault is generated and when the currently executed task access a stack of another task. SOLUTION: A real-time OS 111 generates a task to a task managing means 112 and allocates a stack 108 on a main storage memory 104. A page information rewriting means 105 sets page information 116 on the stack 108 in a page table 109. At this time, the protection information of the page information 116 is set to read/write inhibition. Then if different operation, an abnormal process, illegal memory access, etc., are caused since the data of the stack 108 are rewritten owing to a bug of a program of another task, a page protection exception process is provided for a case wherein the currently executed task accesses the stack of the different task.

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明の属する技術分野】本発明は、リアルタイム制御
用マイコンシステムに係わり、特にアプリケーションプ
ログラムの不具合により現在実行中のタスクがポインタ
の操作を誤って他のタスクのスタックのデータを書き換
えようとしたときに、他のタスクが誤った動作をするこ
とを防止するスタック保護装置に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a microcomputer system for real-time control, and more particularly to a case where a currently executing task mistakenly manipulates a pointer to rewrite data in a stack of another task due to a malfunction of an application program. In addition, the present invention relates to a stack protection device for preventing other tasks from performing erroneous operations.

【0002】[0002]

【従来の技術】従来のスタック保護装置では、大型のオ
ペレーティングシステムにおいて、プロセスのスイッチ
ング毎に実行すべきプロセスのページ情報をページテー
ブルに書き換える。これにより、カレントプロセスから
のメモリ1アクセスは他のプロセスの物理アドレスに変
換されることは起こらないため、決して他のプロセスの
データを書き換えるようなことは起こらない。
2. Description of the Related Art In a conventional stack protection apparatus, in a large-scale operating system, page information of a process to be executed is rewritten into a page table every time the process is switched. As a result, the memory 1 access from the current process is not converted to the physical address of another process, so that the data of another process is never rewritten.

【0003】リアルタイムシステムでは、大型のオペレ
ーティングシステムのように外部記憶装置にプログラム
を格納しておき、実行するごとに主記憶メモリを割り当
て、論理アドレス空間を主記憶メモリ上の物理アドレス
空間に対応させ、外部記憶装置からプログラムをローデ
ィングするようなことや、高速に処理を行うために外部
記憶装置からのデータの取得は行わない。つまり、リア
ルタイムシステムでは、主記憶メモリ上に全プログラム
をローディングしておく。各タスクはデータ、実行命令
を共有させ、スタックはタスク毎に割り当てる。
In a real-time system, a program is stored in an external storage device like a large-sized operating system, a main memory is allocated each time the program is executed, and a logical address space is made to correspond to a physical address space on the main memory. For example, a program is not loaded from an external storage device, and data is not acquired from the external storage device for high-speed processing. That is, in the real-time system, all programs are loaded on the main memory. Each task shares data and execution instructions, and a stack is allocated for each task.

【0004】従来技術においては、スタックのオーバフ
ローを検出するためにスタックの底部に特定のデータを
設定しておき、タスクスイッチ毎に固定データが書き換
えられているかどうかを検出する。そして、もし、書き
換えられていたならばスタックがオーバフローしている
ことを検出する。
In the prior art, specific data is set at the bottom of the stack to detect an overflow of the stack, and it is detected whether or not the fixed data is rewritten for each task switch. Then, if it has been rewritten, it detects that the stack has overflowed.

【0005】また、リアルタイムオペレーティングシス
テムにおいて、MMU(メモリ管理機構)を使用してい
る従来例では、テキストセグメント、ベクタテーブル等
と、タスク固有のデータ領域の保護を行っているが、タ
スクのスタックの保護を行っていない。
[0005] In a conventional example using an MMU (memory management mechanism) in a real-time operating system, a text segment, a vector table and the like and a task-specific data area are protected. No protection.

【0006】[0006]

【発明が解決しようとする課題】しかしながら、上述し
た従来技術におけるスタックのオーバフロー検出方式で
は、タスクスイッチを行うときにスタックのオーバフロ
ーの検出を行うため、スタックのオーバフローが発生し
た後でしかオーバフローの検出できないという問題点が
あった。
However, in the above-described stack overflow detection method in the prior art, the stack overflow is detected when a task switch is performed. Therefore, the overflow is detected only after the stack overflow occurs. There was a problem that it was not possible.

【0007】また、オーバフローではなく、プログラム
の不具合でアドレス操作の間違いによる他のスタックへ
のアクセスを行った場合、スタックのオーバフローを検
出するためのスタックの底部に設定した固定のデータは
変更されないため、不当なメモリアクセスが発生したこ
とを検出できない。そして、どのプログラムを実行中に
不当なメモリアクセスが発生したかを検出できないた
め、不具合調査が困難であるという問題点があった。
Further, when an access to another stack is made due to a wrong address operation due to a program defect rather than an overflow, fixed data set at the bottom of the stack for detecting stack overflow is not changed. Cannot detect that an illegal memory access has occurred. In addition, since it is not possible to detect which program has caused an illegal memory access during execution, there has been a problem that it is difficult to investigate a failure.

【0008】本発明の目的は、タスクの暴走によるシス
テムダウンを効果的に防止することができるスタック保
護装置を実現することである。
An object of the present invention is to realize a stack protection device capable of effectively preventing a system down due to a runaway task.

【0009】さらに、本発明の他の目的は、タスクの暴
走によるシステムダウンを効果的に防止することができ
るとともに、不当なメモリアクセスの発生を容易に検出
可能であるスタック保護装置を実現することである。
Another object of the present invention is to provide a stack protection device which can effectively prevent a system down due to a runaway task and can easily detect occurrence of an illegal memory access. It is.

【0010】[0010]

【課題を解決するための手段】[Means for Solving the Problems]

(1)上記目的を達成するため、本発明は次のように構
成される。すなわち、タスクのスタック空間以外はタス
ク毎にアドレス空間を保持せず、タスクがプログラム空
間、データ空間を共有して実行するオペレーティングシ
ステムと、メモリ管理機構とを有するリアルタイム制御
用マイコンシステムのスタック保護装置において、上記
メモリ管理機構によって使用され、各メモリブロックの
保護情報を保持しているページ情報から構成されるペー
ジテーブルと、指定されたメモリブロックのページ情報
を検索し、検索したページ情報に対して適切な保護情報
を設定し、ページテーブルを更新するページテーブル書
き換え手段と、タスクの切り替えを行うときに、上記ペ
ージテーブル書き換え手段に対して、現在実行中である
タスクのスタックのブロック情報を与え、現在実行中の
タスクのスタックへの書き込み禁止の保護情報を設定さ
せるとともに、新しく実行させるタスクのスタックのブ
ロック情報を与え、上記新しく実行させるタスクのスタ
ックの保護情報に対して読み書き可能の保護情報を設定
させるタスクスイッチング手段と、を備える。
(1) In order to achieve the above object, the present invention is configured as follows. That is, a stack protection device for a real-time control microcomputer system having an operating system in which a task does not hold an address space for each task other than the task stack space and shares and executes a program space and a data space and a memory management mechanism. A page table that is used by the memory management mechanism and includes page information holding protection information of each memory block, and a page information of a specified memory block. Appropriate protection information is set, the page table rewriting means for updating the page table, and when switching tasks, the page table rewriting means is given block information of the stack of the task currently being executed, Write the currently running task to the stack Provided with to set the protection information for prohibiting gives block information of the stack of the task to be newly executed, and task switching means for setting the protection information of the read-write with respect to the protection information of the stack of the task which the cause new run, the.

【0011】(2)好ましくは、上記(1)において、
上記メモリ管理機構は、現在実行中のタスクの要求によ
り、ページフォルト例外処理を発生し、上記ページテー
ブルにページフォルトを発生させたアドレスのページ情
報が存在しない場合には、上記オペレーティングシステ
ムは、現在実行中のタスクを休止状態とする。
(2) Preferably, in the above (1),
The memory management mechanism generates a page fault exception process in response to a request of the currently executing task, and if there is no page information of the address that caused the page fault in the page table, the operating system executes the current operation. Puts the running task into hibernation.

【0012】(3)また、好ましくは、上記(1)にお
いて、上記メモリ管理機構は、現在実行中のタスクの要
求により、ページフォルト例外処理を発生し、上記ペー
ジテーブルにページフォルトを発生させたアドレスのペ
ージ情報が存在しない場合には、エラー情報を出力する
エラー出力手段を備える。
(3) Preferably, in the above (1), the memory management mechanism generates a page fault exception process in response to a request of a currently executing task, and generates a page fault in the page table. If there is no page information of the address, an error output means for outputting error information is provided.

【0013】(4)また、好ましくは、上記(1)にお
いて、上記メモリ管理機構は、現在実行中のタスクの要
求により、ページフォルト例外処理を発生し、上記ペー
ジテーブルにページフォルトを発生させたアドレスのペ
ージ情報が存在しない場合には、エラー情報を待避させ
るエラー待避手段を備える。
(4) Preferably, in the above (1), the memory management mechanism generates a page fault exception process in response to a request of a currently executing task, and generates a page fault in the page table. If there is no page information of the address, an error saving means for saving the error information is provided.

【0014】(5)また、好ましくは、上記(1)にお
いて、現在実行中のタスクが他のタスクのスタックにア
クセスした場合には、上記メモリ管理機構は、ページ保
護例外処理を発生し、このページ保護例外処理が発生さ
れたときには、上記オペレーティングシステムは、現在
実行中のタスクを休止状態とする。
(5) Also, preferably, in the above (1), when the currently executing task accesses the stack of another task, the memory management mechanism generates a page protection exception process. When a page protection exception process occurs, the operating system suspends the currently executing task.

【0015】(6)また、好ましくは、上記(1)にお
いて、現在実行中のタスクが他のタスクのスタックにア
クセスした場合には、上記メモリ管理機構は、ページ保
護例外処理を発生し、このページ保護例外処理が発生さ
れたときには、エラー情報を出力するエラー出力手段を
備える。
(6) Preferably, in the above (1), when the currently executing task accesses a stack of another task, the memory management mechanism generates a page protection exception process. An error output unit is provided for outputting error information when page protection exception processing occurs.

【0016】(7)また、好ましくは、上記(1)にお
いて、現在実行中のタスクが他のタスクのスタックにア
クセスした場合には、上記メモリ管理機構は、ページ保
護例外処理を発生し、このページ保護例外処理が発生さ
れたときには、エラー情報を待避させるエラー待避手段
を備える。
(7) Preferably, in the above (1), when the currently executing task accesses the stack of another task, the memory management mechanism generates a page protection exception process. An error saving unit is provided for saving error information when page protection exception processing occurs.

【0017】タスクが他のタスクのプログラムのバグに
よりにスタックのデータを書き換えられたために異なっ
た動作や異常な処理、不当なメモリアクセス等が発生す
る現象に対して、ページフォルトを発生させたアドレス
のページ情報が存在しない場合や、現在実行しているタ
スクが他のタスクのスタックへアクセスした場合に、現
在実行中のタスクを休止状態としたり、ページ保護例外
処理を設けることによって、タスクの暴走を防止でき
る。
An address at which a page fault has occurred in response to a phenomenon in which a task has been rewritten in a stack due to a bug in a program of another task, causing a different operation, abnormal processing, improper memory access, or the like. If the page information does not exist, or if the currently executing task accesses the stack of another task, the currently executing task will be put to a halt state, or a page protection exception process will be provided to prevent the task from running out of control. Can be prevented.

【0018】また、エラー出力手段を設けることによ
り、異なった動作や異常な処理、不当なメモリアクセス
等が発生したときにエラー情報を出力するため、プログ
ラムのバグを早期に発見でき、バグの修正も容易にする
ことができる。
Further, by providing error output means, error information is output when a different operation, abnormal processing, improper memory access, or the like occurs, so that a bug in the program can be found at an early stage and the bug can be corrected. Can also be easier.

【0019】また、エラー待避手段を設けることによ
り、上記のような異なった動作や異常な処理、不当なメ
モリアクセス等が発生したときに、エラー解析が可能と
なるため、リアルタイム制御用マイコンシステムの稼動
場所にいなくてもエラー解析が可能となる。
Further, by providing the error saving means, it becomes possible to analyze an error when the above-mentioned different operation, abnormal processing, improper memory access or the like occurs. Error analysis becomes possible even when not in the operation place.

【0020】[0020]

【発明の実施の形態】次に、本発明の実施形態について
図面を参照して詳細に説明する。図1は、本発明の第1
の実施形態に係るスタック保護装置の構成を示すブロッ
ク図である。本発明の第1の実施形態のスタック保護装
置は、マイクロプロセッサ(以下、MPUとして記述す
る)101と、MMU(メモリ管理機構)102と、主
記憶メモリ104と、ページテーブル109と、ページ
保護例外処理110を処理するページ保護例外処理部1
23と、リアルタイムOS111と、タスク管理手段1
12のタスク制御ブロック(以下、TCBとして記述す
る)113とを備えている。
Next, an embodiment of the present invention will be described in detail with reference to the drawings. FIG. 1 shows a first embodiment of the present invention.
It is a block diagram showing the composition of the stack protection device concerning an embodiment. The stack protection apparatus according to the first embodiment of the present invention includes a microprocessor (hereinafter, referred to as an MPU) 101, an MMU (memory management mechanism) 102, a main storage memory 104, a page table 109, a page protection exception Page protection exception processing unit 1 for processing 110
23, the real-time OS 111, and the task management means 1
12 task control blocks (hereinafter, referred to as TCBs) 113.

【0021】リアルタイムOS111は、タスクスイッ
チング手段103と、タスク切り替え手段124とを含
んでいる。タスクスイッチング手段103は、ページ情
報書き換え手段105を備えている。
The real-time OS 111 includes a task switching unit 103 and a task switching unit 124. The task switching means 103 includes a page information rewriting means 105.

【0022】主記憶メモリ104は、システムのテキス
トセグメント106、システムのデータセグメント10
7、各タスクのスタック108とを備えている。
The main memory 104 includes a system text segment 106 and a system data segment 10.
7, a stack 108 for each task.

【0023】また、TCB113は、スタック開始アド
レス114と、スタックサイズ115と、スタックポイ
ンタ117と、プログラムカウンタ118と、汎用レジ
スタ119と、ステータスレジスタ120と、タスク名
称121及びタスクID122とを備えている。
The TCB 113 has a stack start address 114, a stack size 115, a stack pointer 117, a program counter 118, a general-purpose register 119, a status register 120, a task name 121, and a task ID 122. .

【0024】図2は、タスクスイッチング時に待ち行列
の最も優先度の高いタスクを実行させるときのスタック
保護方式の動作を示す流れ図である。
FIG. 2 is a flowchart showing the operation of the stack protection method when executing the task with the highest priority in the queue at the time of task switching.

【0025】図1及び図2を参照してスタック保護方式
の動作について述べる。
The operation of the stack protection system will be described with reference to FIGS.

【0026】リアルタイムOS111はアプリケーショ
ンからの要求により、タスク管理手段112に対して、
タスクを生成させ、主記憶メモリ104上にスタック1
08を割り当てる。タスク管理手段112はTCB11
3上に、スタック開始アドレス114とスタックサイズ
115を設定する。ページ情報書き換え手段105はス
タック108が割り当てられると、ページテーブル10
9上にスタック108のページ情報116を設定する。
このとき、生成されたタスクのスタックのページ情報の
保護情報は、読み書き禁止に設定する。
The real-time OS 111 issues a request from the application to the task management means 112,
A task is generated and the stack 1 is stored on the main memory 104.
08 is assigned. The task management means 112 is the TCB 11
3, a stack start address 114 and a stack size 115 are set. When the stack 108 is allocated, the page information rewriting means 105
The page information 116 of the stack 108 is set on 9.
At this time, the protection information of the page information of the generated task stack is set to read / write prohibition.

【0027】現在実行中のタスクがI/Oの入出力待ち
やシステムコールの起動後に、リアルタイムOS111
はタスクスイッチング手段103に対して、タスクスイ
ッチングを行うように指示する。タスクスイッチング手
段103は、処理ステップ201に示すように、タスク
の待ち行列から最も優先度の高いレディ状態のタスク1
の優先度を取得し、ステップ208に示すように、レデ
ィ状態のタスクの優先度と現在実行中のタスク1との優
先度の比較を行い、もし、現在実行中のタスクの優先度
の方が高ければ、タスクスイッチング手段103はタス
クのスイッチングを行わず、ステップ211に進み、リ
ターンとして処理を戻す。
After the currently executing task waits for an I / O input / output or activates a system call, the real-time OS 111
Instructs the task switching means 103 to perform task switching. As shown in processing step 201, the task switching means 103 sends the task 1 in the ready state having the highest priority from the task queue.
The priority of the task in the ready state is compared with the priority of the currently executing task 1 as shown in step 208, and if the priority of the currently executing task is If it is higher, the task switching means 103 does not perform task switching, proceeds to step 211, and returns the processing as a return.

【0028】もし、現在実行中のタスクよりもタスク1
の優先度が高ければ、処理ステップ201から202に
進む。そして、この処理ステップ202において、ペー
ジ情報書き換え手段105からタスク1のスタックのペ
ージ情報をページテーブル109から取得する。
If task 1 is more active than the currently executing task
If the priority of is higher, the process proceeds from processing steps 201 to 202. Then, in this processing step 202, the page information of the stack of the task 1 is acquired from the page table 109 from the page information rewriting unit 105.

【0029】もし、ページテーブル109上にタスク1
のスタックのページ情報が存在しない場合、タスクスイ
ッチング手段103はタスクスイッチングを行わず、処
理ステップ212に示すように待ち行列からタスク1を
削除する。そして、処理ステップ213に示すようにリ
ターンとして処理を戻す。
If the task 1 is displayed on the page table 109,
If no stack page information exists, the task switching means 103 does not perform the task switching, and deletes the task 1 from the queue as shown in the processing step 212. Then, as shown in processing step 213, the processing is returned as a return.

【0030】次に、タスク1のスタックのページ情報2
を取得すると、ステップ処理204に示すようにタスク
1のTCB113からスタックポインタ117を取得す
る。タスクスイッチング手段103は処理ステップ20
5に示すように、MPU101のスタックポインタ、プ
ログラムカウンタ、汎用レジスタを現在実行中のタスク
のTCBに格納する。
Next, page information 2 of the stack of task 1
Is acquired, the stack pointer 117 is acquired from the TCB 113 of the task 1 as shown in step processing 204. The task switching means 103 performs processing step 20
As shown in FIG. 5, the stack pointer, program counter, and general-purpose register of the MPU 101 are stored in the TCB of the currently executing task.

【0031】そして、ページ書き換え手段105から処
理ステップ206に示すように、現在実行中のタスクの
スタックのページ情報をページテーブル109から取得
する。タスクスイッチング手段103は、ページテーブ
ル書き換え手段105に対して、取得したページ情報を
渡し、このページ情報の保護情報を読み書き禁止に設定
し、処理ステップ207に示すように、ページテーブル
109に設定するように要求する。次に、タスク1のペ
ージ情報2に対して、処理ステップ209に示すよう
に、保護情報を読み書き可能に設定し、ページテーブル
109に設定する。
Then, as shown in the processing step 206 from the page rewriting means 105, the page information of the stack of the task currently being executed is acquired from the page table 109. The task switching means 103 passes the acquired page information to the page table rewriting means 105, sets the protection information of this page information to read / write prohibition, and sets it in the page table 109 as shown in processing step 207. Request to. Next, as shown in a processing step 209, the protection information is set to be readable and writable for the page information 2 of the task 1, and is set in the page table 109.

【0032】タスク切り替え手段124は処理ステップ
210に示すように、タスク1のTCB113から待避
されていたスタックポインタ117、プログラムカウン
タ118、汎用レジスタ119及びステータスレジスタ
120をMPU101のスタックポインタ、プログラム
カウンタ、汎用レジスタ及びステータスレジスタに設定
する。そして、処理ステップ211に進み、リターンと
なる。
As shown in processing step 210, the task switching means 124 replaces the stack pointer 117, program counter 118, general-purpose register 119 and status register 120 saved from the TCB 113 of task 1 with the stack pointer, program counter, general-purpose Set in the register and status register. Then, the process proceeds to the processing step 211 and returns.

【0033】以上のように、本発明の第1の実施形態に
よれば、タスクが他のタスクのプログラムのバグにより
にスタックのデータを書き換えられたために異なった動
作や異常な処理、不当なメモリアクセス等が発生する現
象に対して、現在実行しているタスクが他のタスクのス
タックへのアクセスした場合にページ保護例外処理を設
けるように構成したので、タスクの暴走によるシステム
ダウンを効果的に防止することができるスタック保護装
置を実現することができる。
As described above, according to the first embodiment of the present invention, since a task has been rewritten in the stack due to a bug in a program of another task, different operations, abnormal processing, and improper memory In response to the occurrence of access, etc., the system is configured to provide page protection exception handling when the currently executing task accesses the stack of another task, so that system down due to runaway of the task can be effectively prevented A stack protection device that can be prevented can be realized.

【0034】図3は、本発明の第2の実施形態であるス
タック保護装置の構成を示すブロック図である。この図
3の例においては、図1に示したスタック保護装置の構
成に、エラー出力手段301と、端末302とが追加さ
れている。ページ保護例外処理110は、エラー出力手
段301により処理される。
FIG. 3 is a block diagram showing a configuration of a stack protection device according to a second embodiment of the present invention. In the example of FIG. 3, an error output unit 301 and a terminal 302 are added to the configuration of the stack protection device shown in FIG. The page protection exception processing 110 is processed by the error output unit 301.

【0035】図4は、タスクスイッチング時に待ち行列
の最も優先度の高いタスクを実行させるときに、このタ
スクのスタックのページ情報がページテーブル109に
存在しない場合にエラー出力手段301によって、端末
302にエラー情報を出力する場合の動作を示す流れ図
である。なお、この図4は、図2のフローチャートのス
テップ212と213との間にステップ401が加入さ
れたものであり、他のステップは、図2のステップと同
様となっている。
FIG. 4 shows that when the task with the highest priority in the queue is executed at the time of task switching, if the page information of the stack of this task does not exist in the page table 109, the error output means 301 sends the information to the terminal 302. 9 is a flowchart illustrating an operation when outputting error information. In FIG. 4, step 401 is added between steps 212 and 213 of the flowchart of FIG. 2, and the other steps are the same as the steps of FIG.

【0036】次に、タスクスイッチングにより待ち行列
で最も優先度の高いタスクにMPU102を割り当てる
時にページテーブル105に、このタスクのスタックの
ページ情報が存在しないときにエラー情報を端末302
に表示するときの動作について、図3及び図4を参照し
て述べる。なお、上述したように、図4は、ステップ4
01以外の他のステップは、図2のステップと同様とな
っているので異なる点のみ説明する。
Next, when the MPU 102 is assigned to the task with the highest priority in the queue by task switching, error information is stored in the page table 105 when page information of the stack of this task does not exist.
Will be described with reference to FIGS. 3 and 4. FIG. Note that, as described above, FIG.
Steps other than 01 are the same as the steps in FIG. 2, and therefore only different points will be described.

【0037】図4の処理ステップ202において、ペー
ジテーブル109に待ち行列で最も優先度の高いタスク
1のスタックのページ情報が存在しない場合、ステップ
処理401に示すようにTCB113のタスク名称12
1、タスクID122及びエラーメッセージを端末30
2に出力する。そして、処理ステップ213に示すよう
にタスクスイッチング手段103はタスクのスイッチン
グを行わず、リターンとなる。
In the processing step 202 of FIG. 4, if the page information of the stack of the task 1 having the highest priority in the queue does not exist in the page table 109, the task name 12 of the TCB 113 is displayed as shown in step processing 401.
1. The task ID 122 and the error message are sent to the terminal 30.
Output to 2. Then, as shown in processing step 213, the task switching means 103 does not perform task switching and returns.

【0038】本発明の第2の実施形態によれば、タスク
が他のタスクのプログラムのバグによりにスタックのデ
ータを書き換えられたために異なった動作や異常な処
理、不当なメモリアクセス等が発生する現象に対して、
現在実行しているタスクが他のタスクのスタックへのア
クセスした場合にページ保護例外処理を設け、しかも、
エラー表示手段を設けて、不当なメモリアクセス等が発
生する現象が発生したときにエラー情報を表示するよう
に構成したので、タスクの暴走によるシステムダウンを
効果的に防止することができるとともに、不当なメモリ
アクセスの発生を容易に検出可能であるスタック保護装
置を実現することができる。
According to the second embodiment of the present invention, a different operation, abnormal processing, improper memory access, and the like occur because a task has rewritten the data in the stack due to a bug in a program of another task. For the phenomenon,
Set a page protection exception when the currently executing task accesses the stack of another task, and
An error display means is provided to display error information when a phenomenon such as improper memory access occurs occurs. Thus, it is possible to effectively prevent the system from going down due to a runaway task, and Thus, it is possible to realize a stack protection device that can easily detect occurrence of a complicated memory access.

【0039】図5は、本発明の第3の実施形態であるス
タック保護装置の構成を示すブロック図である。この図
5の例においては、図1に示したスタック保護装置の構
成に、エラー待避手段501と、不揮発性メモリ502
とが追加され、ページ情報書き換え手段103が、エラ
ー待避手段501を備える。
FIG. 5 is a block diagram showing a configuration of a stack protection device according to a third embodiment of the present invention. In the example of FIG. 5, an error saving unit 501 and a nonvolatile memory 502 are added to the configuration of the stack protection device shown in FIG.
Are added, and the page information rewriting unit 103 includes an error saving unit 501.

【0040】図6は、タスクスイッチング時に待ち行列
の最も優先度の高いタスクを実行させるときにこのタス
クのスタックのページ情報がページテーブル109に存
在しない場合にエラー待避手段501によって、不揮発
性メモリ502にエラー情報を出力する場合の動作を示
す流れ図である。なお、この図6は、図2のフローチャ
ートのステップ212と213との間にステップ601
が加入されたものであり、他のステップは、図2のステ
ップと同様となっている。
FIG. 6 shows an example in which when the task with the highest priority in the queue is executed at the time of task switching, if the page information of the stack of this task does not exist in the page table 109, the non-volatile memory 502 9 is a flowchart showing an operation when error information is output to a STA. Note that FIG. 6 includes a step 601 between steps 212 and 213 in the flowchart of FIG.
Are added, and the other steps are the same as the steps in FIG.

【0041】次に、タスクスイッチングにより待ち行列
で最も優先度の高いタスクにMPU102を割り当てる
時にページテーブル105にこのタスクのスタックのペ
ージ情報が存在しないときにエラー情報を不揮発性メモ
リ502に表示するときの動作について、図5及び図6
を参照して述べる。なお、上述したように、図6は、ス
テップ601以外の他のステップは、図2のステップと
同様となっているので異なる点のみ説明する。
Next, when the MPU 102 is assigned to the task with the highest priority in the queue by task switching, when the page information of the stack of this task does not exist in the page table 105, error information is displayed in the nonvolatile memory 502. 5 and FIG.
Will be described with reference to FIG. Note that, as described above, FIG. 6 is the same as the step in FIG. 2 except for step 601, and thus only different points will be described.

【0042】処理ステップ202において、ページテー
ブル109に待ち行列で最も優先度の高いタスク1のス
タックのページ情報が存在しない場合、ステップ処理6
01に示すように、TCB113のタスク名称121、
タスクID122及びエラーメッセージを不揮発性メモ
リ502に待避する。そして、処理ステップ213に示
すようにタスクスイッチング手段103はタスクのスイ
ッチングを行わず、リターンとなる。上述した本発明の
第3の実施形態においても、第2の実施形態と同様な効
果を得ることができる。
In processing step 202, if there is no page information of the stack of task 1 having the highest priority in the queue in the page table 109, step processing 6
01, the task name 121 of the TCB 113,
The task ID 122 and the error message are saved in the nonvolatile memory 502. Then, as shown in processing step 213, the task switching means 103 does not perform task switching and returns. In the third embodiment of the present invention described above, the same effect as in the second embodiment can be obtained.

【0043】図7は、本発明の第4の実施形態であるス
タック保護装置の構成を示すブロック図である。この図
7の例においては、図1に示したスタック保護装置の構
成に、エラー待避手段701と、ハードディスク(以
下、H/Dとして記述)703とが追加され、エラー待
避手段701は、ファイルシステム702を含んで構成
されている。
FIG. 7 is a block diagram showing a configuration of a stack protection device according to a fourth embodiment of the present invention. In the example of FIG. 7, an error saving unit 701 and a hard disk (hereinafter, referred to as H / D) 703 are added to the configuration of the stack protection device shown in FIG. 702.

【0044】図8は、タスクスイッチング時に待ち行列
の最も優先度の高いタスクを実行させるときにこのタス
クのスタックのページ情報がページテーブル109に存
在しないときにエラー待避手段701によって、H/D
703にエラー情報を出力する場合の動作を示す流れ図
である。
FIG. 8 shows an example in which the task with the highest priority in the queue is executed at the time of task switching, and the H / D is saved by the error saving means 701 when the page information of the stack of the task does not exist in the page table 109.
703 is a flowchart showing the operation when outputting error information to 703.

【0045】なお、この図8は、図2のフローチャート
のステップ212と213との間にステップ801、8
02、803が加入されたものであり、他のステップ
は、図2のステップと同様となっている。
FIG. 8 shows steps 801 and 8 between steps 212 and 213 in the flowchart of FIG.
02 and 803 are added, and the other steps are the same as the steps in FIG.

【0046】次に、タスクスイッチングにより待ち行列
で最も優先度の高いタスクにMPU102を割り当てる
時にページテーブル105に、このタスクのスタックの
ページ情報が存在しないときにエラー情報をH/D70
3に表示するときの動作について、図7及び図8を参照
して述べる。
Next, when the MPU 102 is assigned to the task with the highest priority in the queue by task switching, error information is stored in the page table 105 when the page information of the stack of this task does not exist in the H / D 70.
3 will be described with reference to FIGS. 7 and 8. FIG.

【0047】なお、上述したように、図8は、ステップ
801〜803以外の他のステップは、図2のステップ
と同様となっているので異なる点のみ説明する。
As described above, FIG. 8 is the same as FIG. 2 except for steps 801 to 803, and therefore only different points will be described.

【0048】処理ステップ202において、ページテー
ブル109に待ち行列で最も優先度の高いタスク1のス
タックのページ情報が存在しない場合、ステップ処理8
01に示すようにエラー待避手段701はファイルシス
テム702に対して、エラー情報を書き込むためのファ
イルをオープンするよう要求する。
If it is determined in step 202 that the page information of the stack of the task 1 having the highest priority in the queue does not exist in the page table 109, step processing 8
As shown at 01, the error saving unit 701 requests the file system 702 to open a file for writing error information.

【0049】もし、ファイルのオープンを成功したなら
ば、処理ステップ802に示すようにオープンしたファ
イルにTCB113のタスク名称121、タスクID1
22及びエラーメッセージを書き込む。そして、処理ス
テップ803に示すように、このファイルをクローズす
る。最後に処理ステップ213に示すようにタスクスイ
ッチング手段103はタスクのスイッチングを行わず、
リターンとし処理を戻す。
If the file is successfully opened, the task name 121 and task ID 1 of the TCB 113 are added to the opened file as shown in processing step 802.
22 and an error message. Then, as shown in processing step 803, this file is closed. Finally, as shown in processing step 213, the task switching means 103 does not switch tasks,
Return and return.

【0050】ステップ801において、もし、ファイル
のオープンに失敗したならば、処理ステップ213に示
すようにタスクスイッチング手段103はタスクのスイ
ッチングを行わず、リターンとし処理を戻す。
In step 801, if the opening of the file fails, the task switching means 103 does not perform the task switching as shown in processing step 213, and returns as the processing.

【0051】上述した本発明の第4の実施形態において
も、第2の実施形態と同様な効果を得ることができる。
In the above-described fourth embodiment of the present invention, the same effects as in the second embodiment can be obtained.

【0052】図9は、本発明の第5の実施形態であるス
タック保護装置の構成を示すブロック図である。この図
9の例においては、図1に示したスタック保護装置の構
成に、エラー出力手段901と、リモートPC (パソ
コン)903とが追加され、エラー出力手段901は、
ネットワーク通信手段902を含んで構成されている。
FIG. 9 is a block diagram showing a configuration of a stack protection device according to a fifth embodiment of the present invention. In the example of FIG. 9, an error output unit 901 and a remote PC (personal computer) 903 are added to the configuration of the stack protection device shown in FIG.
It is configured to include a network communication unit 902.

【0053】図10は、タスクスイッチング時に待ち行
列の最も優先度の高いタスクを実行させるときにこのタ
スクのスタックのページ情報がページテーブル109に
存在しない場合にエラー出力手段901によって、リモ
ートPC903にエラー情報を出力する場合の動作を示
す流れ図である。
FIG. 10 shows an example in which when the task with the highest priority in the queue is executed at the time of task switching, if the page information of the stack of the task does not exist in the page table 109, an error is output to the remote PC 903 by the error output means 901. 5 is a flowchart illustrating an operation when outputting information.

【0054】なお、この図10においては、図2のフロ
ーチャートのステップ201の次にステップ202が実
行され、このステップ202でページ情報の取得に成功
した場合は、ステップ208に進む。ステップ208か
らステップ204又はステップ211に進む。そして、
図10においては、図2のフローチャートのステップ2
12と213との間にステップ1001、1002、1
003が加入されており、他のステップは、図2のステ
ップと同様となっている。
In FIG. 10, step 202 is executed after step 201 in the flowchart of FIG. 2. If the page information is successfully acquired in step 202, the process proceeds to step 208. The process proceeds from step 208 to step 204 or step 211. And
In FIG. 10, step 2 of the flowchart of FIG.
Between steps 12 and 213, steps 1001, 1002, 1
003 has been added, and the other steps are the same as the steps in FIG.

【0055】次に、タスクスイッチングにより待ち行列
で最も優先度の高いタスクにMPU102を割り当てる
時にページテーブル105にこのタスクのスタックのペ
ージ情報が存在しないときに、エラー情報をイーサネッ
トで接続されたリモートPC903に出力する動作につ
いて、図9及び図10を参照して述べる。
Next, when the MPU 102 is assigned to the task with the highest priority in the queue by task switching, if the page information of the stack of this task does not exist in the page table 105, the error information is transmitted to the remote PC 903 connected by Ethernet. Will be described with reference to FIGS. 9 and 10. FIG.

【0056】なお、上述したように、図10は、上述し
たステップ1001、1002、1003以外の他のス
テップは、図2のステップと同様となっているので異な
る点のみ説明する。
As described above, in FIG. 10, steps other than the above-described steps 1001, 1002, and 1003 are the same as the steps in FIG. 2, and therefore only different points will be described.

【0057】図10の処理ステップ202において、ペ
ージテーブル109に待ち行列で最も優先度の高いタス
ク1のスタックのページ情報が存在しない場合、ステッ
プ処理1001に示すようにエラー出力手段901はネ
ットワーク通信手段902に対して、エラー情報を出力
するためにリモートPC903とコネクション接続する
ように要求する。
In the processing step 202 of FIG. 10, if the page information of the stack of the task 1 having the highest priority in the queue does not exist in the page table 109, the error output means 901 sets the network communication means as shown in step processing 1001. 902 is requested to connect to the remote PC 903 to output error information.

【0058】ステップ1001において、もし、コネク
ション接続に成功したならば、処理ステップ1002に
示すように、リモートPC903に対して、TCB11
3のタスク名称121、タスクID122及びエラーメ
ッセージを送信する。そして、処理ステップ1003に
示すように、リモートPC903とのコネクションを切
断する。最後に、処理ステップ213に示すようにタス
クスイッチング手段103はタスクのスイッチングを行
わず、リターンとし処理を戻す。
In step 1001, if the connection is successful, as shown in processing step 1002, the remote PC 903 is sent to the TCB 11
The third task name 121, task ID 122, and error message are transmitted. Then, as shown in processing step 1003, the connection with the remote PC 903 is disconnected. Finally, as shown in processing step 213, the task switching means 103 does not perform task switching, and returns to the processing.

【0059】ステップ1001において、もし、コネク
ション接続に失敗したならば、処理ステップ213に示
すように、タスクスイッチング手段103はタスクのス
イッチングを行わず、リターンとし、処理を戻す。
In step 1001, if the connection fails, the task switching means 103 does not perform task switching and returns as shown in processing step 213, and returns the processing.

【0060】上述した本発明の第5の実施形態において
も、第2の実施形態と同様な効果を得ることができる。
In the fifth embodiment of the present invention described above, the same effects as in the second embodiment can be obtained.

【0061】図11は、本発明の第6の実施形態におい
て、現在実行中のタスクがページテーブル109に記述
されていないブロックにアクセスした場合の動作を示す
流れ図である。なお、この第6の実施形態であるスタッ
ク保護装置の構成は、図1に示した構成と同様となるの
で、図示は省略する。
FIG. 11 is a flowchart showing the operation when the currently executing task accesses a block not described in the page table 109 in the sixth embodiment of the present invention. The configuration of the stack protection device according to the sixth embodiment is the same as the configuration shown in FIG.

【0062】次に、現在実行中のタスクが他のタスクの
スタックにアクセスしたためにページ保護例外が発生し
たときの動作について、図1及び図11を参照して述べ
る。現在実行中のタスクが他のタスクのスタックにアク
セスすると、MMU102はMPU101に対して、ペ
ージ保護例外110を発生するように要求する。
Next, an operation when a page protection exception occurs because a currently executing task accesses a stack of another task will be described with reference to FIGS. When the currently executing task accesses the stack of another task, the MMU 102 requests the MPU 101 to generate a page protection exception 110.

【0063】ページ保護例外110が発生すると、MP
U101はページ保護例外処理部123を起動する。ペ
ージ保護例外処理部123は、処理ステップ1101に
示すように、現在実行中のタスクを休止状態にする(サ
スペンド)。次に、リアルタイムOS111は処理ステ
ップ1102に示すように、タスクスイッチング手段1
03に対して、タスクスイッチングを開始するように要
求する。
When page protection exception 110 occurs, MP
U101 activates the page protection exception processing unit 123. The page protection exception processing unit 123 puts the currently executing task into a suspended state (suspend) as shown in processing step 1101. Next, as shown in processing step 1102, the real-time OS 111
03 to start task switching.

【0064】タスクスイッチング手段103は、処理ス
テップ201に示すように、タスクの待ち行列から最も
優先度の高いタスク1を取得する。そして、処理ステッ
プ204に示すようにタスク1のTCB113からスタ
ックポインタを取得する。
The task switching means 103 acquires the task 1 with the highest priority from the task queue as shown in the processing step 201. Then, the stack pointer is acquired from the TCB 113 of the task 1 as shown in the processing step 204.

【0065】タスクスイッチング手段103は、処理ス
テップ202に示すようにページ情報書き換え手段10
5に対して、ページテーブル109からタスク1のスタ
ックのページ情報を取得するように要求する。
The task switching means 103 includes the page information rewriting means 10
5 is requested to acquire the page information of the stack of the task 1 from the page table 109.

【0066】タスクスイッチング手段103はページテ
ーブル書き換え手段105に対して、処理ステップ11
03に示すようにページテーブル109から現在実行中
のタスクのページ情報を削除する。
The task switching means 103 instructs the page table rewriting means 105 to process step 11
As shown at 03, the page information of the currently executing task is deleted from the page table 109.

【0067】もし、タスク1のスタックのページ情報が
存在しないならば、タスクスイッチング手段103はタ
スクのスイッチングを行わず、ステップ212を介して
ステップ201に処理を戻す。
If the page information of the stack of the task 1 does not exist, the task switching means 103 does not perform the task switching and returns the processing to the step 201 via the step 212.

【0068】もし、タスク1のスタックのページ情報が
存在するならば、タスクスイッチング手段103はペー
ジ情報書き換え手段105に対して、処理ステップ20
9に示すように、タスク1のページ情報の保護情報を読
み書き可能に設定し、ページテーブル109に設定する
ように要求する。
If the page information of the stack of the task 1 exists, the task switching means 103 sends the page information rewriting means 105
As shown in FIG. 9, the protection information of the page information of task 1 is set to be readable and writable, and a request is made to set it in the page table 109.

【0069】そして、タスクスイッチング手段103は
処理ステップ210に示すように、タスク1のTCB1
13から待避していたスタックポインタ117、プログ
ラムカウンタ118、汎用レジスタ119及びステータ
スレジスタ120をMPU101のスタックポインタ、
プログラムカウンタ、汎用レジスタ及びステータスレジ
スタに設定する。そして、処理ステップ211に示すよ
うに、リターンとし、処理を返す。上述した本発明の第
6の実施形態においても、第1の実施形態と同様な効果
を得ることができる。
Then, as shown in the processing step 210, the task switching means 103
The stack pointer 117, the program counter 118, the general-purpose register 119, and the status register 120 evacuated from the MPU 13 are stored in the stack pointer of the MPU 101.
Set in the program counter, general-purpose register, and status register. Then, as shown in processing step 211, a return is made and the processing is returned. In the above-described sixth embodiment of the present invention, effects similar to those of the first embodiment can be obtained.

【0070】図12は、本発明の第7の実施形態である
スタック保護装置の構成を示すブロック図である。この
図12の例においては、図1に示したスタック保護装置
のページ保護例外処理部123に代えてページ保護例外
処理部1201が配置され、端末302が追加されてい
る。そして、ページ保護例外処理部1201は、エラー
情報を出力するエラー出力手段301を含んで構成され
ている。
FIG. 12 is a block diagram showing the configuration of the stack protection device according to the seventh embodiment of the present invention. In the example of FIG. 12, a page protection exception processing unit 1201 is provided instead of the page protection exception processing unit 123 of the stack protection device shown in FIG. 1, and a terminal 302 is added. The page protection exception processing unit 1201 includes an error output unit 301 that outputs error information.

【0071】図13は、現在実行中のタスクが他のタス
クのスタックにアクセスしたときに端末302にエラー
情報を出力する動作を示す流れ図である。なお、この図
13は、図11のフローチャートのステップ212と2
01との間にステップ1301が加入されたものであ
り、他のステップは、図11のステップと同様となって
いる。
FIG. 13 is a flowchart showing the operation of outputting error information to the terminal 302 when the currently executing task accesses the stack of another task. Note that FIG. 13 corresponds to steps 212 and 2 in the flowchart of FIG.
The step 1301 is added between the steps 01 and 01, and the other steps are the same as the steps in FIG.

【0072】次に、現在実行中のタスクが他のタスクの
スタックにアクセスしたためにページ保護例外が発生し
た時に端末302にエラー情報を出力する場合の動作に
ついて、図12及び図13を参照して述べる。なお、上
述したように、図13は、ステップ1301以外の他の
ステップは、図11のステップと同様となっているので
異なる点のみ説明する。
Next, the operation of outputting error information to the terminal 302 when a page protection exception occurs due to the currently executing task accessing the stack of another task will be described with reference to FIGS. State. Note that, as described above, FIG. 13 is the same as the step in FIG. 11 except for step 1301, and thus only different points will be described.

【0073】ページ保護例外が発生すると、MPU10
1はページ保護例外処理部1201を起動する。ページ
保護例外処理部1201は、処理ステップ1301に示
すように端末302に対して、TCB113のタスク名
称121、タスクID122及びエラーメッセージを出
力する。
When a page protection exception occurs, the MPU 10
1 activates the page protection exception processing unit 1201. The page protection exception processing unit 1201 outputs the task name 121, the task ID 122, and the error message of the TCB 113 to the terminal 302 as shown in processing step 1301.

【0074】ページ保護例外処理部1201は、処理ス
テップ1101に示すように現在実行中のタスクを休止
状態にする。次に、リアルタイムOS112は処理ステ
ップ1102に示すようにタスクスイッチング手段10
3に対して、タスクスイッチングを開始するように要求
する。タスクスイッチング手段103は、処理ステップ
201、204に示すように、タスクの待ち行列から最
も優先度の高いタスク1を取得する。
The page protection exception processing unit 1201 puts the currently executing task into a sleep state as shown in processing step 1101. Next, as shown in processing step 1102, the real-time OS 112
3 is required to start task switching. The task switching means 103 acquires the task 1 having the highest priority from the task queue as shown in processing steps 201 and 204.

【0075】タスクスイッチング手段103は処理ステ
ップ202に示すようにページ情報書き換え手段105
に対して、ページテーブル109からこのタスク1のス
タックのページ情報を取得するように要求する。
The task switching means 103 includes the page information rewriting means 105 as shown in the processing step 202.
Is requested to acquire the page information of the stack of the task 1 from the page table 109.

【0076】もし、タスク1のスタックのページ情報が
存在しないならば、タスクスイッチング手段103はタ
スクのスイッチングを行わず、処理を戻す。
If the page information of the stack of the task 1 does not exist, the task switching means 103 does not switch the task and returns the processing.

【0077】もし、タスク1のスタックのページ情報が
存在するならば、タスクスイッチング手段103はペー
ジテーブル書き換え手段105に対して、処理ステップ
1103に示すようにページテーブル109から現在実
行中のタスクのページ情報を削除する。
If the page information of the stack of the task 1 exists, the task switching means 103 instructs the page table rewriting means 105 from the page table 109 as shown in the processing step 1103 for the page of the task currently being executed. Delete information.

【0078】タスクスイッチング手段103はページ情
報書き換え手段105に対して、処理ステップ209に
示すようにタスク1のページ情報の保護情報を読み書き
可能に設定し、ページテーブル109に設定するように
要求する。
The task switching means 103 requests the page information rewriting means 105 to set the protection information of the page information of the task 1 to be readable and writable as shown in the processing step 209 and to set the protection information in the page table 109.

【0079】そして、タスク切り替え手段103は処理
ステップ210に示すようにタスク1のTCB113か
ら待避していたスタックポインタ117、プログラムカ
ウンタ118、汎用レジスタ119及びステータスレジ
スタ120をMPU101のスタックポインタ、プログ
ラムカウンタ、汎用レジスタ及びステータスレジスタに
設定する。そして、処理ステップ211に示すように処
理を返す。上述した本発明の第7の実施形態において
も、第2の実施形態と同様な効果を得ることができる。
Then, the task switching means 103 stores the stack pointer 117, the program counter 118, the general-purpose register 119 and the status register 120 evacuated from the TCB 113 of the task 1 into the stack pointer, program counter, Set in the general-purpose register and status register. Then, the process returns as shown in processing step 211. In the above-described seventh embodiment of the present invention, the same effects as in the second embodiment can be obtained.

【0080】図14は、本発明の第8の実施形態である
スタック保護装置の構成を示すブロック図である。この
図14の例においては、図1に示したスタック保護装置
のページ保護例外処理部123に代えてページ保護例外
処理部1201が配置され、不揮発性メモリ502が追
加されている。そして、ページ保護例外処理部1201
は、エラー情報を待避させるエラー待避手段501を含
んで構成されている。
FIG. 14 is a block diagram showing the configuration of the stack protection device according to the eighth embodiment of the present invention. In the example of FIG. 14, a page protection exception processing unit 1201 is provided instead of the page protection exception processing unit 123 of the stack protection device shown in FIG. 1, and a nonvolatile memory 502 is added. Then, the page protection exception processing unit 1201
Is configured to include error saving means 501 for saving error information.

【0081】図15は、現在実行中のタスクが他のタス
クのスタックにアクセスしたときに不揮発性メモリ50
2にエラー情報を出力する動作を示す流れ図である。な
お、この図15は、図13のフローチャートのステップ
1301に代えてステップ1501が加入されたもので
あり、他のステップは、図13のステップと同様となっ
ている。
FIG. 15 shows a state where the currently executing task accesses the stack of another task when the nonvolatile memory 50 is accessed.
2 is a flowchart showing an operation of outputting error information to the second embodiment. In FIG. 15, step 1501 is added instead of step 1301 in the flowchart in FIG. 13, and the other steps are the same as those in FIG.

【0082】次に、現在実行中のタスクが他のタスクの
スタックにアクセスしたためにページ保護例外が発生し
た時に不揮発性メモリ502にエラー情報を待避する場
合の動作について、図14及び図15を参照して述べ
る。なお、上述したように、図15は、ステップ130
1以外の他のステップは、図13のステップと同様とな
っているので異なる点のみ説明する。
Next, with reference to FIGS. 14 and 15, the operation when the error information is saved in the nonvolatile memory 502 when a page protection exception occurs due to the currently executing task accessing the stack of another task. I will describe. Note that, as described above, FIG.
Steps other than 1 are the same as the steps in FIG. 13, and therefore only different points will be described.

【0083】ページ保護例外が発生すると、MPU10
1はページ保護例外処理部1201を起動する。ページ
保護例外処理1201は、処理ステップ1501に示す
ように不揮発性メモリ502に対して、TCB113の
タスク名称121、タスクID122及びエラーメッセ
ージを格納する。
When a page protection exception occurs, the MPU 10
1 activates the page protection exception processing unit 1201. The page protection exception process 1201 stores the task name 121, the task ID 122, and the error message of the TCB 113 in the nonvolatile memory 502 as shown in a process step 1501.

【0084】ページ保護例外処理部1201は、処理ス
テップ1101に示すように現在実行中のタスクを休止
状態にする。次に、リアルタイムOS112は処理ステ
ップ1102に示すようにタスクスイッチング手段10
3に対して、タスクスイッチングを開始するように要求
する。タスクスイッチング手段103は、処理ステップ
201、204に示すように、タスクの待ち行列から最
も優先度の高いタスク1を取得する。
The page protection exception processing unit 1201 puts the currently executing task into a sleep state as shown in processing step 1101. Next, as shown in processing step 1102, the real-time OS 112
3 is required to start task switching. The task switching means 103 acquires the task 1 having the highest priority from the task queue as shown in processing steps 201 and 204.

【0085】次に、タスクスイッチング手段103は、
処理ステップ202に示すようにページテーブル書き換
え手段105に対して、ページテーブル109からタス
ク1のスタックのページ情報を取得するように要求す
る。
Next, the task switching means 103
As shown in the processing step 202, the page table rewriting unit 105 is requested to acquire the page information of the stack of the task 1 from the page table 109.

【0086】もし、タスク1のスタックのページ情報が
存在しないならば、タスクスイッチング手段103はタ
スクのスイッチングを行わず、ステップ212、150
1を介してステップ201に処理を戻す。
If the page information of the stack of the task 1 does not exist, the task switching means 103 does not switch the task, and the steps 212 and 150 are not performed.
Then, the process returns to step 201 via step 1.

【0087】もし、タスク1のスタックのページ情報が
存在するならば、タスクスイッチング手段103はペー
ジテーブル書き換え手段105に対して、処理ステップ
1103に示すようにページテーブル109から現在実
行中のタスクのページ情報を削除する。
If the page information of the stack of the task 1 exists, the task switching means 103 instructs the page table rewriting means 105 to read the page of the currently executing task from the page table 109 as shown in processing step 1103. Delete information.

【0088】タスクスイッチング手段103はページ情
報書き換え手段105に対して、処理ステップ209に
示すように、タスク1のページ情報の保護情報を読み書
き可能に設定し、ページテーブル109に設定するよう
に要求する。
The task switching means 103 requests the page information rewriting means 105 to set the protection information of the page information of the task 1 to be readable and writable, and to set it in the page table 109, as shown in processing step 209. .

【0089】そして、タスクスイッチング手段103は
処理ステップ210に示すようにタスク1のTCB11
2から待避していたスタックポインタ117、プログラ
ムカウンタ118、汎用レジスタ119及びステータス
レジスタ120をMPU101のスタックポインタ、プ
ログラムカウンタ、汎用レジスタ及びステータスレジス
タに設定する。そして、処理ステップ211に示すよう
に処理を返す。
Then, the task switching means 103 executes the TCB 11 of the task 1 as shown in the processing step 210.
The stack pointer 117, the program counter 118, the general-purpose register 119, and the status register 120 saved from Step 2 are set as the stack pointer, the program counter, the general-purpose register, and the status register of the MPU 101. Then, the process returns as shown in processing step 211.

【0090】上述した本発明の第8の実施形態において
も、第2の実施形態と同様な効果を得ることができる。
In the above-described eighth embodiment of the present invention, the same effects as in the second embodiment can be obtained.

【0091】図16は、本発明の第9の実施形態である
スタック保護装置の構成を示すブロック図である。この
図16の例においては、図1に示したスタック保護装置
のページ保護例外処理部123に代えてページ保護例外
処理部1201が配置され、ハードディスク(H/D)
703が追加されている。そして、ページ保護例外処理
部1201は、H/D703にエラー情報を待避させる
エラー待避手段701を含んで構成されている。このエ
ラー待避手段701は、ファイルシステム702を備え
ている。
FIG. 16 is a block diagram showing the configuration of the stack protection device according to the ninth embodiment of the present invention. In the example of FIG. 16, a page protection exception processing unit 1201 is arranged in place of the page protection exception processing unit 123 of the stack protection device shown in FIG. 1, and a hard disk (H / D)
703 has been added. The page protection exception processing unit 1201 includes an error saving unit 701 that saves error information in the H / D 703. The error saving unit 701 includes a file system 702.

【0092】図17は、現在実行中のタスクが他のタス
クのスタックにアクセスしたときにH/D703にエラ
ー情報を出力する動作を示す流れ図である。なお、この
図17は、図15のフローチャートのステップ1301
に代えてステップ1701〜1703が加入されたもの
であり、他のステップは、図15のステップと同様とな
っている。
FIG. 17 is a flowchart showing the operation of outputting error information to the H / D 703 when the currently executing task accesses the stack of another task. Note that FIG. 17 corresponds to step 1301 in the flowchart of FIG.
Are replaced by steps 1701 to 1703, and the other steps are the same as the steps in FIG.

【0093】次に、現在実行中のタスクが他のタスクの
スタックにアクセスしたためにページ保護例外が発生し
た時にH/D703にエラー情報を待避する場合の動作
について、図16及び図17を参照して述べる。
Next, with reference to FIGS. 16 and 17, the operation in the case where error information is saved in the H / D 703 when a page protection exception occurs because the currently executing task accesses the stack of another task will be described. State.

【0094】ページ保護例外110が発生すると、MP
U101はページ保護例外処理部1201を起動する。
ページ保護例外処理部1201は処理ステップ1701
に示すように、ファイルシステム702に対して、エラ
ー情報を格納するためのファイルをオープンするように
要求する。もし、ファイルのオープンに失敗したなら
ば、処理ステップ201を実行する。
When page protection exception 110 occurs, MP
U101 activates the page protection exception processing unit 1201.
The page protection exception processing unit 1201 performs processing step 1701
As shown in (1), the file system 702 is requested to open a file for storing error information. If the opening of the file fails, the processing step 201 is executed.

【0095】ステップ1701において、もし、ファイ
ルのオープンに成功したならば、処理ステップ1702
に示すようにこのファイルに対して、TCB113のタ
スク名称121、タスクID122及びエラーメッセー
ジ(エラー情報)を書き込む。そして、処理ステップ1
703に示すように、このファイルをクローズする。
In step 1701, if the file is successfully opened, the processing step 1702
The task name 121, task ID 122, and error message (error information) of the TCB 113 are written in this file as shown in FIG. And processing step 1
As shown at 703, this file is closed.

【0096】次に、ページ保護例外処理部1201は、
処理ステップ1101に示すように現在実行中のタスク
を休止状態にする。次に、リアルタイムOS112は処
理ステップ1102に示すようにタスクスイッチング手
段103に対して、タスクスイッチングを開始するよう
に要求する。タスクスイッチング手段103は、処理ス
テップ201、204に示すように、タスクの待ち行列
から最も優先度の高いタスク1を取得する。
Next, the page protection exception processing unit 1201
As shown in processing step 1101, the currently executing task is put into a sleep state. Next, the real-time OS 112 requests the task switching means 103 to start task switching as shown in processing step 1102. The task switching means 103 acquires the task 1 having the highest priority from the task queue as shown in processing steps 201 and 204.

【0097】タスクスイッチング手段103は処理ステ
ップ202に示すように、ページテーブル書き換え手段
105に対して、ページテーブル109からタスク1の
スタックのページ情報2を取得するように要求する。
The task switching means 103 requests the page table rewriting means 105 to acquire the page information 2 of the stack of the task 1 from the page table 109, as shown in the processing step 202.

【0098】もし、タスクのスタックのページ情報が存
在しないならば、タスクスイッチング手段103はタス
クのスイッチングを行わず、処理をステップ212に戻
す。
If there is no page information of the task stack, the task switching means 103 does not perform task switching, and returns the processing to step 212.

【0099】ステップ202において、もし、タスクの
スタックのページ情報が存在するならば、タスクスイッ
チング手段103はページテーブル書き換え手段105
に対して、処理ステップ1103に示すようにページテ
ーブル109から現在実行中のタスクのページ情報を削
除する。
In step 202, if the page information of the task stack exists, the task switching means 103
, The page information of the currently executing task is deleted from the page table 109 as shown in processing step 1103.

【0100】タスクスイッチング手段はページ情報書き
換え手段105に対して、処理ステップ209に示すよ
うにタスク1のページ情報の保護情報を読み書き可能に
設定し、ページテーブル109に設定するように要求す
る。
The task switching means requests the page information rewriting means 105 to set the protection information of the page information of task 1 to be readable and writable as shown in processing step 209, and to set the protection information in the page table 109.

【0101】タスク切り替え手段103は処理ステップ
210に示すようにタスク1のTCB112から待避し
ていたスタックポインタ117、プログラムカウンタ1
18、汎用レジスタ119及びステータスレジスタ12
0をMPU101のスタックポインタ、プログラムカウ
ンタ、汎用レジスタ及びステータスレジスタに設定す
る。そして、処理ステップ211に示すように処理を返
す。
As shown in processing step 210, the task switching means 103 stores the stack pointer 117 saved from the TCB 112 of the task 1 and the program counter 1
18, general-purpose register 119 and status register 12
0 is set in the stack pointer, program counter, general-purpose register, and status register of the MPU 101. Then, the process returns as shown in processing step 211.

【0102】上述した本発明の第9の実施形態において
も、第2の実施形態と同様な効果を得ることができる。
In the ninth embodiment of the present invention described above, the same effects as in the second embodiment can be obtained.

【0103】図18は、本発明の第10の実施形態であ
るスタック保護装置の構成を示すブロック図である。こ
の図18の例においては、図1に示したスタック保護装
置のページ保護例外処理部123に代えてページ保護例
外処理部1201が配置され、リモートPC903が追
加されている。そして、ページ保護例外処理部1201
は、リモートPC903にエラー情報を待避させるエラ
ー出力手段901を含んで構成されている。このエラー
出力手段901は、ネットワーク通信手段902を備え
ている。
FIG. 18 is a block diagram showing a configuration of a stack protection device according to a tenth embodiment of the present invention. In the example of FIG. 18, a page protection exception processing unit 1201 is provided instead of the page protection exception processing unit 123 of the stack protection device shown in FIG. 1, and a remote PC 903 is added. Then, the page protection exception processing unit 1201
Is configured to include an error output unit 901 for saving the error information to the remote PC 903. The error output unit 901 includes a network communication unit 902.

【0104】図19は、現在実行中のタスクが他のタス
クのスタックにアクセスしたときにリモートPC 90
3にエラー情報を出力する動作を示す流れ図である。な
お、この図19は、図17のフローチャートのステップ
1701〜1703に代えてステップ1901〜190
3が加入されたものであり、他のステップは、図17の
ステップと同様となっている。
FIG. 19 shows the remote PC 90 when the currently executing task accesses the stack of another task.
3 is a flowchart showing an operation of outputting error information to the third embodiment. Note that FIG. 19 is different from Steps 1901 to 1903 in the flowchart of FIG.
3 has been added, and the other steps are the same as the steps in FIG.

【0105】次に、現在実行中のタスクが他のタスクの
スタックにアクセスしたためにページ保護例外が発生し
た時にリモートPC 903にエラー情報を送信する場
合の動作について、図18及び図19を参照して述べ
る。
Next, the operation when error information is transmitted to the remote PC 903 when the currently executing task accesses the stack of another task and a page protection exception occurs will be described with reference to FIGS. State.

【0106】ページ保護例外110が発生すると、MP
U101はページ保護例外処理部1201を起動する。
ページ保護例外処理部1201のエラー出力手段901
は、処理ステップ1901に示すようにネットワーク通
信手段902に対して、エラー情報を送信するためにネ
ットワークのコネクション接続をするように要求する。
When page protection exception 110 occurs, MP
U101 activates the page protection exception processing unit 1201.
Error output unit 901 of page protection exception processing unit 1201
Requests the network communication means 902 to establish a network connection in order to transmit error information, as shown in processing step 1901.

【0107】もし、リモートPC 903とのコネクシ
ョン接続に失敗したならば、処理ステップ201を実行
する。
If the connection with the remote PC 903 fails, the processing step 201 is executed.

【0108】ステップ1901において、もし、リモー
トPC903とのコネクション接続に成功したならば、
処理ステップ1902に示すようにリモートPC903
に対して、TCB113のタスク名称121、タスクI
D122及びエラーメッセージを送信する。
In step 1901, if the connection with the remote PC 903 is successful,
As shown in processing step 1902, the remote PC 903
For task name 121 of TCB 113, task I
D122 and an error message are transmitted.

【0109】そして、処理ステップ1903に示すよう
にリモートPC903とのコネクションを切断する。
Then, as shown in processing step 1903, the connection with the remote PC 903 is disconnected.

【0110】次に、ページ保護例外処理1201は処理
ステップ1101に示すように現在実行中のタスクを休
止状態にする。次に、リアルタイムOS111は処理ス
テップ1102に示すようにタスクスイッチング手段1
03に対して、タスクスイッチングを開始するように要
求する。タスクスイッチング手段103は、処理ステッ
プ201、204に示すように、タスクの待ち行列から
最も優先度の高いタスク1を取得する。
Next, the page protection exception processing 1201 puts the currently executing task into a sleep state as shown in processing step 1101. Next, as shown in processing step 1102, the real-time OS 111
03 to start task switching. The task switching means 103 acquires the task 1 having the highest priority from the task queue as shown in processing steps 201 and 204.

【0111】タスクスイッチング手段103は処理ステ
ップ202に示すようにページテーブル書き換え手段1
05に対して、ページテーブル109からタスクのスタ
ックのページ情報を取得するように要求する。
The task switching means 103 sets the page table rewriting means 1 as shown in processing step 202.
05 is requested to obtain page information of the task stack from the page table 109.

【0112】もし、タスク1のスタックのページ情報が
存在しないならば、タスクスイッチング手段103はタ
スクのスイッチングを行わず、処理をステップ212に
戻す。
If the page information of the stack of the task 1 does not exist, the task switching means 103 does not perform the task switching and returns the processing to step 212.

【0113】ステップ202において、もし、タスク1
のスタックのページ情報が存在するならば、タスクスイ
ッチング手段103はページテーブル書き換え手段10
5に対して、処理ステップ1103に示すようにページ
テーブル109から現在実行中のタスクのページ情報を
削除する。
In step 202, if task 1
If the page information of the stack exists, the task switching means 103
For 5, the page information of the currently executing task is deleted from the page table 109 as shown in processing step 1103.

【0114】タスクスイッチング手段103はページテ
ーブル書き換え手段105に対して、処理ステップ20
9に示すように、タスクのページ情報の保護情報を読み
書き可能に設定し、ページテーブル109に設定するよ
うに要求する。
The task switching means 103 sends the page table rewriting means 105 a
As shown in FIG. 9, the protection information of the page information of the task is set to be readable and writable, and is requested to be set in the page table 109.

【0115】タスク切り替え手段103は処理ステップ
210に示すようにタスク1のTCB113から待避し
ていたスタックポインタ117、プログラムカウンタ1
18、汎用レジスタ119及びステータスレジスタ12
0をMPU101のスタックポインタ、プログラムカウ
ンタ、汎用レジスタ及びステータスレジスタに設定す
る。
As shown in the processing step 210, the task switching means 103 stores the stack pointer 117 saved from the TCB 113 of the task 1 and the program counter 1
18, general-purpose register 119 and status register 12
0 is set in the stack pointer, program counter, general-purpose register, and status register of the MPU 101.

【0116】そして、処理ステップ211に示すように
処理を返す。
Then, the processing is returned as shown in processing step 211.

【0117】上述した本発明の第10の実施形態におい
ても、第2の実施形態と同様な効果を得ることができ
る。
In the tenth embodiment of the present invention described above, the same effects as in the second embodiment can be obtained.

【0118】なお、上述した本発明の実施形態において
は、現在実行中のタスクが他のスタックにアクセスした
ときに、ページ保護例外処理が発生される場合につい
て、主に説明したが、メモリ管理機構102は、現在実
行中のタスクの要求により、ページフォルト例外処理を
発生し、ページテーブル109にページフォルト例外処
理を発生させたアドレスのページ情報が存在しない場合
には、オペレーティングシステム111が、現在実行中
のタスクを休止状態として、タスクの暴走を防止するこ
ともできる。
In the above-described embodiment of the present invention, a case where page protection exception processing is generated when a currently executing task accesses another stack has been mainly described. Reference numeral 102 denotes a page fault exception handling in response to a request of the currently executing task. If there is no page information of the address that caused the page fault exception handling in the page table 109, the operating system 111 executes the currently executed task. The running task can be put into a sleep state to prevent runaway of the task.

【0119】[0119]

【発明の効果】本発明は、以上説明したように構成され
ているため、次のような効果を有する。タスクの暴走に
よるシステムダウンを効果的に防止することができるス
タック保護装置を実現することができる。
Since the present invention is configured as described above, it has the following effects. A stack protection device that can effectively prevent the system from going down due to a runaway task can be realized.

【0120】さらに、タスクの暴走によるシステムダウ
ンを効果的に防止することができるとともに、不当なメ
モリアクセスの発生を容易に検出可能であるスタック保
護装置を実現することができる。
Furthermore, it is possible to realize a stack protection device that can effectively prevent the system from going down due to a runaway task and can easily detect the occurrence of an illegal memory access.

【0121】(1)つまり、現在実行中のタスクが他の
タスクのスタックに書き込むを行おうとしたならば、M
MUにより例外処理が起動され、現在実行中のタスクを
休止状態にすることにより他のタスクのスタックのデー
タを書き換えるようなことを行わないため、他のタスク
のプログラムのバグによるスタックの書き換えによるタ
スクの暴走やシステムダウンを防止する効果がある。
(1) That is, if the currently executing task attempts to write to the stack of another task, M
An exception process is started by the MU, and the task currently being executed is put into a sleep state so that the data of the stack of another task is not rewritten. This has the effect of preventing runaway and system down.

【0122】(2)また、現在実行中のタスクが他のタ
スクのスタックに書き込むを行おうとしたならば、エラ
ー情報を外部出力装置に表示したり、外部記憶装置に格
納することにより、不具合の調査を容易にするため、シ
ステムのMTTR(mean time to repair)時間を削減
することができるという効果がある。
(2) If the currently executing task attempts to write to the stack of another task, error information is displayed on an external output device or stored in an external storage device, thereby causing a problem. In order to facilitate the investigation, there is an effect that the mean time to repair (MTTR) time of the system can be reduced.

【図面の簡単な説明】[Brief description of the drawings]

【図1】本発明の第1の実施形態に係るスタック保護装
置のシステム構成を示すブロック図である。
FIG. 1 is a block diagram illustrating a system configuration of a stack protection device according to a first embodiment of the present invention.

【図2】第1の実施形態のスタック保護装置において、
タスクスイッチング時にMMUのページテーブルを書き
換える場合の動作を示す流れ図である。
FIG. 2 shows a stack protection device according to a first embodiment.
9 is a flowchart showing an operation when rewriting the page table of the MMU at the time of task switching.

【図3】本発明の第2の実施形態に係るスタック保護装
置のシステム構成を示すブロック図である。
FIG. 3 is a block diagram illustrating a system configuration of a stack protection device according to a second embodiment of the present invention.

【図4】第2の実施形態のスタック保護装置において、
タスクスイッチング時にMPUを割り当てる待ち行列の
最も優先度の高いタスクのページ情報が存在しない場合
の端末へのエラー情報を出力する場合の動作を示す流れ
図である。
FIG. 4 shows a stack protection device according to a second embodiment.
9 is a flowchart illustrating an operation of outputting error information to a terminal when there is no page information of a task with the highest priority in a queue to which an MPU is assigned at the time of task switching.

【図5】本発明の第3の実施形態に係るスタック保護装
置のシステム構成を示すブロック図である。
FIG. 5 is a block diagram showing a system configuration of a stack protection device according to a third embodiment of the present invention.

【図6】第3の実施形態のスタック保護装置において、
タスクスイッチング時にMPUを割り当てる待ち行列の
最も優先度の高いタスクのページ情報が存在しない場合
の不揮発性メモリへエラー情報を待避する場合の動作を
示す流れ図である。
FIG. 6 shows a stack protection device according to a third embodiment.
11 is a flowchart showing an operation of saving error information to a nonvolatile memory when page information of a task with the highest priority in a queue to which an MPU is assigned at the time of task switching does not exist.

【図7】本発明の第4の実施形態に係るスタック保護装
置のシステム構成を示すブロック図である。
FIG. 7 is a block diagram showing a system configuration of a stack protection device according to a fourth embodiment of the present invention.

【図8】第4の実施形態のスタック保護装置において、
タスクスイッチング時にMPUを割り当てる待ち行列の
最も優先度の高いタスクのページ情報が存在しない場合
のH/Dへエラー情報を格納する場合の動作を示す流れ
図である。
FIG. 8 shows a stack protection device according to a fourth embodiment.
11 is a flowchart showing an operation when error information is stored in the H / D when page information of a task with the highest priority in a queue to which an MPU is assigned at the time of task switching does not exist.

【図9】本発明の第5の実施形態に係るスタック保護装
置のシステム構成を示すブロック図である。
FIG. 9 is a block diagram illustrating a system configuration of a stack protection device according to a fifth embodiment of the present invention.

【図10】第5の実施形態のスタック保護装置におい
て、タスクスイッチング時にMPUを割り当てる待ち行
列の最も優先度の高いタスクのページ情報が存在しない
場合のネットワークで接続されたリモートPCへのエラ
ー情報を送信する場合の動作を示す流れ図である。
FIG. 10 is a diagram illustrating a stack protection apparatus according to a fifth embodiment in which error information to a remote PC connected via a network when page information of a task with the highest priority in a queue to which an MPU is assigned at the time of task switching does not exist; 5 is a flowchart illustrating an operation when transmitting.

【図11】本発明の第6の実施形態のスタック保護装置
において、現在実行中のタスクが他のタスクのスタック
へアクセスしたときのページ保護例外処理が実行される
時の動作を示す流れ図である。
FIG. 11 is a flowchart showing an operation when page protection exception processing is executed when a currently executing task accesses a stack of another task in the stack protection apparatus according to the sixth embodiment of the present invention. .

【図12】本発明の第7の実施形態に係るスタック保護
装置のシステム構成を示すブロック図である。
FIG. 12 is a block diagram illustrating a system configuration of a stack protection device according to a seventh embodiment of the present invention.

【図13】第7の実施形態のスタック保護装置におい
て、現在実行中のタスクが他のタスクのスタックへアク
セスしたときに端末へエラー情報を出力する時の動作を
示す流れ図である。
FIG. 13 is a flowchart illustrating an operation of outputting error information to a terminal when a currently executing task accesses a stack of another task in the stack protection apparatus of the seventh embodiment.

【図14】本発明の第8の実施形態に係るスタック保護
装置のシステム構成を示すブロック図である。
FIG. 14 is a block diagram showing a system configuration of a stack protection device according to an eighth embodiment of the present invention.

【図15】第8の実施形態のスタック保護装置におい
て、現在実行中のタスクが他のタスクのスタックへアク
セスしたときに不揮発性メモリへエラー情報を待避する
時の動作を示す流れ図である。
FIG. 15 is a flowchart illustrating an operation of saving error information in a nonvolatile memory when a currently executing task accesses a stack of another task in the stack protection apparatus according to the eighth embodiment;

【図16】本発明の第9の実施形態に係るスタック保護
装置のシステム構成を示すブロック図である。
FIG. 16 is a block diagram showing a system configuration of a stack protection device according to a ninth embodiment of the present invention.

【図17】第9の実施形態のスタック保護装置におい
て、現在実行中のタスクが他のタスクのスタックへアク
セスしたときにH/Dへエラー情報を格納する時の動作
を示す流れ図である。
FIG. 17 is a flowchart illustrating an operation of storing error information in the H / D when a currently executing task accesses a stack of another task in the stack protection apparatus according to the ninth embodiment;

【図18】本発明の第10の実施形態に係るスタック保
護装置のシステム構成を示すブロック図である。
FIG. 18 is a block diagram illustrating a system configuration of a stack protection device according to a tenth embodiment of the present invention.

【図19】第10の実施形態のスタック保護装置におい
て、現在実行中のタスクが他のタスクのスタックへアク
セスしたときにネットワークで接続されているリモート
PCへエラー情報を送信する時の動作を示す流れ図であ
る。
FIG. 19 shows an operation of transmitting error information to a remote PC connected via a network when a currently executing task accesses a stack of another task in the stack protection apparatus of the tenth embodiment. It is a flowchart.

【符号の説明】[Explanation of symbols]

101 MPU 102 MMU 103 タスクスイッチング手段 104 主記憶メモリ 105 ページ情報書き換え手段 106 システムのテキストセグメント 107 システムのデータセグメント 108 タスクのスタック 109 ページテーブル 110 ページ保護例外処理 111 リアルタイムOS 112 タスク管理手段 113 TCB 114 スタック開始アドレス 115 スタックサイズ 116 ページ情報 117 スタックポインタ 118 プログラムカウンタ 119 汎用レジスタ 120 ステータスレジスタ 121 タスク名称 122 タスクID 123、1201 ページ保護例外処理部 124 タスク切り替え手段 301 エラー出力手段 302 端末 501、701 エラー待避手段 502 不揮発性メモリ 702 ファイルシステム 703 H/D 901 エラー出力手段 902 ネットワーク通信手段 903 リモートPC Reference Signs List 101 MPU 102 MMU 103 Task switching means 104 Main storage memory 105 Page information rewriting means 106 System text segment 107 System data segment 108 Task stack 109 Page table 110 Page protection exception handling 111 Real-time OS 112 Task management means 113 TCB 114 Stack Start address 115 Stack size 116 Page information 117 Stack pointer 118 Program counter 119 General-purpose register 120 Status register 121 Task name 122 Task ID 123, 1201 Page protection exception processing unit 124 Task switching unit 301 Error output unit 302 Terminal 501, 701 Error saving unit 502 Non-volatile memory 702 File system 7 03 H / D 901 Error output means 902 Network communication means 903 Remote PC

Claims (7)

【特許請求の範囲】[Claims] 【請求項1】タスクのスタック空間以外はタスク毎にア
ドレス空間を保持せず、タスクがプログラム空間、デー
タ空間を共有して実行するオペレーティングシステム
と、メモリ管理機構とを有するリアルタイム制御用マイ
コンシステムのスタック保護装置において、 上記メモリ管理機構によって使用され、各メモリブロッ
クの保護情報を保持しているページ情報から構成される
ページテーブルと、 指定されたメモリブロックのページ情報を検索し、検索
したページ情報に対して適切な保護情報を設定し、ペー
ジテーブルを更新するページテーブル書き換え手段と、 タスクの切り替えを行うときに、上記ページテーブル書
き換え手段に対して、現在実行中であるタスクのスタッ
クのブロック情報を与え、現在実行中のタスクのスタッ
クへの書き込み禁止の保護情報を設定させるとともに、
新しく実行させるタスクのスタックのブロック情報を与
え、上記新しく実行させるタスクのスタックの保護情報
に対して読み書き可能の保護情報を設定させるタスクス
イッチング手段と、を備えることを特徴とするスタック
保護装置。
1. A microcomputer system for real-time control having an operating system in which a task does not hold an address space for each task other than a stack space of the task, the task shares and executes a program space and a data space, and a memory management mechanism. In the stack protection device, a page table which is used by the memory management mechanism and includes page information holding protection information of each memory block, and page information of a specified memory block are searched. A page table rewriting means for setting appropriate protection information for the page table and updating the page table; and when switching the task, the page table rewriting means informs the page table rewriting means of block information of the stack of the task currently being executed. And write to the stack of the currently running task With to set the protection information of the write prohibition,
A stack protection device, comprising: task switching means for providing block information of a stack of a task to be newly executed and setting read / write protection information to the protection information of the stack of the task to be newly executed.
【請求項2】請求項1記載のスタック保護装置におい
て、上記メモリ管理機構は、現在実行中のタスクの要求
により、ページフォルト例外処理を発生し、上記ページ
テーブルにページフォルト例外処理を発生させたアドレ
スのページ情報が存在しない場合には、上記オペレーテ
ィングシステムは、現在実行中のタスクを休止状態とす
ることを特徴とするスタック保護装置。
2. The stack protection device according to claim 1, wherein the memory management mechanism generates a page fault exception process in response to a request of a task currently being executed, and generates a page fault exception process in the page table. The stack protection device, wherein when there is no page information of the address, the operating system puts a currently executing task into a sleep state.
【請求項3】請求項1記載のスタック保護装置におい
て、上記メモリ管理機構は、現在実行中のタスクの要求
により、ページフォルト例外処理を発生し、上記ページ
テーブルにページフォルト例外処理を発生させたアドレ
スのページ情報が存在しない場合には、エラー情報を出
力するエラー出力手段を備えることを特徴とするスタッ
ク保護装置。
3. The stack protection device according to claim 1, wherein said memory management mechanism generates a page fault exception process in response to a request of a currently executing task, and generates a page fault exception process in said page table. A stack protection device comprising: an error output unit that outputs error information when there is no page information of an address.
【請求項4】請求項1記載のスタック保護装置におい
て、上記メモリ管理機構は、現在実行中のタスクの要求
により、ページフォルト例外処理を発生し、上記ページ
テーブルにページフォルト例外処理を発生させたアドレ
スのページ情報が存在しない場合には、エラー情報を待
避させるエラー待避手段を備えることを特徴とするスタ
ック保護装置。
4. The stack protection device according to claim 1, wherein said memory management mechanism generates a page fault exception process in response to a request of a currently executing task, and generates a page fault exception process in said page table. A stack protection device comprising: an error saving unit that saves error information when page information of an address does not exist.
【請求項5】請求項1記載のスタック保護装置におい
て、現在実行中のタスクが他のタスクのスタックにアク
セスした場合には、上記メモリ管理機構は、ページ保護
例外処理を発生し、このページ保護例外処理が発生され
たときには、上記オペレーティングシステムは、現在実
行中のタスクを休止状態とすることを特徴とするスタッ
ク保護装置。
5. The stack protection device according to claim 1, wherein when a currently executing task accesses a stack of another task, the memory management mechanism generates a page protection exception process, and the page protection exception processing is performed. The stack protection device, wherein when the exception processing occurs, the operating system puts a currently executing task into a sleep state.
【請求項6】請求項1記載のスタック保護装置におい
て、現在実行中のタスクが他のタスクのスタックにアク
セスした場合には、上記メモリ管理機構は、ページ保護
例外処理を発生し、このページ保護例外処理が発生され
たときには、エラー情報を出力するエラー出力手段を備
えることを特徴とするスタック保護装置。
6. The stack protection device according to claim 1, wherein when the currently executing task accesses a stack of another task, the memory management mechanism generates a page protection exception process, and the page protection exception processing is performed. A stack protection device comprising: an error output unit that outputs error information when exception processing occurs.
【請求項7】請求項1記載のスタック保護装置におい
て、現在実行中のタスクが他のタスクのスタックにアク
セスした場合には、上記メモリ管理機構は、ページ保護
例外処理を発生し、このページ保護例外処理が発生され
たときには、エラー情報を待避させるエラー待避手段を
備えることを特徴とするスタック保護装置。
7. The stack protection device according to claim 1, wherein when the currently executing task accesses the stack of another task, the memory management mechanism generates a page protection exception process, and the page protection exception processing is performed. A stack protection device comprising an error saving means for saving error information when exception processing occurs.
JP9297218A 1997-10-29 1997-10-29 Stack protecting device Pending JPH11134204A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP9297218A JPH11134204A (en) 1997-10-29 1997-10-29 Stack protecting device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP9297218A JPH11134204A (en) 1997-10-29 1997-10-29 Stack protecting device

Publications (1)

Publication Number Publication Date
JPH11134204A true JPH11134204A (en) 1999-05-21

Family

ID=17843711

Family Applications (1)

Application Number Title Priority Date Filing Date
JP9297218A Pending JPH11134204A (en) 1997-10-29 1997-10-29 Stack protecting device

Country Status (1)

Country Link
JP (1) JPH11134204A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100393985B1 (en) * 1999-12-22 2003-08-06 엘지전자 주식회사 Memory protecting device and method
GB2423843A (en) * 2005-03-02 2006-09-06 Symbian Software Ltd Providing real time performance with memory paging by providing a real time and a non-real time version of the operating system.
GB2434462A (en) * 2005-03-02 2007-07-25 Symbian Software Ltd Providing real time performance with memory paging by identifying all the process and references of a thread, then locking the identified memory
JP2010134748A (en) * 2008-12-05 2010-06-17 Fuji Xerox Co Ltd Image processing apparatus
JP2010134747A (en) * 2008-12-05 2010-06-17 Fuji Xerox Co Ltd Image processing apparatus
CN111538574A (en) * 2020-03-27 2020-08-14 北京达佳互联信息技术有限公司 Task stack management method, device, terminal and storage medium

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100393985B1 (en) * 1999-12-22 2003-08-06 엘지전자 주식회사 Memory protecting device and method
GB2423843A (en) * 2005-03-02 2006-09-06 Symbian Software Ltd Providing real time performance with memory paging by providing a real time and a non-real time version of the operating system.
GB2434462A (en) * 2005-03-02 2007-07-25 Symbian Software Ltd Providing real time performance with memory paging by identifying all the process and references of a thread, then locking the identified memory
GB2423843B (en) * 2005-03-02 2009-04-22 Symbian Software Ltd Dual mode operating system for a computing device
US8135938B2 (en) 2005-03-02 2012-03-13 Nokia Corporation Real time paged computing device and method of operation
US8332856B2 (en) 2005-03-02 2012-12-11 Nokia Corporation Dual mode operating system for a computing device
JP2010134748A (en) * 2008-12-05 2010-06-17 Fuji Xerox Co Ltd Image processing apparatus
JP2010134747A (en) * 2008-12-05 2010-06-17 Fuji Xerox Co Ltd Image processing apparatus
CN111538574A (en) * 2020-03-27 2020-08-14 北京达佳互联信息技术有限公司 Task stack management method, device, terminal and storage medium
CN111538574B (en) * 2020-03-27 2024-03-12 北京达佳互联信息技术有限公司 Task stack management method, device, terminal and storage medium

Similar Documents

Publication Publication Date Title
JP4519738B2 (en) Memory access control device
CN102150105B (en) Deployment and management of virtual containers
US7765395B2 (en) Operating system rebooting method and apparatus for continuing to execute a non-stop module even during rebooting
JP4759059B2 (en) Page coloring that maps memory pages to programs
US7953948B1 (en) System and method for data protection on a storage medium
US6698016B1 (en) Method for injecting code into another process
US5832513A (en) Detecting significant file system alterations during execution of a storage media software utility
US8768896B2 (en) Setting information database management
JPH0619798A (en) Method and system for avoidance of loading of value of selector
US7308547B2 (en) Apparatus and method for control of write filter
US20050044292A1 (en) Method and apparatus to retain system control when a buffer overflow attack occurs
JP5131563B2 (en) Computer, operation rule application method, operating system
JP3882321B2 (en) Computer with operating system module program
KR100494499B1 (en) Data retouching method for executing file on real time and virus elimination method using the data retouching method thereof
JP2005316599A (en) Interrupt controller
US20140025903A1 (en) Multi-core processor system
JP2005122334A (en) Memory dump method, memory dumping program and virtual computer system
JPH11134204A (en) Stack protecting device
US20050138263A1 (en) Method and apparatus to retain system control when a buffer overflow attack occurs
US7363288B2 (en) Method of checkpointing and restarting processes which share open file
CN115495278A (en) Exception repair method, device and storage medium
JP2004326331A (en) Unauthorized memory access detection method and program of the same
US20050027954A1 (en) Method and apparatus to support the maintenance and reduction of FLASH utilization as it pertains to unused or infrequently referenced FLASH data
JP4423849B2 (en) Data protection system, data protection program, and data protection method
US20240134720A1 (en) Apparatus, and method