JP3184380B2 - Interrupt control method and multitask system for implementing the same - Google Patents

Interrupt control method and multitask system for implementing the same

Info

Publication number
JP3184380B2
JP3184380B2 JP28109193A JP28109193A JP3184380B2 JP 3184380 B2 JP3184380 B2 JP 3184380B2 JP 28109193 A JP28109193 A JP 28109193A JP 28109193 A JP28109193 A JP 28109193A JP 3184380 B2 JP3184380 B2 JP 3184380B2
Authority
JP
Japan
Prior art keywords
interrupt
processing
stack
address
interrupt 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.)
Expired - Fee Related
Application number
JP28109193A
Other languages
Japanese (ja)
Other versions
JPH07134656A (en
Inventor
一成 菊地
洋一 岩渕
浩康 渡辺
潤二 山田
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.)
Canon Inc
Original Assignee
Canon Inc
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 Canon Inc filed Critical Canon Inc
Priority to JP28109193A priority Critical patent/JP3184380B2/en
Publication of JPH07134656A publication Critical patent/JPH07134656A/en
Application granted granted Critical
Publication of JP3184380B2 publication Critical patent/JP3184380B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Description

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

【0001】[0001]

【産業上の利用分野】本発明は、リアルタイム処理が要
求されるマルチタスクシステムの割り込み制御方法それ
を実現するマルチタスクシステムに関するものである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an interrupt control method for a multitask system requiring real-time processing, and to a multitask system for realizing the method.

【0002】[0002]

【従来の技術】リアルタイム処理が要求されるコンピュ
ータシステムにおいては、外界の処理(以下、外部処
理)と同期しながら、プログラムの実行(以下、内部処
理)を行う必要がある。このため、外部処理において許
容されている時間内に、これに対応した内部処理を完了
させなければならない。この時間的要件を満足させるた
めには、外部処理が、現在実行されている内部処理より
も時間的要求の厳しい新な内部処理の実行を要求した時
に、現在の内部処理を一旦中断して新に要求された内部
処理を先行して行わなければならない。
2. Description of the Related Art In a computer system that requires real-time processing, it is necessary to execute a program (hereinafter, internal processing) in synchronization with external processing (hereinafter, external processing). Therefore, the corresponding internal processing must be completed within the time allowed in the external processing. In order to satisfy this time requirement, when an external process requests execution of a new internal process whose time requirement is stricter than the currently executed internal process, the current internal process is temporarily interrupted and the new process is interrupted. Must be performed in advance.

【0003】従って、このようなリアルタイム処理をコ
ンピュータで可能とするためには、外部処理からのコン
ピュータに対する内部処理の実行要求を伝達するため
に、コンピュータの割り込み処理機構を用いる。また、
時間的要件の厳しい内部処理を優先して行うための方法
として、必要な内部処理をタスクとしてプログラムして
その各タスク毎に優先度を設け、優先度の高いタスク順
にコンピュータのCPU資源を割り当てるプリエンプテ
ィブな優先度スケジューリングの手法に基づいて、タス
クスイッチを行うマルチタスク制御プログラムを利用し
ている。
Therefore, in order to enable such real-time processing by a computer, an interrupt processing mechanism of the computer is used to transmit a request for execution of internal processing from the external processing to the computer. Also,
As a method for giving priority to internal processing with strict time requirements, a preemptive method in which necessary internal processing is programmed as a task, and a priority is set for each task, and the CPU resources of the computer are allocated in the order of tasks having higher priority. A multitask control program that performs task switching is used based on a method of priority scheduling.

【0004】マルチタスク制御プログラムにおいては、
タスクの生成,中断,再開,終了や優先度変更などとい
った各種の機能は、通常サブルーチンコールやソフトウ
ェア割り込みの形式(以下、システムコール)で提供さ
れている。タスクや割り込み処理内でこれらを呼ぶこと
によって、各機能が実行される。通常、タスクからシス
テムコールが実行され、その結果他タスクへのタスクス
イッチが必要となった場合は、そのシステムコール実行
の終了段階でタスクスイッチ処理が実行される。
In a multitask control program,
Various functions such as task generation, suspension, resumption, termination, and priority change are usually provided in the form of subroutine calls or software interrupts (hereinafter, system calls). Each function is executed by calling them in a task or interrupt processing. Usually, when a system call is executed from a task, and as a result, a task switch to another task is required, a task switch process is executed at the end stage of the execution of the system call.

【0005】しかし、タスクと同様に割り込み処理中の
システムコールでタスクスイッチ処理を行なった場合
は、再度のタスクスイッチの発生によってこの割り込み
処理に戻ってくるまで、この割り込み処理の残りの部分
の実行が待たされることになったり、また最悪の場合は
これ以降この割り込み処理へ戻るタスクスイッチが発生
せず、割り込み処理の実行が継続されない可能性もあ
る。さらに、この割り込み処理が終了しない間は、この
割り込み要求レベルと同等かそれより低いレベルの割り
込みをコンピュータが受け付けなくなってしまい、外部
処理からの他の要求を取りこぼしてしまう可能性もあ
る。
However, when the task switch processing is performed by the system call during the interrupt processing as in the case of the task, the remaining part of the interrupt processing is executed until the processing returns to the interrupt processing by the occurrence of the task switch again. In the worst case, there is a possibility that a task switch to return to the interrupt processing will not occur and the execution of the interrupt processing will not be continued. Further, while the interrupt processing is not completed, the computer may not accept an interrupt having a level equal to or lower than the interrupt request level, and may miss another request from the external processing.

【0006】このような問題を避けるため、従来のリア
ルタイム処理が必要なマルチタスクシステムにおいて、
割り込み処理中にシステムコールが実行された場合に
は、その時点でタスクスイッチの必要性があっても行わ
ず、この割り込み処理の最後で呼ばれるタスクスイッチ
処理のためのシステムコールの実行時点まで、タスクス
イッチが禁止されるようになっている。
In order to avoid such a problem, in a conventional multitask system requiring real-time processing,
If a system call is executed during interrupt processing, the task switch is not performed even if the task switch is necessary at that point in time, and the task switch is executed until the system call for task switch processing called at the end of this interrupt processing is executed. The switch is forbidden.

【0007】図3に、リアルタイム処理が要求されるマ
ルチタスクシステムの多重割り込みのタイムチャートを
示す。図のように割り込み処理途上で、更に高いレベル
の割り込みが発生する多重割り込みの場合には、高レベ
ルの割り込み処理を完了させた後、タスクへ戻る最も低
レベル割り込み処理の最後で、タスクスイッチのための
システムコールによってタスクスイッチが実行される必
要がある。このように、割り込み処理内でシステムコー
ルを実行するプログラムは、その終了時に必ずマルチタ
スク制御プログラムに制御を戻し、タスクスイッチを行
う特殊な手続きが不可欠となっている。
FIG. 3 shows a time chart of multiple interrupts in a multitask system requiring real-time processing. As shown in the figure, in the case of multiple interrupts in which a higher-level interrupt occurs during the interrupt processing, the task switch is completed at the end of the lowest-level interrupt processing after returning to the task after completing the high-level interrupt processing. The task switch needs to be executed by the system call for. As described above, a program that executes a system call in interrupt processing always returns control to the multitask control program at the time of termination, and a special procedure for performing a task switch is indispensable.

【0008】[0008]

【発明が解決しようとする課題】しかしながら、リアル
タイム処理が要求されるマルチタスクシステムでは、上
述のように割り込み処理の最後でタスクスイッチのため
の特殊な手続きが必要とされていたので、図2のように
処理の最後が割り込みリターン命令で書かれている一般
的な形式の割り込み処理を用いて、割り込み制御が出来
ないという問題があった。
However, in a multitask system requiring real-time processing, a special procedure for task switching is required at the end of interrupt processing as described above. As described above, there is a problem that interrupt control cannot be performed using a general type of interrupt processing in which the end of the processing is written by an interrupt return instruction.

【0009】本発明は、前記従来の欠点を除去し、リア
ルタイム処理が要求されるマルチタスクシステムにおい
て、割り込み処理の最後でタスクスイッチのための特殊
な手続きを必要とすることなく、割り込み処理の最後が
割り込みリターン命令で書かれている割り込み処理で、
リアルタイム処理向けマルチタスクシステムの割り込み
制御が可能な割り込み制御方法それを実現するマルチタ
スクシステムを提供する。
SUMMARY OF THE INVENTION The present invention eliminates the above-mentioned drawbacks and provides a multi-task system requiring real-time processing without requiring a special procedure for task switching at the end of interrupt processing. Is the interrupt processing written by the interrupt return instruction,
An interrupt control method capable of controlling an interrupt of a multi-task system for real-time processing is provided.

【0010】[0010]

【課題を解決するための手段】この課題を解決するため
に、本発明の割り込み制御方法は、リアルタイム処理が
要求されるマルチタスクシステムにおける割り込み制御
方法であって、割り込みの要求に応じて現在の実行アド
レスをスタックに保存し、前記割り込みが多重割り込み
か否かを確認し、前記割り込みが多重割り込みでない場
合に、タスクスイッチ処理の先頭アドレスを前記スタッ
クにおいて前記実行アドレスの上位に保存し、前記割り
込みの終了後に、当該割り込みが多重割り込みか否かに
よらず、割り込み処理のリターン命令により、前記スタ
ックの最上位に保存されたアドレスに制御を移すことを
特徴とする。
In order to solve this problem, an interrupt control method according to the present invention is an interrupt control method in a multitask system that requires real-time processing . Execution ad
The interrupt is saved on the stack, and whether the interrupt is a multiple interrupt is determined. If the interrupt is not a multiple interrupt, the start address of the task switch process is set to the stack.
In the upper part of the execution address in the
After completion of the interrupt, whether the interrupt is a multiple interrupt
Regardless, the start instruction is returned by an interrupt processing return instruction.
The method is characterized in that control is transferred to the address stored at the top of the block .

【0011】ここで、前記割り込みが多重割り込みか否
かの確認は、割り込み処理中フラグを参照して行ない、
当該割り込み処理中フラグは、前記割り込みが多重割り
込みでない場合にセットされ、前記タスクスイッチ処理
においてリセットされる。また、前記タスクスイッチ処
理の先頭アドレスの保存は、前記割り込みの実行に先立
ち実行される。
Here, whether or not the interrupt is a multiple interrupt
Check whether the interrupt is being processed by referring to the flag.
The interrupt processing flag indicates that the interrupt is
Set when the task switch processing is not
Is reset at In addition, the task switch processing
The storage of the logical start address is executed prior to the execution of the interrupt .

【0012】また、本発明のマルチタスクシステムは、
リアルタイム処理が要求されるマルチタスクシステムに
おいて、データを後入れ先出しで記憶するスタックと、
割り込みの要求に応じて現在の実行アドレスを前記スタ
ックに保存する第1の保存手段と、前記割り込みが多重
割り込みか否かを確認する確認手段と、前記割り込みが
多重割り込みでない場合に、タスクスイッチ処理の先頭
アドレスを前記スタックにおいて前記実行アドレスの上
位に保存する第2の保存手段と、前記割り込みの終了後
に、当該割り込みが多重割り込みか否かによらず、割り
込み処理のリターン命令により、前記スタックの最上位
に保存されたアドレスに制御を移す制御手段とを備える
ことを特徴とする。
Further, the multitask system according to the present invention comprises:
In a multitasking system that requires real-time processing , a stack that stores data in a last-in first-out manner,
In response to an interrupt request, the current execution address is
A first storing means for storing a click, a confirmation means for the interrupt to check whether multiple interrupts or, if the interrupt is not <br/> multiple interrupts, the first task switch process
Address on the stack above the execution address
Second storage means for storing in the second place, after completion of the interrupt
Regardless of whether the interrupt is a multiple interrupt or not.
The top of the stack is
And control means for transferring control to the address stored in the storage device .

【0013】ここで、前記確認手段は、割り込み処理中
フラグを参照して行ない、当該割り込み処理中フラグ
は、前記割り込みが多重割り込みでない場合にセットさ
れ、前記タスクスイッチ処理においてリセットされる。
また、前記第2の保存手段は、前記割り込みの実行に先
立って前記タスクスイッチ処理の先頭アドレスを保存す
る。
[0013] Here, the confirmation means is in the process of interrupt processing.
Refer to the flag and execute the interrupt processing flag
Is set if the interrupt is not a multiple interrupt.
Reset in the task switch process.
Further, the second storage means may execute the interrupt before executing the interrupt.
Stand up and save the start address of the task switch process
You.

【0014】[0014]

【実施例】【Example】

(実施例1)以下、本発明の割り込み制御方法の一実施
例を、図1の割り込み前処理のフローチャートと、図7
のシステム構成図にしたがって詳細に説明する。
(Embodiment 1) An embodiment of an interrupt control method according to the present invention will now be described with reference to the flowchart of FIG.
This will be described in detail according to the system configuration diagram of FIG.

【0015】図7のシステム構成図のコンピュータは、
割り込み要求信号線73から割り込みを受け付けると、
通常処理を中断し再開に必要な現在の実行アドレスと状
態レジスタ値とをスタック領域(以下スタック)723
へ保存し、IOからバス74を通して入力した割り込み
ベクタ番号(以下ベクタ番号)をキーとしてメモリ内の
特定領域に存在する割り込みベクタ表721(以下ベク
タ表)を参照し、ベクタ番号に対応した割り込み処理の
先頭アドレス(図7では、割り込み前処理の先頭アドレ
ス)を獲得した後、このアドレスへ実行を移す、といっ
た順で割り込み処理へ移行する。このため、ベクタ表7
21には、プログラムの実行以前にそのハードウェアの
要件に従った形式で、各ベクタ番号に対応した割り込み
処理の先頭アドレスが登録されている。ここでは、割り
込み処理の実行に先立って割り込み前処理を実行するの
で、予め割り込み前処理の先頭アドレスをベクタ表72
1へ登録する。
The computer of the system configuration diagram of FIG.
When an interrupt is received from the interrupt request signal line 73,
The current execution address and the status register value necessary for suspending and resuming normal processing are stored in a stack area (hereinafter referred to as a stack) 723.
The interrupt vector corresponding to the vector number is referred to by referring to an interrupt vector table 721 (hereinafter referred to as a vector table) existing in a specific area in the memory using an interrupt vector number (hereinafter referred to as a vector number) input from the IO through the bus 74 as a key. After the start address (in FIG. 7, the start address of the pre-interrupt processing) is obtained, the execution is shifted to this address, and so on. Therefore, the vector table 7
21 is registered with the start address of the interrupt process corresponding to each vector number in a format according to the hardware requirements before the execution of the program. Here, since the pre-interrupt processing is executed prior to the execution of the interrupt processing, the head address of the pre-interrupt processing is set in the vector table 72 in advance.
Register to 1.

【0016】さて、割り込みが発生すると、上記の手順
によって図1に示された割り込み前処理へ実行が移る。
この段階では、コンピュータが通常ワークスペースとし
て使用する図7の先入れ後だしメモリ領域であるスタッ
ク723に、割り込み処理が完了した後に割り込みリタ
ーン命令で割り込み以前のプログラムへ復帰するのに最
低限必要な、割り込み前のプログラムカウンタ(以下P
C)712の値である実行アドレスと状態レジスタ71
4の値とが保存されている。図6に実行中のスタックの
様子が示されている。この段階では図6のa点までスタ
ックが使用されている。コンピュータ71(CPU)
は、スタックの使用済領域を管理するため、図7のスタ
ックポインタ(以下SP)713を有しており、この段
階のSPは点aのアドレスを指示している。
When an interrupt occurs, execution proceeds to the pre-interrupt processing shown in FIG. 1 according to the above procedure.
At this stage, the stack 723, which is a first-in-first-out memory area of FIG. 7, which is normally used by the computer as a work space, has at least the minimum necessary for returning to the program before the interrupt by the interrupt return instruction after the interrupt processing is completed. , The program counter before interruption (hereinafter P
C) Execution address which is the value of 712 and status register 71
4 are stored. FIG. 6 shows the state of the stack being executed. At this stage, the stack is used up to the point a in FIG. Computer 71 (CPU)
Has a stack pointer (hereinafter referred to as SP) 713 in FIG. 7 in order to manage the used area of the stack, and the SP at this stage indicates the address of the point a.

【0017】割り込み前処理では、まず以下に説明する
実行すべき割り込み処理の決定S1を実行する(図1参
照)。この処理は以下の手順で行われる。
In the pre-interrupt processing, first, a determination S1 of an interrupt processing to be executed as described below is executed (see FIG. 1). This process is performed in the following procedure.

【0018】(割り込み処理の決定S1)割り込み前処
理で必要なワークスペースを確保するため、スタック7
23内のフレームの作成手続きS11を行う。この処理
の結果としては、図6のスタック723上のa点からb
点までがフレーム61として確保される。フレーム確保
により、SP713はフレームの上端であるb点へ移動
する。また、SP713と同ようにフレーム内の使用済
領域を管理するためフレームポインタ(以下FP)62
を作成する。まず、FP62として使用されるレジスタ
711の現在の値を保存するため、b点より上の保存レ
ジスタ値領域へその値を積み、その後FP62に割り当
てられたレジスタはフレームの下端a点をポイントする
ように初期化される。
(Determination of Interrupt Processing S1) In order to secure a work space required for pre-interrupt processing, the stack 7
23, a frame creation procedure S11 is performed. As a result of this processing, from the point a on the stack 723 in FIG.
Up to the point is secured as a frame 61. By securing the frame, the SP 713 moves to the point b, which is the upper end of the frame. A frame pointer (hereinafter referred to as FP) 62 for managing a used area in a frame as in SP713.
Create First, in order to store the current value of the register 711 used as the FP 62, the value is stacked on the stored register value area above the point b, and then the register assigned to the FP 62 is pointed to the lower point a of the frame. Is initialized to

【0019】図1のレジスタ値保存手続きS12では、
割り込み前処理で使用される他の全てのレジスタ711
の値を、図6の保存レジスタ値領域へ順に積む。
In the register value storing procedure S12 in FIG.
All other registers 711 used in pre-interrupt processing
Are sequentially stored in the storage register value area of FIG.

【0020】割り込みの先頭アドレスの獲得手続きS1
3は、割り込み処理の先頭アドレスを、プログラムカウ
ンタ相対アドレシングなどにより、現在の実行アドレス
と実行オブジェクトのリンク時に得られた割り込み処理
までのオフセットアドレス値を加算して得る。
Procedure S1 for obtaining start address of interrupt
No. 3 obtains the start address of the interrupt processing by adding the current execution address and the offset address value up to the interrupt processing obtained at the time of linking the execution object by program counter relative addressing or the like.

【0021】割り込み処理の先頭アドレス保存手続きS
14では、割り込み前処理から割り込み処理へ実行を移
すまで、得られた割り込み処理の先頭アドレスをレジス
タ等に一時保存しておく。
Procedure S for saving start address of interrupt processing
At 14, the obtained start address of the interrupt process is temporarily stored in a register or the like until the execution is shifted from the pre-interrupt process to the interrupt process.

【0022】以上のベクタ番号獲得後の個別処理を実行
した後、ジャンプ処理S15で多重割り込み確認S2へ
ジャンプする。これ以下の処理は、ベクタ番号に依存し
ない共通手続きとして記述可能であり、プログラム領域
として図7に722で示すようなメモリ上の配置が可能
となる。
After executing the above-described individual processing after obtaining the vector number, the processing jumps to the multiple interruption confirmation S2 in the jump processing S15. The processing below this can be described as a common procedure that does not depend on the vector number, and can be arranged as a program area on a memory as indicated by 722 in FIG.

【0023】(多重割り込み確認S2)図1に示すよう
に、多重割り込み確認S2では、多重割り込みの場合と
そうでない場合の割り込み処理終了時のリターン先の切
り替えを行う。多重割り込みフラグ確認手続きS21で
は、割り込み処理中に発生した多重割り込みかどうかを
判断するため、割り込み処理中フラグを確認する。
(Multiple Interrupt Confirmation S2) As shown in FIG. 1, in the multiple interrupt confirmation S2, the return destination at the end of the interrupt processing in the case of the multiple interrupt and in the other case is switched. In the multiple interrupt flag confirmation procedure S21, an interrupt processing flag is confirmed to determine whether or not the multiple interrupt has occurred during the interrupt processing.

【0024】もし、割り込み処理中フラグがセットされ
ていなければ、この割り込みは多重割り込みでないこと
がわかる。この場合は、この割り込み処理途上で発生す
る多重割り込みを検出するため、割り込み処理フラグの
セット手続きS22を行い、更に図2のように、記述さ
れた割り込み処理の最後のリターン命令でタスクスイッ
チ処理へ実行を移すため、割り込み処理後の戻り先変更
S3へ分岐する。
If the interrupt processing flag is not set, it is understood that this interrupt is not a multiple interrupt. In this case, in order to detect multiple interrupts occurring during this interrupt processing, an interrupt processing flag setting procedure S22 is performed, and as shown in FIG. 2, the task switch processing is performed by the last return instruction of the described interrupt processing. In order to shift the execution, the process branches to return destination change S3 after the interrupt processing.

【0025】割り込み処理中フラグが既にセットされて
いれば、多重割り込み処理分岐S4へ分岐する。本手順
以下は、必要に応じコンピュータを多重割り込み可能状
態とすることが出来る。
If the interrupt processing flag is already set, the flow branches to a multiple interrupt processing branch S4. Following this procedure, the computer can be brought into a multiple interrupt enabled state as needed.

【0026】(割り込み処理後の戻り先変更S3)図1
の割り込み処理後の戻り先変更S3では、図2のような
割り込み処理の最後のリターン命令でタスクスイッチ処
理へ実行を移すように、戻り先の変更処理を実行する。
タスクスイッチ処理の先頭アドレスと状態レジスタとを
フレームに積む手続きS31は、割り込みリターン命令
の戻り先をFP62が示している図6のa点の上に積
む。このとき、割り込み前のタスクの実行アドレスと状
態レジスタとをスタックに残したままにしておくのは、
タスクスイッチ処理によって再び割り込まれたタスクへ
戻れるようにするためである。この処理のあとフレーム
を先入れ後だしメモリとして使用するため、FP62の
値をd点へ移す手続きS32を実行する。本手順の実行
の後、割り込み処理分岐S4を実行する。
(Change of return destination after interrupt processing S3) FIG.
In the return destination change S3 after the interrupt processing, return destination change processing is executed such that execution is shifted to the task switch processing by the last return instruction of the interrupt processing as shown in FIG.
In the procedure S31 of loading the start address of the task switch process and the status register in the frame, the return destination of the interrupt return instruction is loaded on the point a in FIG. At this time, leaving the execution address of the task before the interrupt and the status register on the stack is
This is so that the task can be returned to the interrupted task by the task switch process. After this processing, in order to use the frame as a first-in first-out memory, a procedure S32 of moving the value of the FP 62 to the point d is executed. After execution of this procedure, an interrupt processing branch S4 is executed.

【0027】(割り込み処理分岐S4)割り込み処理分
岐S4は、実行すべき割り込み処理へ分岐するための処
理を実行する。割り込み処理の先頭アドレスをフレーム
に積む手続きS41は、すでに先頭割り込み処理決定S
1で求め、かつ一時的にレジスタ等に保存した割り込み
処理の先頭アドレスを、図6のFP62が示しているフ
レームのd点の上に積む。
(Interrupt processing branch S4) The interrupt processing branch S4 executes processing for branching to an interrupt processing to be executed. The procedure S41 of loading the start address of the interrupt processing on the frame is already determined by the start interrupt processing determination S
The start address of the interrupt process obtained in step 1 and temporarily stored in a register or the like is stacked on point d of the frame indicated by FP 62 in FIG.

【0028】この処理のあとフレームを先入れ後だしメ
モリとして使用するため、FP62の値をe点へ移す手
続きS42を実行する。
After this process, a procedure S42 for moving the value of the FP 62 to the point e is executed in order to use the frame as a first-in first-out memory.

【0029】レジスタ値回復手続きS43では、図2の
割り込み処理が仮想的に割り込みの直後に実行されたよ
うに見せるため、SP713とFP62以外の割り込み
前処理で使用された全てのレジスタ値を元に戻す。
In the register value recovery procedure S43, in order to make it appear that the interrupt processing of FIG. 2 has been executed virtually immediately after the interrupt, all the register values used in the pre-interrupt processing other than SP713 and FP62 are used. return.

【0030】フレーム抹消手続きS44では、現在FP
62の値が示している図6のe点へSP713を移動す
る。その後FP62は不要になるので、FP62に使用
したレジスタの値を図6の保存レジスタ値領域から回復
する。最後のリターン命令の実行S45によって、スタ
ックから割り込みの処理の先頭アドレスが取り込まれ、
割り込み処理へ実行が移される。
In the frame deletion procedure S44, the current FP
The SP 713 is moved to the point e in FIG. 6 indicated by the value of 62. After that, since the FP 62 becomes unnecessary, the value of the register used for the FP 62 is recovered from the storage register value area of FIG. By executing the last return instruction S45, the start address of the interrupt process is fetched from the stack,
Execution is shifted to interrupt processing.

【0031】さて、実行が移された図2の割り込み処理
では、この処理の最後にある割り込みリターン命令の実
行によって、スタック上の最上位にあるアドレスと状態
レジスタ値とが読み込まれ、この状態レジスタの値で実
行が再開される。つまり、多重割り込みでない割り込み
の場合は、スタックの最上位にあるのは、図6のd点に
あるタスクスイッチ処理の先頭アドレスと状態レジスタ
値とであり、タスクスイッチ処理を一旦経由した後、タ
スク処理へ戻ることになる。タスクスイッチ処理では、
タスクスイッチの実行と共に割り込み処理中フラグがセ
ットされる。
In the interrupt processing of FIG. 2 whose execution has been shifted, the highest address on the stack and the value of the status register are read by executing the interrupt return instruction at the end of this processing. Execution resumes at the value of. That is, in the case of an interrupt that is not a multiple interrupt, the top of the stack is the start address of the task switch process and the status register value at point d in FIG. It will return to processing. In the task switch process,
The interrupt processing flag is set when the task switch is executed.

【0032】一方、多重割り込みの場合は、スタックの
最上位にあるのは、図6のa点にある割り込み前の実行
アドレスと状態レジスタ値とであり、割り込みをした低
レベル割り込み処理へ戻る。
On the other hand, in the case of multiple interrupts, the top of the stack is the execution address before the interrupt and the status register value at point a in FIG. 6, and the process returns to the low-level interrupt process in which the interrupt occurred.

【0033】図4に、本実施例による以上の多重割り込
みのタイムチャートを示す。
FIG. 4 shows a time chart of the above-mentioned multiple interrupts according to the present embodiment.

【0034】(実施例2)本発明の割り込み制御方法の
他の実施例を図5にしたがって説明する。
(Embodiment 2) Another embodiment of the interrupt control method of the present invention will be described with reference to FIG.

【0035】割り込み前処理の実行の後に割り込み処理
へ実行を移すため、割り込み処理の先頭アドレス(割り
込みベクタ表と同ような構造)の表をメモリ内に別途作
成しておく。
In order to shift the execution to the interrupt processing after the execution of the pre-interrupt processing, a table of the start address of the interrupt processing (structure similar to the interrupt vector table) is separately created in the memory.

【0036】図1に示した実施例1では、実行すべき割
り込み処理の決定S1の結果として、実行すべき割り込
み処理の先頭アドレスを求めたが、本実施例の図5で
は、実行すべき割り込み処理の決定S51では、手続き
S513で得た直値として埋めこまれている割り込みベ
クタ(割り込み処理)毎の識別番号を、手続きS514
でレジスタやメモリへ一旦保存する。
In the first embodiment shown in FIG. 1, the start address of the interrupt processing to be executed is obtained as a result of the determination S1 of the interrupt processing to be executed. In the processing decision S51, the identification number of each interrupt vector (interrupt processing) embedded as a direct value obtained in the procedure S513 is stored in the procedure S514.
To temporarily save to a register or memory.

【0037】後の割り込み処理分岐S54では、この識
別番号を使用し手続きS541で、割り込み処理の先頭
アドレスを表を参照して求める。この手続きとしては、
先に述べた割り込み処理の先頭アドレスをメモリ内に順
に並べた表を作成し、その表の先頭アドレスと識別番号
から得られるオフセットアドレスとを加算し、その加算
結果のアドレスより割り込み処理の先頭アドレスを読み
出す。その後、ジャンプ命令S544で割り込み処理へ
実行を移す。
In the subsequent interrupt processing branch S54, the start address of the interrupt processing is obtained by referring to the table in the procedure S541 using this identification number. This procedure includes:
A table is prepared in which the start addresses of the above-described interrupt processing are sequentially arranged in the memory, the start address of the table is added to the offset address obtained from the identification number, and the start address of the interrupt processing is obtained from the address of the addition result. Is read. Thereafter, execution is shifted to interrupt processing by a jump instruction S544.

【0038】図1の実施例1の多重割り込み確認S2で
は、割り込み処理中フラグを使用しソフトウェア的に多
重割り込みの判断をした。図5の多重割り込み確認手段
S52では、コンピュータ内に多重割り込みの発生を確
認出来る割り込みコントローラ等のハードウェアがある
場合の実施例である。まず、割り込みコントローラのス
テータスを読み(手続きS521)、このステータスか
ら現在の割り込みよりレベルの低い割り込みが待たされ
ているかどうか手続きS522で確認する。もし、存在
しなければ多重割り込みでない割り込みであるので、実
施例1と同ようの割り込み処理後の戻り先変更S3を実
行する。
In the multiple interrupt confirmation S2 of the first embodiment shown in FIG. 1, the multiple interrupt is determined by software using the interrupt processing flag. The multiple interrupt confirmation means S52 in FIG. 5 is an embodiment in the case where hardware such as an interrupt controller capable of confirming the occurrence of multiple interrupts is provided in the computer. First, the status of the interrupt controller is read (procedure S521), and from this status, it is checked in step S522 whether an interrupt lower in level than the current interrupt is waiting. If it does not exist, the interrupt is not a multiple interrupt, so the return destination change S3 after the interrupt processing is executed as in the first embodiment.

【0039】尚、本実施例では、最初の低レベルの割り
込み処理に入る前に、割り込み前処理でタスクスイッチ
処理へのポインタと状態レジスタとをスタックに積んだ
が、最後の低レベルの割り込み処理からのリターン処理
の前に、同様のリターン前処理でタスクスイッチ処理へ
のポインタと状態レジスタとをスタックに積んでも、本
実施例と同様の効果を達成できる。また、本実施例で示
した割り込み前処理のフローチャートはその一例であ
り、同じ機能を達成できればこれに限定されない。例え
ば、多重割り込み確認を最初に実行し、多重割り込み時
にはレジスタ等の保存/回復を最小限にすれば、多重割
り込み時の処理の迅速化が図れる。また、本実施例の割
り込み前処理は、ソフトウエアにより実現されてもよい
し、ハードウエアにより実現されてもよい。更に、ハー
ドウエアとソフトウエアとを組合わせたファームウエア
による実現も出来る。さらに、本発明は、複数の機器か
ら構成されるシステムに適用しても、1つの機器から成
る装置に適用しても良い。また、本発明はシステム或は
装置にプログラムを供給することによって達成される場
合にも適用できることは言うまでもない。
In this embodiment, before entering the first low-level interrupt processing, the pointer to the task switch processing and the status register are stacked on the stack in the pre-interrupt processing, but from the last low-level interrupt processing. Even if the pointer to the task switch process and the status register are stacked on the stack in the same pre-return process before the return process, the same effect as in the present embodiment can be achieved. Also, the flowchart of the pre-interrupt processing shown in the present embodiment is an example, and the present invention is not limited to this as long as the same function can be achieved. For example, if the multiple interrupt confirmation is executed first and the save / restore of registers and the like is minimized at the time of multiple interrupts, the processing at the time of multiple interrupts can be speeded up. Further, the pre-interrupt processing of the present embodiment may be realized by software or may be realized by hardware. Furthermore, it can also be realized by firmware combining hardware and software. Further, the present invention may be applied to a system including a plurality of devices or an apparatus including a single device. Needless to say, the present invention can be applied to a case where the present invention is achieved by supplying a program to a system or an apparatus.

【0040】[0040]

【発明の効果】以上説明したように、本発明によれば、
リアルタイム処理が要求されるマルチタスクシステムに
おいて、割り込みの要求に応じて現在の実行アドレスを
スタックに保存し、割り込みが多重割り込みか否かを確
認し、多重割り込みでない場合に、タスクスイッチ処理
の先頭アドレスを前記スタックにおいて前記実行アドレ
スの上位に保存し、割り込みの終了後に、割り込みが多
重割り込みか否かによらず、割り込み処理のリターン命
令により、スタックの最上位に保存されたアドレスに制
御を移すようにしたので、多重割り込みの場合は割り込
み前の処理へ戻ることができるとともに、多重割り込み
でない場合はタスクスイッチ処理へ移ることができる。
これにより、割り込み処理の最後でタスクスイッチのた
めの特殊な手続きを必要とすることなく、割り込み処理
の最後で割り込みリターン命令によりで書かれている割
り込み処理で、リアルタイム処理向けマルチタスクシス
テムの割り込み制御が可能となった。
As described above, according to the present invention,
In a multitasking system that requires real-time processing, the current execution address is
Save to stack and check if interrupt is multiple interrupt
Task switch processing when there are no multiple interrupts
Of the execution address in the stack.
At the top of the
Return order of interrupt processing regardless of whether it is a heavy interrupt
Control the address stored at the top of the stack.
Control, so if there are multiple interrupts, interrupt
It is possible to return to the previous processing and multiple interrupts
If not, the process can proceed to the task switch process.
This makes it possible to perform interrupt control written in the interrupt return instruction at the end of interrupt processing without requiring a special procedure for task switching at the end of interrupt processing. Became possible.

【0041】また、最近では高級言語によって簡単に割
り込みプログラムが記述出来るようになっている。これ
は、コンパイラが割り込み処理であると宣言されたサブ
ルーチンを、図2の形式へコンパイルすることによる。
したがって、高級言語で作成された割り込み処理プログ
ラムも、本発明を適用することによってリアルタイム処
理が要求されるマルチタスクシステム下で使用可能とな
る。
Recently, an interrupt program can be easily described in a high-level language. This is because the compiler compiles the subroutine declared to be the interrupt processing into the format shown in FIG.
Therefore, an interrupt processing program created in a high-level language can be used in a multitask system that requires real-time processing by applying the present invention.

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

【図1】本発明の実施例1の割り込み前処理の手順を示
すフローチャートである。
FIG. 1 is a flowchart illustrating a procedure of pre-interrupt processing according to a first embodiment of the present invention.

【図2】本実施例で使用される割り込み処理の手順を示
すフローチャートである。
FIG. 2 is a flowchart illustrating a procedure of an interrupt process used in the embodiment.

【図3】リアルタイム処理が要求されるマルチタスクシ
ステムの多重割り込みのタイムチャートである。
FIG. 3 is a time chart of multiple interrupts of a multitask system that requires real-time processing.

【図4】本実施例による多重割り込みを示すタイムチャ
ートである。
FIG. 4 is a time chart showing multiple interrupts according to the embodiment.

【図5】実施例2に示す割り込み前処理の手順を示すフ
ローチャートである。
FIG. 5 is a flowchart illustrating a procedure of pre-interrupt processing according to the second embodiment;

【図6】図1のスタックの使用状況を説明する図であ
る。
FIG. 6 is a diagram illustrating a usage state of the stack of FIG. 1;

【図7】本実施例のシステムを説明するための図であ
る。
FIG. 7 is a diagram for explaining the system of the present embodiment.

───────────────────────────────────────────────────── フロントページの続き (72)発明者 山田 潤二 東京都大田区下丸子3丁目30番2号 キ ヤノン株式会社内 (56)参考文献 特開 平5−120038(JP,A) (58)調査した分野(Int.Cl.7,DB名) G06F 9/46 G06F 9/42 ────────────────────────────────────────────────── ─── Continuation of the front page (72) Inventor Junji Yamada 3-30-2 Shimomaruko, Ota-ku, Tokyo Canon Inc. (56) References JP-A-5-120038 (JP, A) (58) Survey Field (Int.Cl. 7 , DB name) G06F 9/46 G06F 9/42

Claims (6)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】 リアルタイム処理が要求されるマルチタ
スクシステムにおける割り込み制御方法であって、割り込みの要求に応じて現在の実行アドレスをスタック
に保存し、 前記割り込みが多重割り込みか否かを確認し、前記割り込みが 多重割り込みでない場合に、タスクスイ
ッチ処理の先頭アドレスを前記スタックにおいて前記実
行アドレスの上位に保存し、 前記割り込みの終了後に、当該割り込みが多重割り込み
か否かによらず、割り込み処理のリターン命令により、
前記スタックの最上位に保存されたアドレスに制御を移
ことを特徴とする割り込み制御方法。
An interrupt control method in a multitask system requiring real-time processing, wherein a current execution address is stacked in response to an interrupt request
Stored in the interrupt confirm whether multiple interrupts or, if the interrupt is not a multiple interrupts, Tasukusui
The start address of the switch process in the stack.
Stored above the row address, after the end of the interrupt, the interrupt
Regardless of whether or not the
Control transfers to the address stored at the top of the stack.
Interrupt control method, characterized in that to.
【請求項2】 前記割り込みが多重割り込みか否かの確
認は、割り込み処理中フラグを参照して行ない、当該割
り込み処理中フラグは、前記割り込みが多重割り込みで
ない場合にセットされ、前記タスクスイッチ処理におい
てリセットされることを特徴とする請求項1記載の割り
込み制御方法。
2. A method according to claim 1, wherein said interrupt is a multiple interrupt.
Is determined by referring to the interrupt processing flag.
The interrupt processing flag indicates that the interrupt is a multiple interrupt.
This is set when there is no
2. The interrupt control method according to claim 1, wherein the resetting is performed by resetting .
【請求項3】 前記タスクスイッチ処理の先頭アドレス
の保存は、前記割り込みの実行に先立ち実行されること
を特徴とする請求項1または2記載の割り込み制御方
法。
3. The start address of the task switch process.
3. The interrupt control method according to claim 1 , wherein the storing of the interrupt is performed prior to the execution of the interrupt.
【請求項4】 リアルタイム処理が要求されるマルチタ
スクシステムにおいて、データを後入れ先出しで記憶するスタックと、 割り込みの要求に応じて現在の実行アドレスを前記スタ
ックに保存する第1の保存手段と、 前記割り込みが多重割り込みか否かを確認する確認手段
と、前記割り込みが 多重割り込みでない場合に、タスクスイ
ッチ処理の先頭アドレスを前記スタックにおいて前記実
行アドレスの上位に保存する第2の保存手段と、 前記割り込みの終了後に、当該割り込みが多重割り込み
か否かによらず、割り込み処理のリターン命令により、
前記スタックの最上位に保存されたアドレスに制御を移
す制御手段 とを備えることを特徴とするマルチタスクシ
ステム。
4. In a multitask system requiring real-time processing , a stack for storing data in a last-in first-out manner and a current execution address in response to an interrupt request are stored in the stack.
First storing means for storing the interrupt in a memory , checking means for checking whether or not the interrupt is a multiple interrupt, and a task switch when the interrupt is not a multiple interrupt.
The start address of the switch process in the stack.
A second storing means for storing the upper row address, after completion of the interrupt, the interrupt multiple interrupts
Regardless of whether or not the
Control transfers to the address stored at the top of the stack.
A multitasking system comprising:
【請求項5】 前記確認手段は、割り込み処理中フラグ
を参照して行ない、当該割り込み処理中フラグは、前記
割り込みが多重割り込みでない場合にセットされ、前記
タスクスイッチ処理においてリセットされることを特徴
とする請求項4記載のマルチタスクシステム。
5. The apparatus according to claim 1, wherein said confirming means includes an interrupt processing flag.
The interrupt processing flag is set as described above.
Set when the interrupt is not a multiple interrupt, and
5. The multitask system according to claim 4, wherein the system is reset in the task switch process .
【請求項6】 前記第2の保存手段は、前記割り込みの
実行に先立って前記タスクスイッチ処理の先頭アドレス
を保存することを特徴とする請求項4または5記載のマ
ルチタスクシステム。
6. The interruption means according to claim 1 , wherein
Prior to execution, the start address of the task switch process
The multitasking system according to claim 4, wherein the multitasking system is stored .
JP28109193A 1993-11-10 1993-11-10 Interrupt control method and multitask system for implementing the same Expired - Fee Related JP3184380B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP28109193A JP3184380B2 (en) 1993-11-10 1993-11-10 Interrupt control method and multitask system for implementing the same

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP28109193A JP3184380B2 (en) 1993-11-10 1993-11-10 Interrupt control method and multitask system for implementing the same

Publications (2)

Publication Number Publication Date
JPH07134656A JPH07134656A (en) 1995-05-23
JP3184380B2 true JP3184380B2 (en) 2001-07-09

Family

ID=17634216

Family Applications (1)

Application Number Title Priority Date Filing Date
JP28109193A Expired - Fee Related JP3184380B2 (en) 1993-11-10 1993-11-10 Interrupt control method and multitask system for implementing the same

Country Status (1)

Country Link
JP (1) JP3184380B2 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2396451B (en) 2002-11-18 2005-12-07 Advanced Risc Mach Ltd Delivering data processing requests to a suspended operating system
JP6277359B2 (en) * 2012-03-21 2018-02-14 株式会社ソフイア Game machine

Also Published As

Publication number Publication date
JPH07134656A (en) 1995-05-23

Similar Documents

Publication Publication Date Title
KR930000592B1 (en) Task searching apparatus
US5584039A (en) System for coordinating execution of multiple concurrent channel programs without host processor involvement using suspend and resume commands to control data transfer between I/O devices
US5428779A (en) System and method for supporting context switching within a multiprocessor system having functional blocks that generate state programs with coded register load instructions
EP0087978B1 (en) Information processing unit
US5701493A (en) Exception handling method and apparatus in data processing systems
JPH0816870B2 (en) System for draining the instruction pipeline
JPH0353328A (en) Register saving recoverying method and processor
JPH0640307B2 (en) Data processing system
JPH0348537B2 (en)
JP2003515805A (en) Processor system
US20030120712A1 (en) Task context switching RTOS
JP3184380B2 (en) Interrupt control method and multitask system for implementing the same
EP0285634B1 (en) Method to execute two instruction sequences in an order determined in advance
US5740359A (en) Program execution system having a plurality of program versions
EP0206335B1 (en) Interruption method for a data processing system
US20010039558A1 (en) Cache memory management method for real time operating system
JP2671160B2 (en) Exception handling method
KR960014825B1 (en) Information processing system
JPS6376028A (en) Method for controlling execution of instruction step in virtual computer system
JPH0895803A (en) Task scheduling method
JP2954006B2 (en) Emulation device and emulation method
JPH09146782A (en) Method for handling occurance of abnormality in inter-job data succession
EP1104899A2 (en) Data processing apparatus and method of controlling the same
JP3029445B2 (en) Startup reception device and method
JP2639988B2 (en) Data driven data processor

Legal Events

Date Code Title Description
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20010330

LAPS Cancellation because of no payment of annual fees