JPH0926898A - Device and method for detection of program error - Google Patents

Device and method for detection of program error

Info

Publication number
JPH0926898A
JPH0926898A JP7173375A JP17337595A JPH0926898A JP H0926898 A JPH0926898 A JP H0926898A JP 7173375 A JP7173375 A JP 7173375A JP 17337595 A JP17337595 A JP 17337595A JP H0926898 A JPH0926898 A JP H0926898A
Authority
JP
Japan
Prior art keywords
program
error detection
address
error
pointer
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
JP7173375A
Other languages
Japanese (ja)
Inventor
Fumitoshi Uno
文敏 宇野
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.)
EKUSHINGU KK
Brother Industries Ltd
Xing Inc
Original Assignee
EKUSHINGU KK
Brother Industries Ltd
Xing 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 EKUSHINGU KK, Brother Industries Ltd, Xing Inc filed Critical EKUSHINGU KK
Priority to JP7173375A priority Critical patent/JPH0926898A/en
Publication of JPH0926898A publication Critical patent/JPH0926898A/en
Pending legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

PROBLEM TO BE SOLVED: To detect a program error by utilizing the one function of a paging means to be originally used for realizing a virtual storage system. SOLUTION: The source program prepared by a C language is translated into an object program and is executed. If a program error exists in the source program at the time, the effect is displayed on a CRT display device 60. In this detection, a paging unit 13 is utilized. Namely, when the initialization of a pointer value is not performed, a state that a virtual address is not allocated to all the parts of a physical address is generated, a page fault is generated and a system program is called. In this case, because the generation of a reading command or a writing command is performed for a set error detection area without fail, the correspondened processing at the time of a prescribed error detection is to be executed.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【発明の属する技術分野】本発明は、C言語やパスカル
言語のように、スタックエリアに自動変数をとるソース
プログラムの作成時に、ポインタ変数を自動変数としな
がらそのポインタ値の初期化をし忘れるエラー(以下、
単にプログラムエラーと略称する。)を検出するプログ
ラムエラー検出装置及び検出方法に関するものである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an error in which a pointer variable is made an automatic variable and a pointer value is forgotten to be initialized when a source program that takes an automatic variable in a stack area is created like C language or Pascal language. (Less than,
It is simply called a program error. ) For detecting a program error and a method for detecting the same.

【0002】[0002]

【従来の技術】この種のプログラムエラー検出装置は既
に知られている。従来のプログラムエラー検出装置にお
いては、ソースプログラムをオブジェクトプログラムに
翻訳する際に、ソースプログラムの構文を解析すること
によってプログラムエラーを検出するようになってい
た。
2. Description of the Related Art A program error detecting device of this kind is already known. In a conventional program error detection device, when a source program is translated into an object program, the program error is detected by analyzing the syntax of the source program.

【0003】また、特願平5−253082号では、ハ
ード的なエラー検出回路を用いてプログラムエラーを検
出する試みをしている。つまり、ソースプログラムをオ
ブジェクトプログラムに翻訳する翻訳手段と、ポインタ
変数を自動変数とした場合にオブジェクトプログラムに
ポインタ変数のポインタ値を予め定められたアドレス値
に設定する命令を自動的に追加する自動初期化手段とを
備えたコンパイラと、オブジェクトプログラムの実行時
に、前記自動初期化手段によって設定されたアドレス値
を含む予め定められた範囲のメモリエリアに対する読み
書きを検出し、エラー信号を出すエラー検出回路と、そ
のエラー信号に応じて、ソースプログラムにおけるポイ
ンタ変数のポインタ値の初期化し忘れをオペレータに知
らせる報知手段とを備える構成である。この場合には、
プログラムエラーの検出が上記のような構文解析によら
ずエラー検出回路によって行われるため、検出速度の向
上及び確実な検出を実現することができる。
In Japanese Patent Application No. 5-253082, an attempt is made to detect a program error using a hardware error detection circuit. In other words, a translation means for translating the source program into an object program, and an automatic initialization that automatically adds an instruction to set the pointer value of the pointer variable to a predetermined address value in the object program when the pointer variable is an automatic variable. And an error detection circuit that detects read / write to a memory area in a predetermined range including the address value set by the automatic initialization means and outputs an error signal when the object program is executed, And a notification means for notifying the operator that the pointer value of the pointer variable in the source program has been forgotten to be initialized according to the error signal. In this case,
Since the detection of the program error is performed by the error detection circuit without relying on the above-mentioned syntax analysis, the detection speed can be improved and the reliable detection can be realized.

【0004】[0004]

【発明が解決しようとする課題】ところで、いわゆる仮
想記憶システムを実現するためにアドレス変換機能を備
えたページング手段が知られている。この仮想記憶シス
テム用のページング手段は、ページテーブルに基づき仮
想アドレスを所定のページ単位で物理アドレスに変換す
るアドレス変換機能を有すると共に、かつ仮想アドレス
が物理アドレスのどこにも割り付けられていない場合に
はページフォールトを発生させてシステムプログラムを
呼び出す例外処理要求機能をも備えるものである。例え
ば、インテル社製8086系CPUの内で、80386
以上のバージョン(80386,80486,Pent
ium)のCPUは、このページング手段を内蔵してお
り、ページングユニットと呼ばれている。
By the way, there is known a paging means having an address conversion function in order to realize a so-called virtual memory system. The paging means for this virtual storage system has an address translation function of translating a virtual address into a physical address in units of a predetermined page based on a page table, and when the virtual address is not assigned anywhere in the physical address, It also has an exception handling request function that generates a page fault and calls a system program. For example, among the 8086 CPUs manufactured by Intel, 80386
More versions (80386, 80486, Pent
The CPU of (i.m.) has a built-in paging means and is called a paging unit.

【0005】上述した特願平5−253082号におい
ては、エラー検出回路が出すエラー信号に基づいてプロ
グラムエラーを検出するようにしているが、ページング
手段から発生するページフォールトを用いても、同様に
プログラムエラーを検出可能ではないかと本願出願人は
考察した。そして、このような本来は仮想記憶システム
の実現のために用いられるページング手段の一機能を利
用してプログラムエラーの検出ができれば、特別なハー
ドの追加が必要なく非常にメリットが高い。
In the above-mentioned Japanese Patent Application No. 5-253082, the program error is detected based on the error signal output from the error detection circuit. However, even if the page fault generated by the paging means is used, The applicant considered that a program error could be detected. If a program error can be detected by using one function of the paging means originally used for realizing such a virtual memory system, there is no need to add special hardware, which is very advantageous.

【0006】但し、例えば上述したCPU内蔵のページ
ング手段においては、特別なシステムプログラムからし
か制御することができず、一般のプログラムからはこの
ページング手段は利用できない仕組みになっている。一
般にページング手段を制御する権利はOS(オペレーテ
ィングシステム)等のシステムプログラムが持ってお
り、一般アプリケーションからは直接制御することがで
きないのである。
However, for example, in the above-mentioned paging means having a built-in CPU, it can be controlled only by a special system program, and the paging means cannot be used by a general program. Generally, the right to control the paging means is held by a system program such as an OS (operating system) and cannot be directly controlled by a general application.

【0007】そこで本発明は、ページング手段を制御す
る権利を持つシステムプログラムに対して一般アプリケ
ーションから所定の処理を行い、ページング手段の一機
能を利用してプログラムエラーの検出ができるようにす
ることを目的とする。
In view of the above, the present invention intends to perform a predetermined process from a general application on a system program having the right to control the paging means, and use one function of the paging means to detect a program error. To aim.

【0008】[0008]

【課題を解決するための手段及び発明の効果】請求項1
に記載の発明は、スタックエリアに自動変数をとるソー
スプログラムの作成時に、ポインタ変数を自動変数とし
ながらそのポインタ値の初期化をし忘れるプログラムエ
ラーを検出する装置であって、前記ソースプログラムを
オブジェクトプログラムに翻訳する翻訳機能、及び前記
ポインタ変数を自動変数とした場合にオブジェクトプロ
グラムにポインタ変数のポインタ値を所定のアドレス値
に設定する命令を自動的に追加する自動初期化機能とを
備えたコンパイラと、ページテーブルに基づき仮想アド
レスを所定のページ単位で物理アドレスに変換するアド
レス変換機能を有し、かつ仮想アドレスが物理アドレス
のどこにも割り付けられていない場合にはページフォー
ルトを発生させてシステムプログラムを呼び出す例外処
理要求機能を有する仮想記憶システム用のページング手
段と、前記コンパイラによって翻訳されたオブジェクト
プログラムの開始時またはプログラム開始以前に、シス
テムプログラムに対して、エラー検出エリアのアドレス
設定とエラー検出時の対応処理の設定を行う事前処理実
行手段と、前記オブジェクトプログラムの実行時に、前
記ページング手段によって発生されたページフォールト
の発生要因が前記エラー検出エリアに対する読み書きに
よるものである場合には、前記事前処理実行手段によっ
て設定された所定のエラー検出時対応処理を実行するエ
ラー検出時対応処理実行手段とを備えることを特徴とす
るものである。
Means for Solving the Problems and Effects of the Invention
The invention described in (1) is a device for detecting a program error that forgets to initialize the pointer value while making the pointer variable an automatic variable when a source program that takes an automatic variable in the stack area is created. A compiler having a translation function for translating into a program and an automatic initialization function for automatically adding an instruction for setting a pointer value of a pointer variable to a predetermined address value to an object program when the pointer variable is an automatic variable And an address translation function that translates a virtual address into a physical address on a page-by-page basis based on a page table, and generates a page fault if the virtual address is not assigned anywhere in the physical address. Exception handling request function to call Paging means for a virtual memory system and advance setting of an error detection area address and a corresponding process at the time of error detection for a system program at the start of the object program translated by the compiler or before the program starts. When the cause of the page fault generated by the paging means at the time of executing the processing execution means and the object program is due to reading / writing from / to the error detection area, a predetermined value set by the preprocessing execution means. And an error detection time response process execution means for executing the error detection time response process.

【0009】請求項2に記載の発明は、前記ページング
手段はCPUに内蔵されていることを特徴とする請求項
1に記載のプログラムエラー検出装置である。請求項3
に記載の発明は、請求項1または2に記載のプログラム
エラー検出装置において、前記エラー検出時対応処理実
行手段は、前記コンパイラによって翻訳されたオブジェ
クトプログラムの一部として設定されている所定の強制
終了処理ルーチンに基づいて、前記オブジェクトプログ
ラム自身を強制終了させるよう構成されていることを特
徴とするものである。
A second aspect of the present invention is the program error detecting apparatus according to the first aspect, wherein the paging means is built in a CPU. Claim 3
In the program error detection device according to claim 1 or 2, the error detection response processing execution means is a predetermined forced termination set as a part of the object program translated by the compiler. The object program itself is configured to be forcibly terminated based on a processing routine.

【0010】請求項4に記載の発明は、請求項1または
2に記載のプログラムエラー検出装置において、前記エ
ラー検出時対応処理実行手段は、前記コンパイラによっ
て翻訳されたオブジェクトプログラムの一部あるいはシ
ステムプログラム自身の一部として設定されている所定
のエラー発生報知処理ルーチンに基づいて、前記ソース
プログラムにおけるポインタ変数のポインタ値の初期化
し忘れに起因するプログラムエラー発生をオペレータに
報知する所定の処理を実行するよう構成されていること
を特徴とするものである。
According to a fourth aspect of the present invention, in the program error detection apparatus according to the first or second aspect, the error detection response processing execution means is a part of the object program translated by the compiler or a system program. Based on a predetermined error occurrence notification processing routine that is set as a part of itself, executes a predetermined processing that notifies the operator of a program error occurrence due to forgetting to initialize the pointer value of the pointer variable in the source program. It is characterized by being configured as follows.

【0011】また、請求項5に記載の発明は、スタック
エリアに自動変数をとるソースプログラムをオブジェク
トプログラムに翻訳する翻訳機能、及び前記ポインタ変
数を自動変数とした場合にオブジェクトプログラムにポ
インタ変数のポインタ値を所定のアドレス値に設定する
命令を自動的に追加する自動初期化機能とを備えたコン
パイラと、仮想アドレス空間でのアドレスを、所定のペ
ージ単位で物理アドレス空間でのアドレスに変換するア
ドレス変換機能を有し、かつ仮想アドレスがメモリ上に
ない場合にはページングフォルトを発生させてシステム
プログラムを呼び出す例外処理要求機能を有する仮想記
憶システム用のページング手段とを備え、前記ソースプ
ログラムの作成時に、前記ポインタ変数を自動変数とし
ながらそのポインタ値の初期化をし忘れるプログラムエ
ラーを検出する方法であって、前記コンパイラによって
翻訳されたオブジェクトプログラムの開始時またはプロ
グラム開始以前に、システムプログラムに対して、エラ
ー検出エリアのアドレス設定とエラー検出時の対応処理
の設定を行い、前記オブジェクトプログラムの実行時
に、前記ページング手段によって発生されたページング
フォルトの発生要因が前記エラー検出エリアに対する読
み書きによるものである場合には、前記事前処理実行手
段によって設定された所定のエラー検出時対応処理を実
行することを特徴とするものである。
According to a fifth aspect of the invention, a translation function for translating a source program that takes automatic variables in a stack area into an object program, and a pointer of a pointer variable to an object program when the pointer variable is an automatic variable A compiler with an automatic initialization function that automatically adds an instruction to set a value to a predetermined address value, and an address that converts an address in the virtual address space into an address in the physical address space in predetermined page units A virtual memory system having a translation function and an exception handling request function for invoking a system program by generating a paging fault when the virtual address does not exist in the memory; , Pointing the pointer variable as an automatic variable A method for detecting a program error that forgets to initialize a value, which is performed when the object program translated by the compiler is started or before the program is started, when the address of the error detection area is set and the error is detected in the system program. If the cause of the paging fault generated by the paging means at the time of execution of the object program is due to reading / writing to the error detection area, the corresponding processing is set by the preprocessing execution means. It is characterized in that the specified predetermined error response processing is executed.

【0012】請求項6に記載の発明は、請求項5に記載
のプログラムエラー検出方法において、前記エラー検出
時対応処理として、前記コンパイラによって翻訳された
オブジェクトプログラムの一部として設定されている所
定の強制終了処理ルーチンに基づき、前記オブジェクト
プログラム自身を強制終了させることを特徴とするもの
である。
According to a sixth aspect of the present invention, in the program error detection method according to the fifth aspect, the predetermined processing set as a part of the object program translated by the compiler is performed as the error detection response processing. The object program itself is forcibly terminated based on a forced termination processing routine.

【0013】請求項7に記載の発明は、請求項5に記載
のプログラムエラー検出方法において、前記エラー検出
時対応処理として、前記コンパイラによって翻訳された
オブジェクトプログラムの一部あるいはシステムプログ
ラム自身の一部として設定されている所定のエラー発生
報知処理ルーチンに基づいて、前記ソースプログラムに
おけるポインタ変数のポインタ値の初期化し忘れに起因
するプログラムエラー発生をオペレータに報知すること
を特徴とするものである。
According to a seventh aspect of the present invention, in the program error detecting method according to the fifth aspect, a part of the object program translated by the compiler or a part of the system program itself is used as the error detection response processing. Based on a predetermined error occurrence notification processing routine set as, the operator is notified of a program error occurrence caused by forgetting to initialize the pointer value of the pointer variable in the source program.

【0014】本発明のプログラムエラー検出装置では、
コンパイラにおいて、スタックエリアに自動変数をとる
ソースプログラムが翻訳手段によってオブジェクトプロ
グラムに翻訳されるのであるが、ソースプログラムにお
いてポインタ変数が自動変数とされている場合には、オ
ブジェクトプログラムにポインタ変数のポインタ値を予
め定められたアドレス値に設定する命令が自動初期化手
段によって自動的に追加される。
In the program error detection device of the present invention,
In the compiler, the source program that takes an automatic variable in the stack area is translated into an object program by the translation means. However, if the source program uses a pointer variable as an automatic variable, the pointer value of the pointer variable is added to the object program. Is automatically added by the automatic initialization means.

【0015】そして、コンパイラによって翻訳されたオ
ブジェクトプログラムの開始時またはプログラム開始以
前に、事前処理実行手段が、システムプログラムに対し
て、エラー検出エリアのアドレス設定とエラー検出時の
対応処理の設定を行う。一方、ページング手段は、仮想
記憶システム用のものであり、ページテーブルに基づき
仮想アドレスを所定のページ単位で物理アドレスに変換
するアドレス変換機能を有し、かつ仮想アドレスが物理
アドレスのどこにも割り付けられていない場合にはペー
ジフォールトを発生させてシステムプログラムを呼び出
す例外処理要求機能を有する。
Then, at the start of the object program translated by the compiler or before the start of the program, the preprocessing execution means sets the address of the error detection area and the corresponding processing at the time of error detection for the system program. . On the other hand, the paging means is for a virtual storage system, has an address conversion function of converting a virtual address into a physical address in units of a predetermined page based on a page table, and the virtual address is allocated to any physical address. If not, it has an exception handling request function to generate a page fault and call a system program.

【0016】そこで、オブジェクトプログラムの実行時
に、このページング手段によって発生されたページフォ
ールトの発生要因が事前処理実行手段によって設定され
たエラー検出エリアに対する読み書きによるものである
場合には、同じく事前処理実行手段によって設定された
所定のエラー検出時対応処理をエラー検出時対応処理実
行手段が実行するのである。
Therefore, when the cause of the page fault generated by the paging means at the time of execution of the object program is due to the reading / writing of the error detection area set by the preprocessing execution means, the preprocessing execution means is also used. The error detection response processing execution means executes the predetermined error detection response processing set by the above.

【0017】プログラマ(プログラム)によってポイン
タ変数のポインタ値の初期化が行われていれば、オブジ
ェクトプログラムの実行時に上記設定されたエラー検出
エリアに対しての読み書きは行われず、プログラマによ
って設定されたアドレス値のアドレスに対して行われる
ため、例外処理が発生することはない。
If the pointer value of the pointer variable is initialized by the programmer (program), the error detection area set at the time of execution of the object program is not read or written, and the address set by the programmer is not used. Exception handling does not occur because the operation is performed on the value address.

【0018】しかし、プログラマによってポインタ値の
初期化が行われていない場合には、仮想アドレスが物理
アドレスのどこにも割り付けられていない状態となり、
ページフォルトが発生してシステムプログラムが呼び出
される。そしてこの場合は、読込み指令あるいは書込み
指令の発生が必ず上記設定されたエラー検出エリアに対
して行われるようにされるため、所定のエラー検出時対
応処理が実行されることとなる。
However, when the pointer value is not initialized by the programmer, the virtual address is not allocated to any physical address,
A page fault occurs and the system program is called. In this case, the read command or the write command is always issued to the error detection area set as described above, so that the predetermined error detection response process is executed.

【0019】なお、ポインタ値の初期化が行われていな
い場合以外であっても、仮想アドレスが物理アドレスの
どこにも割り付けられていない場合にはページフォルト
が発生してシステムプログラムが呼び出されるが、この
場合には読込み指令あるいは書込み指令の発生がエラー
検出エリア以外であるので、仮想記憶システムにおける
通常のページフォールト例外処理が実行されることとな
る。
Even if the pointer value is not initialized, a page fault occurs and the system program is called when the virtual address is not assigned to any physical address. In this case, since the read command or the write command is generated outside the error detection area, normal page fault exception processing in the virtual memory system will be executed.

【0020】このように、本発明のプログラムエラー検
出装置によれば、ページング手段を制御する権利を持つ
システムプログラムに対して一般アプリケーションから
所定の処理を行い、ページング手段の一機能を利用して
プログラムエラーの検出ができる。すなわち、プログラ
ムエラーの検出が構文解析によらずハードで構成された
ページング手段を利用することによって行われるため、
検出速度の向上及び確実な検出を実現することができる
と共に、本来は仮想記憶システムの実現のために用いら
れるページング手段の一機能を利用してプログラムエラ
ーの検出ができるので、特別なハードの追加が必要なく
なるのである。
As described above, according to the program error detecting apparatus of the present invention, a general application performs a predetermined process on a system program having the right to control the paging means, and the program is executed by using one function of the paging means. Can detect errors. That is, since the detection of the program error is performed by using the paging means configured by hardware, not by the parsing,
Since it is possible to improve the detection speed and realize reliable detection, and to detect a program error by using one function of the paging means originally used for realizing the virtual memory system, special hardware is added. Is unnecessary.

【0021】なお、ページング手段は、請求項2に示す
ようにCPUに内蔵するか、CPUにページング手段用
LSIとのやり取りをする専用の端子を付ける等して接
続することが考えられる。但し、CPUとページング手
段とを別体とする場合には、例えばCPUのメーカーが
ファミリーチップとしてページング手段用LSIを設定
製造することが必要となる。
It is conceivable that the paging means is built in the CPU as described in claim 2 or is connected by attaching a dedicated terminal for communicating with the paging means LSI to the CPU. However, when the CPU and the paging means are separately provided, for example, it is necessary for the maker of the CPU to set and manufacture the paging means LSI as a family chip.

【0022】また、上述したエラー検出時対応処理実行
手段としては、請求項3に示すように、コンパイラによ
って翻訳されたオブジェクトプログラムの一部として設
定されている所定の強制終了処理ルーチンに基づいて、
オブジェクトプログラム自身を強制終了させるよう構成
することが考えられる。この場合、例えば取扱説明書等
に、強制終了の原因がプログラムエラーであることが記
載されていれば、オペレータはその取扱説明書を見るこ
とでプログラムエラーがあることを知ることができる。
As the error detection response processing execution means, as described in claim 3, based on a predetermined forced termination processing routine set as a part of the object program translated by the compiler,
The object program itself may be configured to be terminated forcibly. In this case, for example, if the instruction manual or the like describes that the cause of the forced termination is a program error, the operator can know that there is a program error by looking at the instruction manual.

【0023】また、請求項4に示すものでは、コンパイ
ラによって翻訳されたオブジェクトプログラムの一部あ
るいはシステムプログラム自身の一部として設定されて
いる所定のエラー発生報知処理ルーチンに基づいて、ソ
ースプログラムにおけるポインタ変数のポインタ値の初
期化し忘れに起因するプログラムエラー発生をオペレー
タに報知する所定の処理を実行するよう構成されてい
る。この場合の報知する所定の処理としては、例えば、
プログラムエラーが存在する旨をCRT等の表示部に表
示させたり、報知ブザーを発音したり、報知ランプを点
灯させたりすることが考えられる。
According to the fourth aspect, the pointer in the source program is based on a predetermined error occurrence notification processing routine set as a part of the object program translated by the compiler or a part of the system program itself. It is configured to execute a predetermined process for notifying the operator of the occurrence of a program error due to forgetting to initialize the pointer value of the variable. Examples of the predetermined process to be notified in this case include, for example,
It is conceivable to display the fact that a program error exists on a display such as a CRT, sound a notification buzzer, or light a notification lamp.

【0024】これらにおいても、検出速度の向上及び確
実な検出を実現することができると共に、本来は仮想記
憶システムの実現のために用いられるページング手段の
一機能を利用してプログラムエラーの検出ができるの
で、特別なハードの追加が必要なくなるという効果を奏
する。
Also in these cases, the detection speed can be improved and reliable detection can be realized, and the program error can be detected by utilizing one function of the paging means originally used for realizing the virtual memory system. Therefore, there is an effect that it is not necessary to add special hardware.

【0025】[0025]

【発明の実施の形態】次に、本発明の実施形態について
説明する。以下の説明は、本発明の一実施例であるプロ
グラムエラー検出装置をパーソナルコンピュータに適用
した場合を例にとって進めることとする。
Next, an embodiment of the present invention will be described. In the following description, the case where the program error detection apparatus according to the embodiment of the present invention is applied to a personal computer will be taken as an example.

【0026】図1はパーソナルコンピュータの制御部の
概略構成を示すブロック図であり、CPU10と、シス
テムI/Oエリア20と、RAM30と、VRAM40
とが互いにアドレスバスAB及びデータバスDBで接続
されている。また、VRAM40にはCRT表示装置6
0が接続されている。
FIG. 1 is a block diagram showing a schematic configuration of a control unit of a personal computer, which includes a CPU 10, a system I / O area 20, a RAM 30, and a VRAM 40.
Are connected to each other by an address bus AB and a data bus DB. Further, the VRAM 40 has a CRT display device 6
0 is connected.

【0027】RAM30は、図2に示すように、000
00H番地〜9FFFFH番地の640Kバイトの領域
を備えたものであるが、その領域には、MS−DOS
(マイクロソフト社の登録商標名)領域23、プログラ
ムが格納されるコード領域24、複数個の数値等のデー
タが記憶されるデータ領域26が設けられ、それぞれの
領域24,26を示すアドレスは可変とされている。ま
た、RAM30には、自動変数をとり得るスタック領域
28も設けられている。RAM30は、ラージモデル型
とされ、図2において仮想アドレス空間として表されて
いる。仮想アドレスと物理アドレスの違いについては後
述する。
The RAM 30 has a memory capacity of 000 as shown in FIG.
It has an area of 640 Kbytes from addresses 00H to 9FFFFH, and the area is MS-DOS.
A (registered trademark name of Microsoft Corporation) area 23, a code area 24 for storing a program, and a data area 26 for storing data such as a plurality of numerical values are provided, and the addresses indicating the areas 24, 26 are variable. Has been done. Further, the RAM 30 is also provided with a stack area 28 capable of taking automatic variables. The RAM 30 is of a large model type and is represented as a virtual address space in FIG. The difference between the virtual address and the physical address will be described later.

【0028】また、システムI/Oエリア20の領域の
うちのD5000H番地〜D5FFFH番地の4Kバイ
ト分の領域は、後述するエラー検出専用に使用される領
域(エラー検出エリア)32である。エラー検出エリア
32は、コード領域24、データ領域26、スタック領
域28等としては使用できないようになっている。つま
り、プログラマによっては決して使用できない領域であ
る。
In the system I / O area 20, the 4K-byte area at addresses D5000H to D5FFFH is an area (error detection area) 32 used exclusively for error detection, which will be described later. The error detection area 32 cannot be used as the code area 24, the data area 26, the stack area 28, or the like. In other words, this area is never usable by some programmers.

【0029】本実施例におけるパーソナルコンピュータ
は、日本電気(株)製のPC−9801シリーズのもの
であり、前記CPU10は、インテル社製8086系C
PUで80386以上のバージョン(80386,80
486,Pentium)のものである。80386以
上のバージョンのCPUは、後述するページング手段と
してのページングユニット13を内蔵しており、全ての
プログラムは、直接物理アドレスを指定して読み書きを
することが出来ないようにされている。
The personal computer in this embodiment is a PC-9801 series manufactured by NEC Corporation, and the CPU 10 is an 8086 series C manufactured by Intel Corporation.
80386 or higher version with PU (80386,80
486, Pentium). The CPUs of version 80386 and above have a built-in paging unit 13 as a paging means, which will be described later, and all programs cannot read or write by directly specifying a physical address.

【0030】つまり、CPU10中のCPUコア11か
らのアドレス出力の一部(本例ではA31〜A12の上
位20ビット)はこのページングユニット13に出力さ
れる。ページングユニット13では、CPUコア11か
ら出力されたアドレスを、ページテーブル15を参照し
て別のアドレスに変換し、アドレスバスABに出力す
る。また、A11〜A0の下位12ビットはページング
ユニット13を経由せず直接アドレスバスABに出力さ
れることとなる。なお、データ出力は全て(D31〜
0)直接アドレスバスABとの間で入出力される。
That is, part of the address output from the CPU core 11 in the CPU 10 (upper 20 bits of A31 to A12 in this example) is output to the paging unit 13. The paging unit 13 converts the address output from the CPU core 11 into another address by referring to the page table 15 and outputs the address to the address bus AB. Further, the lower 12 bits of A11 to A0 are directly output to the address bus AB without passing through the paging unit 13. All data output (D31 ~
0) Input / output directly to / from the address bus AB.

【0031】ページテーブル15は、仮想アドレスと物
理アドレスの対応関係を示すものであり、1仮想ページ
につき1エントリが存在する。このページテーブル15
は、CPU内部にレジスタとして持っているものもあれ
ば、メモリ上に持ちその先頭アドレスのみをレジスタで
持つCPUもある。メモリ上に持つ場合には、ページテ
ーブル15へのメモリアクセスは、CPUコア11の関
知しないタイミングでぺージングユニット13が自動的
に行なう。また、メモリ上にページテーブル15を持つ
場合には、必ずページテーブル用のキャッシュメモリが
CPU10内部に用意される。この場合、通常は64〜
256エントリ分のキャッシュが用意される。
The page table 15 shows the correspondence between virtual addresses and physical addresses, and one entry exists for each virtual page. This page table 15
Some have a register inside the CPU, and some have a first address in the register on a memory. When the page table 15 is stored in the memory, the paging unit 13 automatically accesses the page table 15 at a timing that the CPU core 11 does not know. Further, when the page table 15 is provided on the memory, a cache memory for the page table is always prepared inside the CPU 10. In this case, normally 64 ~
A cache for 256 entries is prepared.

【0032】例えば、仮想アドレス0000C000H
〜0000CFFFHの4Kバイトが、物理アドレス2
FEC7000H〜2FEC7FFFHに割り付けられ
ていたら、プログラムから仮想アドレス0C123Hを
アクセスすると、物理アドレス2FEC7123H番地
をアクセスすることになる。
For example, virtual address 0000C000H
4K bytes of ~ 0000CFFFH is the physical address 2
If the virtual address 0C123H is accessed from the program if it is allocated to FEC7000H to 2FEC7FFFH, the physical address 2FEC7123H will be accessed.

【0033】ページングユニット13は、いわゆるマル
チタスクでプログラムを動かす場合に、実際には異なる
アドレス(物理アドレス)にロードされているプログラ
ムをあたかも同じアドレス(仮想アドレス)にロードさ
れているように見せかけるのに使われるハードウェアで
ある。タスクをスイッチする際にページテーブル15を
書き換えることで、上記処理が可能となる。
The paging unit 13 makes the programs actually loaded at different addresses (physical addresses) appear to be loaded at the same addresses (virtual addresses) when the programs are operated by so-called multitasking. Is the hardware used for. The above processing becomes possible by rewriting the page table 15 when switching the task.

【0034】そして、本実施例のページングユニット1
3は仮想記憶システム対応のページングユニットであ
る。仮想記憶は大規模なマルチタスクOSでは一般的で
あり、補助記憶装置であるハードディスク等を仮想的に
メモリに見立て、見かけ上のメモリが実装されているメ
モリよりも大きく見せる手法である。仮想記憶を実現す
るには、仮想記憶システム対応のページングユニットが
必要であり、本実施例のページングユニット13は仮想
記憶システム対応のページングユニットなのである。
Then, the paging unit 1 of this embodiment
Reference numeral 3 is a paging unit compatible with the virtual storage system. Virtual memory is generally used in a large-scale multitasking OS, and is a method in which a hard disk or the like, which is an auxiliary storage device, is virtually regarded as a memory and the apparent memory is made larger than the mounted memory. In order to realize the virtual memory, a paging unit compatible with the virtual memory system is required, and the paging unit 13 of this embodiment is a paging unit compatible with the virtual memory system.

【0035】この仮想記憶システム対応のページングユ
ニット13は、上記基本的な機能に加えて、CPUコア
11に対してページフォールト例外処理要求信号を発生
させる機能も備えている。この例外処理は割込み処理と
類似しているが、割込み処理が現在実行中の処理を終了
してから割込み処理ルーチンに制御移行させるのに対し
て、例外処理は現在実行中の処理を中止して例外処理ル
ーチンに制御移行される。このため、割込み処理では割
込みが掛かった次の命令から実行が開始されるが、例外
処理では例外が発生したとき実行中だった命令から実行
が再開される。
The paging unit 13 compatible with the virtual memory system has a function of generating a page fault exception handling request signal to the CPU core 11 in addition to the above basic functions. This exception process is similar to the interrupt process, but the interrupt process terminates the process currently being executed and then transfers control to the interrupt processing routine, while the exception process cancels the process currently being executed. Control is transferred to the exception handling routine. Therefore, in the interrupt processing, the execution is started from the next instruction that is interrupted, but in the exception processing, the execution is restarted from the instruction that was being executed when the exception occurred.

【0036】このように、CPUコア11からこのペー
ジングユニット13をコントロールして、仮想アドレス
の物理アドレスへの割り当て状態を読みとったり、設定
したりできる。しかし、80386CPUは特権レベル
と言うものを持っている。ページングユニット13のコ
ントロールは、特権レベル「0」のプログラムからしか
行うことができない。MS−DOSを使用する場合は、
DOSを含めて通常のプログラムは特権レベル「3」で
動作するので、ページングユニット13のコントロール
は不可能である。
In this way, the CPU core 11 can control the paging unit 13 to read or set the allocation state of the virtual address to the physical address. However, the 80386 CPU has what is called a privilege level. The paging unit 13 can be controlled only by a program of privilege level "0". When using MS-DOS,
Since a normal program including DOS operates at the privilege level "3", the paging unit 13 cannot be controlled.

【0037】また、MS−DOSを使用する場合は、D
OSを含めて通常のプログラムは、仮想86モードと言
う8086の動作をエミュレーションするモードで動作
するため、32ビットある仮想アドレスのうち20ビッ
トしか使用できない。これは8086の命令形態が20
ビットのアドレスしか生成できないためである。つま
り、DOSを含めて通常のプログラムは、仮想アドレス
の00000000H〜000FFFFFHにしかアク
セスすること事ができない。仮想アドレス001000
00H〜FFFFFFFFHは8086と互換性の無い
80386独自のモード(プロテクトモードと呼ばれて
いる。)でしかアクセス出来ないが、MS−DOSは8
086のOSであるため、これをサポートしていない。
When MS-DOS is used, D
Since a normal program including the OS operates in a mode that emulates the operation of 8086 called virtual 86 mode, only 20 bits of the virtual address of 32 bits can be used. This is the command form of 8086 is 20
This is because only bit addresses can be generated. That is, a normal program including DOS can access only virtual addresses 00000000H to 000FFFFFH. Virtual address 001000
00H to FFFFFFFFH can be accessed only in a mode unique to 80386 (called a protect mode) that is not compatible with 8086, but MS-DOS has 8
Since it is a 086 OS, this is not supported.

【0038】しかし、実際にはページングユニット13
の管理は必要不可欠で有るので、80386CPUでM
S−DOSを動かす場合、DOSとは別にページングユ
ニット13を管理するためのシステムプログラムが用意
される。このシステムプログラムは、8086とは互換
性のない80386独自のモードで動き、かつ特権レベ
ル「0」で動作する。
However, in practice, the paging unit 13
Since the management of the
When operating the S-DOS, a system program for managing the paging unit 13 is prepared separately from the DOS. This system program operates in an 80386-specific mode that is incompatible with the 8086, and operates at the privilege level “0”.

【0039】ここで重要なのは、本実施例のページング
ユニット13は仮想記憶システム対応であるため、ペー
ジ不在、つまり「仮想アドレスのある4Kバイトは物理
アドレスのどこにも割り付けられていないと」いう設定
が可能なことである。図3に示した80386CPUの
ページテーブルエントリ(PTE)を参照して説明す
る。なお、80386CPUのページテーブルはメモリ
上に置かれ、CR3と呼ばれるレジスタからページテー
ブルメモリ上の位置が決められる。タスクスイッチの際
はCR3を変更するだけでページテーブル全体が変化す
る。
What is important here is that since the paging unit 13 of this embodiment is compatible with the virtual storage system, the page does not exist, that is, the setting that "4 Kbytes with a virtual address is not allocated to any physical address" is set. It is possible. Description will be made with reference to the page table entry (PTE) of the 80386 CPU shown in FIG. The page table of the 80386 CPU is placed on the memory, and the position on the page table memory is determined by a register called CR3. At the time of task switching, only CR3 is changed to change the entire page table.

【0040】仮想アドレス4Kに付き1個、図3に示す
ようなページテーブルエントリが用意される。ページテ
ーブルエントリのうち上位20ビットは物理アドレスの
上位20ビット(A32〜A12)が書き込まれる。仮
想アドレスの上位20ビットが、このページテーブルエ
ントリの上位20ビットにすりかわって物理アドレスと
してCPUの外部に出力される。ページテーブルエント
リの下位12ビットは各種のシステム情報を格納するエ
リアであるが、このうち最下位ビット(ビット0)はP
ビットと呼ばれ、このPビットが「1」の場合はページ
が存在するとみなされ通常にメモリなどがアクセスされ
るが、このPビットが「0」の場合はページ不在とみな
される。
One page table entry as shown in FIG. 3 is prepared for each virtual address 4K. In the upper 20 bits of the page table entry, the upper 20 bits (A32 to A12) of the physical address are written. The upper 20 bits of the virtual address replaces the upper 20 bits of the page table entry and is output as a physical address to the outside of the CPU. The lower 12 bits of the page table entry is an area for storing various system information, of which the least significant bit (bit 0) is P
When the P bit is "1", the page is considered to exist and the memory or the like is normally accessed. When the P bit is "0", the page is considered to be absent.

【0041】そして、ページ不在(Pビットが0)の仮
想アドレスにアクセスする命令を実行しようとすると、
その命令が実行される前にページングユニット13から
CPUコア11に対して「ページフォールト」と呼ばれ
る例外処理要求が発生して、ページングユニット13を
管理するシステムプログラムに制御が移される。この場
合、一般にスワップと呼ばれる処理が実行されることと
なる。
When an instruction to access the virtual address of page fault (P bit is 0) is executed,
Before the instruction is executed, an exception processing request called “page fault” is generated from the paging unit 13 to the CPU core 11, and control is transferred to the system program that manages the paging unit 13. In this case, a process generally called swap is executed.

【0042】なお、ページテーブルエントリの下位12
ビットは各種のシステム情報を格納するエリアであり、
最下位ビットがPビットであることは説明したが、他に
は、Aビット、Dビット、Sビット、Wビットがある。
Dビットはその仮想アドレスに書込がされると「1」に
なるビットであり、Sビットはここが「1」だとOSか
らしかアクセスできないビットであり、Wビットはここ
が「1」だと読み込みはできるが書込みができないビッ
トである。
The lower 12 pages of the page table entry
Bits are areas that store various system information,
Although it has been described that the least significant bit is P bit, there are A bit, D bit, S bit and W bit in addition to the above.
The D bit is a bit that becomes "1" when written to the virtual address, the S bit is a bit that can be accessed only by the OS when this is "1", and the W bit is "1" here. Is a bit that can be read but not written.

【0043】Aビットは、そのエントリに対する仮想ア
ドレスがCPUコア11からアクセスされた場合に
「0」から「1」になるビットである。CPUコア11
は定期的にAビットを調べてどこの仮想アドレスが多く
使用されているかを把握する。Aビットは「0」から
「1」へは自動的に変化するが、「1」から「0」へは
プログラムが戻すまで変化しない。
The A bit is a bit which changes from "0" to "1" when the virtual address for the entry is accessed from the CPU core 11. CPU core 11
Periodically checks the A bit to find out which virtual address is frequently used. The A bit automatically changes from "0" to "1", but does not change from "1" to "0" until the program returns.

【0044】CPUコア11は、どの仮想アドレスが多
く使用されているかをAビットによって把握しているの
で、使用率の低い仮想アドレスをディスク上に書込み、
内容を保存した上で、ページテーブルのPビットを
「0」にする。これにより今までその仮想アドレスが使
用していた物理アドレスが未使用状態になるので、ペー
ジフォールトが発生した命令がアクセスしようとした仮
想アドレスを、その物理アドレスに割り当てる。そし
て、ディスク上から以前保存した、その仮想アドレスの
内容を読み出してPビットを「1」にする。これがスワ
ップ処理の具体的な処理内容である。例外処理ルーチン
から復帰すると、例外処理を発生させた命令が再度実行
されるが、今度はアクセスする仮想アドレスのPビット
が「1」に変化しているので、ページフォールトは発生
しないのである。
Since the CPU core 11 knows which virtual address is used a lot by the A bit, the virtual address having a low usage rate is written on the disk.
After saving the contents, the P bit of the page table is set to "0". As a result, the physical address used by that virtual address until now becomes unused, so the virtual address that the instruction that caused the page fault tried to access is assigned to that physical address. Then, the contents of the previously stored virtual address are read from the disk and the P bit is set to "1". This is the specific processing content of the swap processing. When returning from the exception handling routine, the instruction that caused the exception handling is executed again, but since the P bit of the virtual address to be accessed has changed to "1" this time, no page fault occurs.

【0045】例外処理ルーチンでのスワップ処理は、O
S等のシステムプログラムが行なうので、実際にはスワ
ップ処理が発生していても、ユーザプログラムからは途
中でページフォールトが発生してスワップ処理が行われ
ていることは認識できない。このため、見かけ上メモリ
が増えたように見え、これが仮想記憶と呼ばれる手法の
全容である。
The swap processing in the exception processing routine is O
Since the system program such as S performs the swap processing, the user program cannot recognize that the page processing occurs and the swap processing is being performed even if the swap processing is actually occurring. Therefore, it seems that the memory has increased, and this is the whole of the method called virtual memory.

【0046】そして、本実施例では、この機能を利用し
て、プログラムの開始時に、エラー検出エリア32(D
5000H番地〜D5FFFH番地の4Kバイト分の領
域)をページ不在の設定(Pビットが0)にしておくと
共に、プログラムの開始時にシステムプログラムに対し
て、エラー検出専用アドレスとエラー発生時のジャンプ
先を指示するのである。なお、このような指示を受け付
ける機能を持ったシステムプログラムは従来は存在して
いない。
In this embodiment, this function is utilized to start the program and to detect the error detection area 32 (D
Set the page absent setting (P bit is 0) in the area from 5000H to D5FFFH for 4K bytes, and set the error detection dedicated address and the jump destination when an error occurs to the system program when the program starts. Instruct. Conventionally, there is no system program having a function of receiving such an instruction.

【0047】これにより、エラー検出エリア32に読み
書きが実行されようとすると、その命令が実行される前
に例外処理が発生して、ページングユニット13を管理
するシステムプログラムに制御が移る。システムプログ
ラムは、「ページフォールト」が発生したアドレスを調
査する。上記エラー検出エリア32内のアドレス以外に
も「ページフォールト」が発生することがあるからであ
る。調査の結果「ページフォールト」の発生アドレスが
エラー検出エリア32内のアドレスだった場合は、予め
指示されたアドレスにジャンプする。
As a result, when reading or writing is attempted to be executed in the error detection area 32, exception processing occurs before the instruction is executed, and control is transferred to the system program managing the paging unit 13. The system program investigates the address where the "page fault" occurred. This is because a "page fault" may occur in addition to the address in the error detection area 32. If the result of the investigation indicates that the address where the "page fault" occurred is an address within the error detection area 32, the address jumps to the address designated in advance.

【0048】ジャンプ先ではポインタ変数が初期化され
ずに使用されたことを画面に表示して、プログラムの強
制終了処理が行われる。また、正常終了、エラー終了に
関わらず、プログラム終了時には、システムプログラム
に対して、エラー検出エリアの無効化とエラー発生時の
ジャンプ先の取り消しを指示する必要がある。
At the jump destination, the fact that the pointer variable has been used without being initialized is displayed on the screen, and the forced termination processing of the program is performed. In addition, regardless of normal termination or error termination, it is necessary to instruct the system program to invalidate the error detection area and cancel the jump destination when an error occurs when the program ends.

【0049】以上のように構成されたパーソナルコンピ
ュータにおける作動を説明する。C言語によって作成さ
れたソースプログラムがオブジェクトプログラムに翻訳
され、このオブジェクトプログラムが実行される。オブ
ジェクトプログラムの実行時にソースプログラムにプロ
グラムエラー(ポインタ変数のポインタ値の初期化し忘
れ)があることが検出されれば、そのことが、CRT表
示装置60に表示され、オペレータに知らされる。
The operation of the personal computer configured as above will be described. A source program created in C language is translated into an object program, and this object program is executed. If it is detected that the source program has a program error (forgetting to initialize the pointer value of the pointer variable) during the execution of the object program, the fact is displayed on the CRT display device 60 and the operator is notified.

【0050】図4には、ソースプログラムを表すプログ
ラムコードが示されている。ソースプログラムは、PC
9801シリーズ用のMS−DOS上で作成されたもの
である。ソースプログラムコードの詳細な説明は省略す
るが、図には、2個の関数uekansu ,関数sitakansu が
定義されているが、関数uekansu が実行される場合に関
数sitakansu が呼び出されるようにされている。
FIG. 4 shows a program code representing a source program. Source program is PC
It was created on the MS-DOS for the 9801 series. Although a detailed description of the source program code is omitted, although two functions uekansu and sitakansu are defined in the figure, the function sitakansu is called when the function uekansu is executed.

【0051】第1行目、第3行目、第m+1行目、第m
+3行目等に記載されたコード「int 」は、各変数、関
数の返値等が整数型であることを宣言するコードであ
る。このように、各変数、関数の返値等が単にint 型で
あると宣言されている場合には、これらが自動変数であ
ることを表しており、図2のスタック領域28が使用さ
れることになる。第m+3行目においてint 型であると
宣言されたポインタ変数*poi は自動変数とされてい
る。
First line, third line, m + 1th line, mth line
The code “int” described in the + 3rd line and the like is a code that declares that each variable, the return value of the function, and the like are of the integer type. As described above, when each variable, the return value of the function, or the like is simply declared as an int type, it indicates that these are automatic variables, and the stack area 28 in FIG. 2 is used. become. The pointer variable * poi declared to be an int type in the m + 3th line is an automatic variable.

【0052】ポインタ変数「*poi 」は、ポインタ値po
i によって指定されたアドレスにあるデータを表した
り、ポインタ値poi によって指定されたアドレスに書き
込むデータを表したりする。第m+n行目のポインタ変
数*poi は後者、すなわち、ポインタ値poi で指定され
たアドレスに書き込むデータが123であることを表し
ている。したがって、プログラマは、ポインタ変数*po
i を書き込むアドレスを表すポインタ値(アドレス値)
poi を、第m+n行目が実行される以前の部分Rにおい
て必ず設定しなければならない。このように、ポインタ
変数*poi を書き込むアドレスを表すポインタ値poi を
設定することをポインタ変数のポインタ値の初期化を行
うと称する。
The pointer variable "* poi" is the pointer value po.
Represents the data at the address specified by i, or the data to write at the address specified by the pointer value poi. The pointer variable * poi in the (m + n) th row represents the latter, that is, 123 is the data to be written at the address designated by the pointer value poi. Therefore, the programmer uses the pointer variable * po
Pointer value (address value) that represents the address to write i
poi must be set in the part R before the m + nth line is executed. In this way, setting the pointer value poi representing the address to write the pointer variable * poi is called initialization of the pointer value of the pointer variable.

【0053】仮に、ポインタ値poi の初期化が行われな
いでポインタ変数*poi だけが設定されても、データを
どのアドレスに対して書き込むのかわからないことにな
る。そのため、書込みがMS−DOS領域23内のアド
レスに対して行われた場合には、OSが破壊されてしま
い、コード領域24内のアドレスに対して行われた場合
には、プログラムが破壊されてしまう問題が生じる。ま
た、未使用領域50内のアドレスに対して行われた場合
には、プログラムは問題なく実行されるが、納得できな
い結果が出力されてしまうのである。
Even if only the pointer variable * poi is set without initializing the pointer value poi, it is not known to which address the data will be written. Therefore, when the writing is performed to the address in the MS-DOS area 23, the OS is destroyed, and when the writing is performed to the address in the code area 24, the program is destroyed. There is a problem. Further, when the program is executed for the address in the unused area 50, the program is executed without any problem, but an unsatisfactory result is output.

【0054】図4に示すソースプログラムコードにおい
ては、ポインタ変数*poi は設定されているが、ポイン
タ値poi の初期化を行うことが忘れられている。つまり
プログラムエラーを含んだ状態である。このソースプロ
グラムコードが翻訳されると、図5に示すオブジェクト
プログラムコードになる。
In the source program code shown in FIG. 4, the pointer variable * poi is set, but it is forgotten to initialize the pointer value poi. In other words, it is a state that includes a program error. When this source program code is translated, it becomes the object program code shown in FIG.

【0055】図5のオブジェクトプログラムについて簡
単に説明する。部分60には関数uekansu の実行の開始
時に行われる命令が表されている。ベースポインタ「b
p」及びスタックポインタ「sp」が退避させられるの
である。ライン62には自動変数領域を6バイト確保す
る命令が表され、部分64には関数sitakansu をコール
する命令が表されている。ライン66には関数uekansu
の返値0をAXレジスタに格納する命令が表され、部分
68には関数uekansu の実行の終了時に行われる命令が
表されている。退避していたベースポインタ「bp」及
びスタックポインタ「sp」が戻されるのである。
The object program shown in FIG. 5 will be briefly described. The portion 60 represents an instruction executed at the start of execution of the function uekansu. Base pointer "b
The p "and stack pointer" sp "are saved. The line 62 shows an instruction to secure an automatic variable area of 6 bytes, and the portion 64 shows an instruction to call the function sitakansu. In line 66 the function uekansu
Is stored in the AX register, and the portion 68 shows the instruction executed at the end of the execution of the function uekansu. The saved base pointer "bp" and stack pointer "sp" are returned.

【0056】以下、同様に、部分70にはベースポイン
タ「bp」及びスタックポインタ「sp」を退避させる
命令が表されている。ライン72には自動変数領域を1
2バイト確保する命令が、部分74には関数sitakansu
の実行を行う命令が、ライン76には関数sitakansu の
返値をAXレジスタに格納する命令がそれぞれ表されて
いる。また、部分78にはベースポインタ「bp」及び
スタックポインタ「sp」を戻す命令が表されているの
である。
Similarly, in the portion 70, an instruction for saving the base pointer "bp" and the stack pointer "sp" is shown below. 1 automatic variable area on line 72
The instruction to reserve 2 bytes is the function sitakansu in part 74.
In the line 76, an instruction for executing the execution of the above is stored, and an instruction for storing the return value of the function sitakansu in the AX register is shown. In addition, the portion 78 represents an instruction for returning the base pointer "bp" and the stack pointer "sp".

【0057】図4から明らかなように、ソースプログラ
ムにおいてはポインタ変数*poi が自動変数とされてい
る。そのため、図5において実線で囲んだ部分Sに示す
ように、オブジェクトプログラムには、ポインタ変数*
poi のポインタ値poi を「D500:0800番地」と
して設定する命令が自動的に追加される。「D500:
0800番地」は、図6に示すように、セグメント空間
で表された場合のポインタ値であるため、仮想アドレス
空間におけるポインタ値に直せば、D5800H番地と
なり、前述のエラー検出エリア32に含まれることが明
らかである。本実施例においては、ポインタ値poi がエ
ラー検出エリア32の中間に設定されたのである。ま
た、図6のSSはセグメントを表している。なお、図4
に示すC言語によるプログラムを図5に示すアセンブラ
プログラムにコンパイルしたとき、通常のコンパイラで
は図5中の部分Sは付加されないのであるが、本実施例
のCコンパイラでは図5中の部分Sは付加される。
As is apparent from FIG. 4, the pointer variable * poi is an automatic variable in the source program. Therefore, as shown by a portion S surrounded by a solid line in FIG.
An instruction to set the pointer value poi of poi as "D500: 0800" is automatically added. "D500:
As shown in FIG. 6, "0800 address" is a pointer value in the case of being expressed in the segment space. Therefore, if it is corrected to a pointer value in the virtual address space, it becomes address D5800H, which is included in the error detection area 32 described above. Is clear. In this embodiment, the pointer value poi is set in the middle of the error detection area 32. Further, SS in FIG. 6 represents a segment. FIG.
When the program in the C language shown in FIG. 5 is compiled into the assembler program shown in FIG. 5, the part S in FIG. 5 is not added by the normal compiler, but the part S in FIG. 5 is added by the C compiler of this embodiment. To be done.

【0058】次に、図5のオブジェクトプログラムコー
ドの実行を、図7のフローチャートに従って説明する。
なお、図5では、ユーザモードによるオブジェクトプロ
グラム実行処理を破線より左側に記載し、スーパーバイ
ザモードによるシステムプログラム実行処理を破線より
右側に記載する。
Next, the execution of the object program code shown in FIG. 5 will be described with reference to the flowchart shown in FIG.
In FIG. 5, the object program execution process in the user mode is shown on the left side of the broken line, and the system program execution process in the supervisor mode is shown on the right side of the broken line.

【0059】オブジェクトプログラム実行処理における
最初のステップ1(以下、単にS1で表す。他のステッ
プについても同様。)では初期設定がなされる。この初
期設定においてスーパーバイザモードによるシステムプ
ログラムがコールされ、S101の処理がなされる。
In the first step 1 in the object program execution processing (hereinafter, simply represented by S1; the same applies to other steps), initialization is performed. In this initialization, the system program in the supervisor mode is called, and the process of S101 is performed.

【0060】S101では、次の〜の処理がなされ
る。すなわち、エラー検出エリアを指定して有効フラ
グを1にし、そのエリアのアドレスの記憶、Pビット
のクリア(つまりPビットを0にする)、エラー発生
時のジャンプアドレスの設定、を行なう。このS101
の処理が終了すると、オブジェクトプログラム実行処理
のS1にリターンする。
At S101, the following processes 1 to 3 are performed. That is, the error detection area is designated, the valid flag is set to 1, the address of the area is stored, the P bit is cleared (that is, the P bit is set to 0), and the jump address when an error occurs is set. This S101
When the process of (1) is completed, the process returns to S1 of the object program execution process.

【0061】続くS2では関数uekansu が呼び出され、
S3においては関数sitakansu が呼び出される。そし
て、S4では図5における部分74が実行され、S5に
おいてはポインタ変数*poi の書込み指令(WT)が発
せられる。本実施例においては、図5における部分Sに
おいて、ポインタ変数*poi のポインタ値poi がエラー
検出エリア32内のD5800H番地に設定されるた
め、仮想アドレスD5800H番地に対する書き込み処
理が実行されようとするために、ページフォールト例外
が発生する。
In the subsequent S2, the function uekansu is called,
In S3, the function sitakansu is called. Then, in S4, the portion 74 in FIG. 5 is executed, and in S5, the write command (WT) of the pointer variable * poi is issued. In the present embodiment, since the pointer value poi of the pointer variable * poi is set to the address D5800H in the error detection area 32 in the portion S in FIG. 5, the writing process to the virtual address D5800H is about to be executed. Then, a page fault exception occurs.

【0062】つまり、部分Sにおいてポインタ値poi が
D5800H番地に設定されるが、プログラマによって
ポインタ値が設定されていないため(ソースプログラム
には、ポインタ値を設定する命令がないため)、この値
は変更されない。そのため、エラー検出エリア32内の
アドレスに対する書込みを指令する命令が実行されよう
とするために、ページフォールト例外が発せられるので
ある。このページフォールト例外が発せられた場合に
は、システムプログラム実行処理におけるS111の処
理が実行される。S111では、その例外処理の発生要
因がエラー検出エリアによるものかどうかを判断し、例
外処理の発生要因がエラー検出エリアによるものではな
い場合には、S112へ移行し、通常のページフォール
ト例外処理を実行する。このS112での通常のページ
フォールト例外処理の内容は、上述したスワップ処理で
あるので、ここでは繰り返し説明しない。
That is, the pointer value poi is set to the address D5800H in the part S, but the pointer value is not set by the programmer (since there is no instruction for setting the pointer value in the source program), this value is Not changed Therefore, a page fault exception is issued because an instruction to write to an address in the error detection area 32 is about to be executed. When this page fault exception is issued, the processing of S111 in the system program execution processing is executed. In S111, it is determined whether or not the cause of the exception processing is due to the error detection area. If the cause of the exception processing is not due to the error detection area, the process proceeds to S112 and normal page fault exception processing is performed. Run. The content of the normal page fault exception processing in S112 is the swap processing described above, and therefore will not be repeated here.

【0063】一方、例外処理の発生要因がエラー検出エ
リアによるものである場合には、S113へ移行し、リ
ターンアドレスを、上記S101ので設定されたエラ
ー発生時のジャンプアドレスに書き換える。S113の
処理の終了後は、その書き換えられたジャンルアドレス
にリターンするため、オプジェクトプログラムのS11
へ移行する。
On the other hand, when the cause of the exception processing is due to the error detection area, the process proceeds to S113, and the return address is rewritten to the jump address at the time of error occurrence set in S101. After the processing of S113 is completed, the program is returned to the rewritten genre address.
Move to.

【0064】S11では、オブジェクトプログラムの実
行を強制的に終了し、続くS12ではCRT表示装置6
0に「ポインタ変数が初期化されていません」とのエラ
ー表示を出す。オペレータは、この表示を見れば、プロ
グラムエラーがあることが判る。
In S11, the execution of the object program is forcibly terminated, and in the subsequent S12, the CRT display device 6
The error display "The pointer variable is not initialized" is displayed in 0. The operator can see from this display that there is a program error.

【0065】そして、S13では設定解除処理を行な
う。この設定解除処理においてスーパーバイザモードに
よるシステムプログラムがコールされ、S121の処理
がなされる。S121では、エラー検出エリアの無効
化(有効フラグを0にする)と、Pビットのセット
(つまりPビットを1にする)が行われる。S121の
処理が終了すると、オブジェクトプログラム実行処理の
S13にリターンする。
Then, in S13, a setting cancellation process is performed. In this setting cancellation processing, the system program in the supervisor mode is called, and the processing of S121 is performed. In S121, the error detection area is invalidated (the valid flag is set to 0) and the P bit is set (that is, the P bit is set to 1). When the process of S121 ends, the process returns to S13 of the object program execution process.

【0066】なお、S5において、ページフォールト例
外処理が発生しない場合には、S6,S7にて関数sita
kansu 及び関数uekansu が戻され、S8で設定解除がな
される。このS8での設定解除の内容は、S13での設
定解除と同じであり、やはりスーパーバイザモードによ
るシステムプログラムがコールされ、S131にて、
エラー検出エリアの無効化(有効フラグを0にする)
と、Pビットのセット(つまりPビットを1にする)
が行われ、S8へリターンする。
If the page fault exception handling does not occur in S5, the function sita is used in S6 and S7.
kansu and the function uekansu are returned, and the setting is canceled in S8. The contents of the setting release in S8 are the same as the setting release in S13, and the system program in the supervisor mode is also called, and in S131,
Disable error detection area (set valid flag to 0)
And set P bit (that is, set P bit to 1)
Is performed and the process returns to S8.

【0067】このように、本実施例においては、ポイン
タ変数*poi の書込みが実際に行われる以前、すなわ
ち、図2におけるエラー検出エリア32内のアドレスを
指定する信号と書込みを指令する信号とが発せられた時
点において、オブジェクトプログラムの実行が中断させ
られるため、実際には、ポインタ変数*poi の書込みは
行われない。しかし、仮に、書込みが実際に行われたと
しても、ポインタ値poiが、前述のようにプログラマに
よっては使用されないエラー検出のためのエラー検出エ
リア32内に設定されているため、他のプログラムコー
ド等が破壊されることが回避される。また、ポインタ値
poi がエラー検出エリア32の中間に設定されているた
め、ポインタ値poi の前後2Kバイトの領域に対して読
み書き指令が発せられた場合に、エラー信号が発せられ
るようになっている。
As described above, in this embodiment, before the pointer variable * poi is actually written, that is, the signal for designating the address in the error detection area 32 and the signal for instructing the writing in FIG. Since the execution of the object program is suspended at the point of time when it is issued, the pointer variable * poi is not actually written. However, even if writing is actually performed, since the pointer value poi is set in the error detection area 32 for error detection that is not used by the programmer as described above, other program code, etc. Is prevented from being destroyed. Also, the pointer value
Since poi is set in the middle of the error detection area 32, an error signal is issued when a read / write command is issued to the area of 2 Kbytes before and after the pointer value poi.

【0068】一方、ソースプログラムの部分R(図4参
照)においてポインタ値aがプログラマによって設定さ
れている場合には、図7のS5において、その設定され
たポインタ値aが表すアドレスに対してポインタ変数*
poi の書込みが行われることになる。そのため、エラー
検出エリア32内のアドレスを表すポインタ値を指定す
る書き込み処理が発せられることはないため、ページフ
ォールト例外処理が発せられることはない。
On the other hand, when the pointer value a is set by the programmer in the portion R (see FIG. 4) of the source program, the pointer to the address indicated by the set pointer value a is set in S5 of FIG. variable*
The poi will be written. Therefore, the write process for designating the pointer value indicating the address in the error detection area 32 is not issued, so that the page fault exception process is not issued.

【0069】以上のように、本実施例においては、プロ
グラムエラー(詳しくはポインタ変数*poi のポインタ
値poi の初期化し忘れ)をCPU10内部のページング
ユニット13を用いて検出することができる。つまり、
ページングユニット13を制御する権利を持つシステム
プログラムに対して一般アプリケーションから所定の処
理を行い、ページングユニット13の一機能を利用して
プログラムエラーの検出ができるのである。
As described above, in this embodiment, a program error (specifically, forgetting to initialize the pointer value poi of the pointer variable * poi) can be detected by using the paging unit 13 inside the CPU 10. That is,
A general application can perform a predetermined process on a system program having a right to control the paging unit 13, and a function of the paging unit 13 can be used to detect a program error.

【0070】また、そのプログラムエラーの検出が、構
文解析によらず、ハードで構成されたページングユニッ
ト13を利用することによって行われるため、検出速度
の向上及び確実な検出を実現することができると共に、
本来は仮想記憶システムの実現のために用いられるペー
ジングユニット13の一機能を利用してプログラムエラ
ーの検出ができるので、特別なハードの追加が必要なく
なるのである。
Further, since the detection of the program error is performed by utilizing the paging unit 13 made up of hardware, not by the syntax analysis, the detection speed can be improved and the reliable detection can be realized. ,
Since a program error can be detected by utilizing one function of the paging unit 13 which is originally used for realizing the virtual memory system, it is not necessary to add special hardware.

【0071】なお、上述した例では、エラー検出時の対
応処理として、コンパイラによって翻訳されたオブジェ
クトプログラムの一部として設定されている所定の強制
終了処理ルーチンに基づいて、オブジェクトプログラム
自身を強制終了させるよう構成し、さらにCRT表示装
置60にエラー表示をするようにしたが、単に強制終了
だけさせるようにし、例えば取扱説明書等に強制終了の
原因がプログラムエラーであることが記載されていれ
ば、オペレータはその取扱説明書を見ることでプログラ
ムエラーがあることを知ることができるようにすること
も考えられる。
In the above-described example, the object program itself is forcibly terminated based on a predetermined forcible termination processing routine set as a part of the object program translated by the compiler, as a response process when an error is detected. The CRT display device 60 is configured to display an error, and the CRT display device 60 is configured to display an error. However, if the cause of the forced end is a program error, for example, if the cause of the forced end is a program error, It is conceivable that the operator can know that there is a program error by looking at the instruction manual.

【0072】また、システムプログラム自身の一部とし
て設定されている所定のエラー発生報知処理ルーチンに
基づいて、ソースプログラムにおけるポインタ変数のポ
インタ値の初期化し忘れに起因するプログラムエラー発
生をオペレータに報知する所定の処理を実行するよう構
成してもよい。そして、報知する所定の処理としては、
上記実施例のようにプログラムエラーが存在する旨をC
RT表示装置60に表示させる以外にも、報知ブザーを
発音させたり、報知ランプを点灯させたりすることが考
えられる。
Further, based on a predetermined error occurrence notification processing routine which is set as a part of the system program itself, the operator is notified of the program error occurrence caused by forgetting to initialize the pointer value of the pointer variable in the source program. You may comprise so that a predetermined process may be performed. Then, as the predetermined process of notifying,
As in the above embodiment, the fact that a program error exists is indicated by C
In addition to displaying on the RT display device 60, it is conceivable to sound the notification buzzer or turn on the notification lamp.

【0073】なお、上記実施例において、ソースプログ
ラムコードをオブジェクトプログラムコードに変換する
部分が翻訳手段に相当し、ポインタ変数*poi のポイン
タ値をD58000H番地(D500:0800)に設
定する命令を自動的に追加する部分が自動初期化手段に
相当する。そして、この翻訳手段と自動初期化手段とを
合わせた部分がコンパイラに相当する。また、自動初期
化手段によって設定されたポインタ値(D5800H番
地)を含む予め定められた範囲のメモリエリア32(D
5000H番地〜D5FFFH番地)がエラー検出エリ
アに相当する。また、図7において、S1の初期設定に
てスーパーバイザモードによるシステムプログラムをコ
ールし、S101の処理を実行する部分が事前処理実行
手段による処理の実行に相当する。そして、S5にてペ
ージフォールト例外が発せられた場合、システムプログ
ラム実行処理におけるS111,S113の処理が実行
され、オプジェクトプログラムのS11へ移行して、S
11〜S13の処理を実行する部分が、エラー検出時対
応処理実行手段による処理の実行に相当する。
In the above embodiment, the portion for converting the source program code into the object program code corresponds to the translation means, and an instruction for automatically setting the pointer value of the pointer variable * poi to the address D58000H (D500: 0800) is automatically generated. The part added to corresponds to the automatic initialization means. And the part which combined this translation means and the automatic initialization means corresponds to a compiler. Further, the memory area 32 (D) in a predetermined range including the pointer value (address D5800H) set by the automatic initialization means
Addresses 5000H to D5FFFH) correspond to the error detection area. Further, in FIG. 7, the part that calls the system program in the supervisor mode in the initial setting of S1 and executes the process of S101 corresponds to the execution of the process by the preprocess executing means. If a page fault exception is issued in S5, the processes of S111 and S113 in the system program execution process are executed, and the process proceeds to S11 of the object program,
The part that executes the processes of 11 to S13 corresponds to the execution of the process by the error detection response process executing means.

【0074】なお、上記実施例ではプログラムの開始時
の初期設定において、システムプログラムに対してエラ
ー検出エリアとエラー発生時のジャンプ先を指示してい
るが、プログラム開始以前にエラー検出エリアを設定す
ることもできる。但しこの場合はプログラムのロード前
でプログラムの位置がまだ決定されていないので、シス
テムプログラム内部にエラーがあったことを表示する処
理と、プログラムを強制終了させる処理を組み込む必要
がある。
In the above embodiment, the error detection area and the jump destination when an error occurs are instructed to the system program in the initial setting at the start of the program, but the error detection area is set before the program starts. You can also However, in this case, since the position of the program has not yet been determined before loading the program, it is necessary to incorporate processing for displaying an error in the system program and processing for forcibly ending the program.

【0075】また、上記実施例においては、エラー検出
エリア32が、D5000H番地〜D5FFFH番地と
されていたが、他のエリアを設定してもよく、容量も4
Kバイトでなく他の大きさであってもよい。さらに、自
動初期化手段によって設定されるポインタ値がエラー検
出エリア32内のD5800H番地であったが、エラー
検出エリア32内であれば、どこであってもよい。
Further, in the above embodiment, the error detection area 32 is set to the addresses D5000H to D5FFFH, but other areas may be set and the capacity is 4 as well.
Other sizes may be used instead of K bytes. Further, the pointer value set by the automatic initialization means is the address D5800H in the error detection area 32, but any pointer value may be used as long as it is in the error detection area 32.

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

【図1】 本発明の一実施例であるプログラムエラー検
出装置を備えたパーソナルコンピュータの制御部の概略
構成を示すブロック図である。
FIG. 1 is a block diagram showing a schematic configuration of a control unit of a personal computer including a program error detection device according to an embodiment of the present invention.

【図2】 仮想アドレス空間として表されたRAMを示
す説明図である。
FIG. 2 is an explanatory diagram showing a RAM represented as a virtual address space.

【図3】 ページテーブルエントリの説明図である。FIG. 3 is an explanatory diagram of a page table entry.

【図4】 CPUによって翻訳されるソースプログラム
コードを示す説明図である。
FIG. 4 is an explanatory diagram showing a source program code translated by a CPU.

【図5】 図4のソースプログラムコードが翻訳されて
得られるオブジェクトプログラムコードを示す説明図で
ある。
5 is an explanatory diagram showing an object program code obtained by translating the source program code of FIG.

【図6】 RAMの説明図である。FIG. 6 is an explanatory diagram of a RAM.

【図7】 オブジェクトプログラムの実行過程を示して
おり、ユーザモードによるオブジェクトプログラム実行
処理を左側に記載し、スーパーバイザモードによるシス
テムプログラム実行処理を右側に記載したフローチャー
トである。
FIG. 7 is a flowchart showing an execution process of an object program, in which an object program execution process in a user mode is shown on the left side and a system program execution process in a supervisor mode is shown on the right side.

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

10…CPU 11…CPUコア 13…ページングユニット 15…ページテーブ
ル 20…システムI/Oエリア 23…MS−DOS
領域 24…コード領域 26…データ領域 28…スタック領域 32…エラー検出エ
リア 60…CRT表示装置 AB…アドレスバス DB…データバス
10 ... CPU 11 ... CPU core 13 ... Paging unit 15 ... Page table 20 ... System I / O area 23 ... MS-DOS
Area 24 ... Code area 26 ... Data area 28 ... Stack area 32 ... Error detection area 60 ... CRT display device AB ... Address bus DB ... Data bus

Claims (7)

【特許請求の範囲】[Claims] 【請求項1】 スタックエリアに自動変数をとるソース
プログラムの作成時に、ポインタ変数を自動変数としな
がらそのポインタ値の初期化をし忘れるプログラムエラ
ーを検出する装置であって、 前記ソースプログラムをオブジェクトプログラムに翻訳
する翻訳機能、及び前記ポインタ変数を自動変数とした
場合にオブジェクトプログラムにポインタ変数のポイン
タ値を所定のアドレス値に設定する命令を自動的に追加
する自動初期化機能とを備えたコンパイラと、 ページテーブルに基づき仮想アドレスを所定のページ単
位で物理アドレスに変換するアドレス変換機能を有し、
かつ仮想アドレスが物理アドレスのどこにも割り付けら
れていない場合にはページフォールトを発生させてシス
テムプログラムを呼び出す例外処理要求機能を有する仮
想記憶システム用のページング手段と、 前記コンパイラによって翻訳されたオブジェクトプログ
ラムの開始時またはプログラム開始以前に、システムプ
ログラムに対して、エラー検出エリアのアドレス設定と
エラー検出時の対応処理の設定を行う事前処理実行手段
と、 前記オブジェクトプログラムの実行時に、前記ページン
グ手段によって発生されたページフォールトの発生要因
が前記エラー検出エリアに対する読み書きによるもので
ある場合には、前記事前処理実行手段によって設定され
た所定のエラー検出時対応処理を実行するエラー検出時
対応処理実行手段とを備えることを特徴とするプログラ
ムエラー検出装置。
1. A device for detecting a program error that forgets to initialize a pointer value while using a pointer variable as an automatic variable when creating a source program that takes an automatic variable in a stack area, wherein the source program is an object program. And a compiler having an automatic initialization function for automatically adding an instruction for setting a pointer value of a pointer variable to a predetermined address value to an object program when the pointer variable is an automatic variable. , Has an address conversion function for converting a virtual address into a physical address in a predetermined page unit based on a page table,
And when the virtual address is not allocated to any of the physical addresses, a paging means for a virtual memory system having an exception handling request function that causes a page fault and calls a system program, and an object program translated by the compiler. At the start or before the start of the program, pre-processing execution means for setting the address of the error detection area and setting of the corresponding processing at the time of error detection for the system program, and generated by the paging means when the object program is executed When the cause of the page fault is due to reading / writing from / to the error detection area, an error detection response processing execution means for executing a predetermined error detection response processing set by the preprocessing execution means is provided. Prepare Program error detecting apparatus characterized by.
【請求項2】 前記ページング手段はCPUに内蔵され
ていることを特徴とする請求項1に記載のプログラムエ
ラー検出装置。
2. The program error detection device according to claim 1, wherein the paging means is built in a CPU.
【請求項3】 請求項1または2に記載のプログラムエ
ラー検出装置において、 前記エラー検出時対応処理実行手段は、前記コンパイラ
によって翻訳されたオブジェクトプログラムの一部とし
て設定されている所定の強制終了処理ルーチンに基づい
て、前記オブジェクトプログラム自身を強制終了させる
よう構成されていることを特徴とするプログラムエラー
検出装置。
3. The program error detection device according to claim 1, wherein the error detection response processing execution means is a predetermined forced termination process set as a part of the object program translated by the compiler. A program error detection device characterized in that it is configured to forcibly terminate the object program itself based on a routine.
【請求項4】 請求項1または2に記載のプログラムエ
ラー検出装置において、 前記エラー検出時対応処理実行手段は、前記コンパイラ
によって翻訳されたオブジェクトプログラムの一部ある
いはシステムプログラム自身の一部として設定されてい
る所定のエラー発生報知処理ルーチンに基づいて、前記
ソースプログラムにおけるポインタ変数のポインタ値の
初期化し忘れに起因するプログラムエラー発生をオペレ
ータに報知する所定の処理を実行するよう構成されてい
ることを特徴とするプログラムエラー検出装置。
4. The program error detection device according to claim 1, wherein the error detection response processing execution means is set as a part of the object program translated by the compiler or a part of the system program itself. Based on a predetermined error occurrence notification processing routine, it is configured to execute a predetermined process of notifying an operator of the occurrence of a program error caused by forgetting to initialize the pointer value of the pointer variable in the source program. Characteristic program error detection device.
【請求項5】 スタックエリアに自動変数をとるソース
プログラムをオブジェクトプログラムに翻訳する翻訳機
能、及び前記ポインタ変数を自動変数とした場合にオブ
ジェクトプログラムにポインタ変数のポインタ値を所定
のアドレス値に設定する命令を自動的に追加する自動初
期化機能とを備えたコンパイラと、 仮想アドレス空間でのアドレスを、所定のページ単位で
物理アドレス空間でのアドレスに変換するアドレス変換
機能を有し、かつ仮想アドレスがメモリ上にない場合に
はページングフォルトを発生させてシステムプログラム
を呼び出す例外処理要求機能を有する仮想記憶システム
用のページング手段とを備え、 前記ソースプログラムの作成時に、前記ポインタ変数を
自動変数としながらそのポインタ値の初期化をし忘れる
プログラムエラーを検出する方法であって、 前記コンパイラによって翻訳されたオブジェクトプログ
ラムの開始時またはプログラム開始以前に、システムプ
ログラムに対して、エラー検出エリアのアドレス設定と
エラー検出時の対応処理の設定を行い、 前記オブジェクトプログラムの実行時に、前記ページン
グ手段によって発生されたページングフォルトの発生要
因が前記エラー検出エリアに対する読み書きによるもの
である場合には、前記事前処理実行手段によって設定さ
れた所定のエラー検出時対応処理を実行することを特徴
とするプログラムエラー検出方法。
5. A translation function for translating a source program that takes automatic variables in a stack area into an object program, and when the pointer variable is an automatic variable, sets the pointer value of the pointer variable to a predetermined address value in the object program. A compiler that has an automatic initialization function that automatically adds instructions and an address conversion function that converts an address in the virtual address space into an address in the physical address space in units of a specified page, and also has a virtual address And a paging means for a virtual memory system having an exception handling request function that calls a system program by generating a paging fault when the source variable is created, while the pointer variable is an automatic variable. A program that forgets to initialize its pointer value Method for detecting a system error, at the time of starting the object program translated by the compiler or before the program starts, the address setting of the error detection area and the corresponding processing at the time of error detection are performed for the system program, When the cause of the paging fault generated by the paging means is due to reading and writing in the error detection area during execution of the object program, a predetermined error detection response set by the preprocessing execution means is handled. A program error detection method characterized by executing processing.
【請求項6】 請求項5に記載のプログラムエラー検出
方法において、 前記エラー検出時対応処理として、前記コンパイラによ
って翻訳されたオブジェクトプログラムの一部として設
定されている所定の強制終了処理ルーチンに基づき、前
記オブジェクトプログラム自身を強制終了させることを
特徴とするプログラムエラー検出装置。
6. The program error detection method according to claim 5, wherein, as the error detection response processing, a predetermined forced termination processing routine is set as a part of the object program translated by the compiler, A program error detection device characterized in that the object program itself is forcibly terminated.
【請求項7】 請求項5に記載のプログラムエラー検出
方法において、 前記エラー検出時対応処理として、前記コンパイラによ
って翻訳されたオブジェクトプログラムの一部あるいは
システムプログラム自身の一部として設定されている所
定のエラー発生報知処理ルーチンに基づいて、前記ソー
スプログラムにおけるポインタ変数のポインタ値の初期
化し忘れに起因するプログラムエラー発生をオペレータ
に報知することを特徴とするプログラムエラー検出方
法。
7. The program error detection method according to claim 5, wherein as the error detection response processing, a predetermined value set as a part of the object program translated by the compiler or a part of the system program itself is set. A program error detecting method for notifying an operator of a program error occurrence caused by forgetting to initialize a pointer value of a pointer variable in the source program based on an error occurrence notification processing routine.
JP7173375A 1995-07-10 1995-07-10 Device and method for detection of program error Pending JPH0926898A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP7173375A JPH0926898A (en) 1995-07-10 1995-07-10 Device and method for detection of program error

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP7173375A JPH0926898A (en) 1995-07-10 1995-07-10 Device and method for detection of program error

Publications (1)

Publication Number Publication Date
JPH0926898A true JPH0926898A (en) 1997-01-28

Family

ID=15959232

Family Applications (1)

Application Number Title Priority Date Filing Date
JP7173375A Pending JPH0926898A (en) 1995-07-10 1995-07-10 Device and method for detection of program error

Country Status (1)

Country Link
JP (1) JPH0926898A (en)

Similar Documents

Publication Publication Date Title
AU595224B2 (en) Improved virtual memory computer system
US6321314B1 (en) Method and apparatus for restricting memory access
US7467271B2 (en) Operating system permitting limited access to a system page
US5095526A (en) Microprocessor with improved interrupt response with interrupt data saving dependent upon processor status
US7451298B2 (en) Processing exceptions from 64-bit application program executing in 64-bit processor with 32-bit OS kernel by switching to 32-bit processor mode
EP0431467A1 (en) Multiprocessor system having distributed shared resources and dynamic global data replication
EP0213843A2 (en) Digital processor control
US7975260B1 (en) Method of direct access and manipulation of debuggee memory from debugger
JPH0782441B2 (en) Simulation method
EP1369787A2 (en) Processor device and information processing device, compiling device, and compiling method using said processor device
US6038631A (en) Data processing system and method using virtual storage system
TWI790350B (en) Controlling guard tag checking in memory accesses
JPH08147173A (en) Emulator
US6199156B1 (en) System for explicitly referencing a register for its current content when performing processor context switch
JP2005122334A (en) Memory dump method, memory dumping program and virtual computer system
JP2850808B2 (en) Data processing device and data processing method
EP1103898A2 (en) Microprocessor and memory
US7017035B2 (en) Method and apparatus for using an ACPI NVS memory region as an alternative CMOS information area
US6324635B1 (en) Method and apparatus for address paging emulation
JPH0926898A (en) Device and method for detection of program error
US20050027940A1 (en) Methods and apparatus for migrating a temporary memory location to a main memory location
EP1901171A1 (en) Apparatus and method for handling interrupt disabled section and page pinning apparatus and method
JP2535086B2 (en) Ring reduction logic device
EP0101718B1 (en) Computer with automatic mapping of memory contents into machine registers
JPS6049352B2 (en) data processing equipment