JPH0471050A - Stack area protecting circuit - Google Patents

Stack area protecting circuit

Info

Publication number
JPH0471050A
JPH0471050A JP18259590A JP18259590A JPH0471050A JP H0471050 A JPH0471050 A JP H0471050A JP 18259590 A JP18259590 A JP 18259590A JP 18259590 A JP18259590 A JP 18259590A JP H0471050 A JPH0471050 A JP H0471050A
Authority
JP
Japan
Prior art keywords
stack
address
protection
memory
area
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
JP18259590A
Other languages
Japanese (ja)
Inventor
Giichi Mori
森 義一
Masayoshi Matsushita
松下 政好
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.)
Oki Electric Industry Co Ltd
Original Assignee
Oki Electric Industry Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Oki Electric Industry Co Ltd filed Critical Oki Electric Industry Co Ltd
Priority to JP18259590A priority Critical patent/JPH0471050A/en
Publication of JPH0471050A publication Critical patent/JPH0471050A/en
Pending legal-status Critical Current

Links

Landscapes

  • Storage Device Security (AREA)

Abstract

PURPOSE:To execute detailed and efficient memory protection for a stack area by deciding whether an address is included or not in a range indicated by the upper-limit and lower-limit addresses in a specific stack area in each access to the stack area. CONSTITUTION:When the check of a stack boundary is instructed by a memory access instruction signal 74 at the time of generating an access, a memory access control circuit 70 activates a stack boundary check valid signal 73. When a memory access address 71 is larger than an upper limit address 32, an upper limit address comparator 40 activates a stack upper limit over detection signal 42. Similarly, a lower limit address comparator 41 activates a stack lower limit over detection signal 43. When either one of the signals 42, 43 is active, an interruption is requested to a control circuit 60 and the start of exceptional processing against stack area protection is requested.

Description

【発明の詳細な説明】 [産業上の利用分野] 本発明は、コンピュータシステムにおけるメモリ保護、
特にスタック領域に対するメモリ保護を行うスタック領
域保護回路に関するものである。
DETAILED DESCRIPTION OF THE INVENTION [Field of Industrial Application] The present invention provides memory protection in computer systems;
In particular, the present invention relates to a stack area protection circuit that protects a stack area.

[従来の技術] 通常、コンピュータシステムでは使用効率を上げるため
複数のプログラムが並行して動作している。このため、
これらのプログラム間での情報の保護やプログラムが暴
走した場合のシステム停止などを防ぐためにメモリ(記
憶領域)の保護を行うことが必要である。このため多く
のコンピュータはこのメモリ保護のための回路を有して
保護を行っている。メモリ保護の方法にはこれまでいろ
いろな方法が採られているが、代表的な方法はメモリ管
理で使用されるアドレス変換機構にメモリ保護機構を内
蔵させる方法である。現在広く使用されているアドレス
変換機構にページング方式がある(参考文献二O8概論
 久保秀士著 共立出版刊 P、80、P、84−P、
88)。
[Prior Art] Normally, in a computer system, multiple programs run in parallel to increase usage efficiency. For this reason,
It is necessary to protect memory (storage area) in order to protect information between these programs and to prevent system stoppage if a program goes out of control. For this reason, many computers have a circuit for memory protection. Various methods have been used to protect memory, but a typical method is to incorporate a memory protection mechanism into the address translation mechanism used for memory management. There is a paging method in the address translation mechanism that is currently widely used (References 2 O8 Overview, written by Hideshi Kubo, published by Kyoritsu Shuppan, P, 80, P, 84-P,
88).

第2図にページング方式によるメモリ保護の一例を示す
。ページング方式は記憶領域を固定サイズの大きさで分
割し、この分割の単位であるページごとに論理アドレス
から物理アドレスへのアドレス変換を行うものである。
FIG. 2 shows an example of memory protection using a paging method. In the paging method, a storage area is divided into fixed sizes, and addresses are converted from logical addresses to physical addresses for each page, which is a unit of division.

この変換を行うためにページ表PTを用意して、この時
の論理アドレスをページ表へのインデックスとしてペー
ジ表から物理アドレスを引き出してくる。第2図の場合
には入力される論理アドレスのページアドレス(j+3
)でページ表を検索して物理アドレスのページアドレス
(1+3)を引いている。この物理アドレスを引き出す
際にその物理アドレスと保護レベルをページ表に並記し
ておく。この保護レベルには、例えば読み出しの可否、
書き込みの可否、実行の可否などを記述しておく。アド
レス変換時にこの保護レベルを検査することてページに
対する保護を実現する。第2図の例ではR,W、Eはそ
れぞれ読み出し権、書き込み権、実行権を示し、1゛の
場合は権利があり、“Ouは権利がないことを示す。第
2図の例では読み出し権のみあり、他の権利かないこと
を示し・ている。従ってこのページは読み出しのみか可
能で書き込みか実行できないようになっている。
In order to perform this conversion, a page table PT is prepared, and a physical address is extracted from the page table using the logical address at this time as an index to the page table. In the case of Figure 2, the page address (j+3
) to search the page table and subtract the page address (1+3) of the physical address. When extracting this physical address, write the physical address and protection level on the page table. This protection level includes, for example, readability,
Describe whether or not writing is possible, whether or not execution is possible, etc. Protection for pages is achieved by checking this protection level during address translation. In the example in Figure 2, R, W, and E indicate read, write, and execution rights, respectively; 1'' indicates the right, and ``Ou'' indicates no right. It shows that the page has only the right and no other rights.Therefore, this page can only be read and cannot be written.

以上、ページング方式によるメモリ保護について述べて
きたが、ページング方式の特徴の一つにメモリの使用目
的に依存しないという面がある。
The above has described memory protection using the paging method, and one of the characteristics of the paging method is that it does not depend on the purpose of memory use.

コンピュータのメモリは通常、プログラム領域、データ
領域、スタック領域などと使用目的に応じて論理的に分
離することか可能である。ページング方式は、この使用
目的による論理的な分割によらず、−律に固定サイズで
区切ってしまう。しかしながら、実際の保護を実現する
上で個々の領域に対して細かな保護ができることが望ま
しい。例えば、スタック領域の保護を行おうとすると、
実際のメモリ使用量は小さいにもかかわらず、ページン
グ方式において保護を実現するためには、ページ単位で
の割付が必要になる。
Computer memory can usually be logically separated into a program area, data area, stack area, etc. depending on the purpose of use. The paging method does not logically divide the information according to the purpose of use, but instead divides the information into fixed sizes. However, in order to achieve actual protection, it is desirable to be able to provide detailed protection for individual areas. For example, if you try to protect the stack area,
Although the actual amount of memory used is small, in order to achieve protection in the paging method, allocation is required in page units.

このスタック領域は、データを順々に積み上げ、後から
データを取り出すときには上から順々に取り出すように
なっている先入れ後出しメモリである。このスタックは
ソフトウェアを作りやすくする上で大きな役割を果して
いる。このためスタック領域が期待通りの動作をしてい
るか否かを知ることは極めて重要でありプログラム開発
の効率化にも寄与するものである。従って、このスタッ
ク領域に対して保護を行うことは単にメモリ内容の保護
を行うだけでなくプログラム開発の効率化やソフトウェ
アの信頼性を高めることにも寄与することになる。
This stack area is a first-in, last-out memory in which data is stacked one after another, and when data is retrieved later, it is taken out in order from the top. This stack plays a major role in making software easier to create. Therefore, it is extremely important to know whether the stack area is operating as expected, and it also contributes to increasing the efficiency of program development. Therefore, protecting this stack area not only protects the memory contents but also contributes to improving the efficiency of program development and the reliability of software.

[発明が解決しようとする課題] これまでに述べてきたページング方式によるメモリ保護
は汎用性が高く優れた方法ではあるが、メモリ保護の最
小単位がページの大きさに制限されるという問題がある
。この問題は以下に述べる応用分野で大きな問題である
[Problem to be solved by the invention] Although the memory protection using the paging method described so far is a highly versatile and excellent method, there is a problem in that the minimum unit of memory protection is limited to the size of a page. . This problem is a big problem in the application fields described below.

例えば、コンピュータシステムの一応用分野である通信
システムは、同時に並行して動作するプログラムが極め
て多いという特徴がある。このため、これらのプログラ
ムに間してコードやデータ、スタック領域についてそれ
ぞれ保護を行おうとすると各プログラム毎、各領域毎に
異なるページを個々に割り付けてやらなければならない
。即ち、メモリ使用効率の悪いページが生じることにな
る。
For example, communication systems, which are one application field of computer systems, are characterized by an extremely large number of programs running in parallel at the same time. Therefore, in order to protect the code, data, and stack areas of these programs, different pages must be individually allocated for each program and each area. In other words, pages with poor memory usage efficiency will occur.

この結果、個々の領域が使用するメモリ量か比較的小さ
い通信応用分野て:よメモリ保護を実現するため実際に
必要なメモリ量以上のメモリを割り当てなければならな
い。
As a result, in communications applications where the amount of memory used by individual regions is relatively small, more memory than is actually needed must be allocated to achieve memory protection.

しかし、通信応用分野では低コスト化のために装置に実
装するメモリ量を大きくすることは望ましくない。
However, in the field of communication applications, it is undesirable to increase the amount of memory installed in devices in order to reduce costs.

従って、メモリ保護を目的とするために必要以上のメモ
リ量を持ったり、並行動作するプログラム数に制約を加
えたりする制限が必要になり、低コストてかつ機能/性
能に優れた装置を実現することに問題があった。
Therefore, for the purpose of memory protection, it is necessary to have a larger amount of memory than necessary or to limit the number of programs that can run concurrently, making it possible to realize a device with low cost and excellent functionality/performance. There was a problem with that.

本発明の目的は、前記ページング方式によるメモリ保護
の問題点を解決し、ページング方式によるアドレス変換
機構を有し小容量のメモリしか持たないシステムにおい
ても、スタック領域に関して効率的なメモリ保護を実現
するスタック領域保護回路を提供することにある。
An object of the present invention is to solve the problem of memory protection by the paging method, and to realize efficient memory protection for the stack area even in a system having an address translation mechanism by the paging method and only a small memory capacity. An object of the present invention is to provide a stack area protection circuit.

[課題を解決するための手段] 本発明は、ベージング方式のアドレス変換機構を有し、
このアドレス変換機構はページ単位のメモリ保護機構を
有しかつスタック操作機能を有したコンピュータシステ
ムに適用され、このコンピュータシステムに本発明のス
タック領域保護回路が追設される。
[Means for Solving the Problems] The present invention has a paging-based address translation mechanism,
This address translation mechanism is applied to a computer system having a page-based memory protection mechanism and a stack operation function, and the stack area protection circuit of the present invention is added to this computer system.

第1図に示すように、所定の大きさの領域(ブロック)
に分割されたメモリ空間について、個々の領域を単位と
して、特定の領域及びこの特定の領域内に設定するスタ
ック領域の上限アドレス32並びに下限アドレス33を
それぞれ指定する第1の回路を設けである。この第1の
回路は、スタック境界レジスタ10、セレクタ20、上
限アドレス生成回路30、下限アドレス生成回路31か
ら成る。
As shown in Figure 1, an area (block) of a predetermined size
A first circuit is provided for specifying a specific area and an upper limit address 32 and a lower limit address 33 of a stack area to be set within this specific area, respectively, for each area of the memory space divided into two areas. This first circuit includes a stack boundary register 10, a selector 20, an upper limit address generation circuit 30, and a lower limit address generation circuit 31.

上記スタック領域に対するアクセスごとに、そのときの
アドレスが上記特定領域内の上限及び下限アドレスが示
す範囲内にあるか否かを判断する第2の回路を更に備え
る。この第2の回路は、上限アドレス比較回路40、下
限アドレス比較回路41及びスタック境界オーバー検出
回路50から成る。
The device further includes a second circuit that determines, each time the stack area is accessed, whether or not the current address is within a range indicated by the upper and lower limit addresses in the specific area. This second circuit consists of an upper limit address comparison circuit 40, a lower limit address comparison circuit 41, and a stack boundary over detection circuit 50.

この第2の回路の出力(スタック境界オーバー検出信号
51)に基づいて、スタック領域に対するメモリ保護を
行う。
Memory protection for the stack area is performed based on the output of this second circuit (stack boundary over detection signal 51).

[作用コ スタック領域に対するアクセスの行なわれるスタック操
作の度に、第1の回路が操作対象となっているスタック
領域の範囲を特定し、第2の回路でその範囲とアクセス
アドレスとの比較判定がなされる。メモリに設定し・た
スタック領域外のアクセスが生しると、第2の回路から
スタック境界オーバー検出信号51が出力され、スタッ
ク領域保護違反がなされたとして例外処理を割込みて実
行する。この割込み処理の実行により、スタック操作が
中止され、プログラムの暴走によりスタックデータが破
壊されるのを防止する。
[Each time a stack operation is performed to access the working cost stack area, the first circuit identifies the range of the stack area to be operated, and the second circuit compares and determines the range with the access address. Ru. When an access outside the stack area set in the memory occurs, a stack boundary over detection signal 51 is output from the second circuit, and an exception process is executed by interrupting the stack area protection violation. By executing this interrupt processing, the stack operation is stopped and stack data is prevented from being destroyed due to a runaway program.

スタック領域の範囲は、ページ指定するメモリアドレス
レジスタとは別個に用意したスタック境界レジスタ1つ
によって、ページに制約されることなく任意に決めるこ
とができる。
The range of the stack area can be arbitrarily determined without being restricted by pages by using one stack boundary register prepared separately from the memory address register that specifies the page.

[実施例コ 第1区に本発明を適用したスタック領域保護回路の一実
施例を示す。このスタック領域保護回路は、ベージング
方式のアドレス変換機構を有し、このアドレス変換機構
はページ単位のメモリ保護機構を有しかつ、スタック操
作機能を有したコンピュータシステムに追設される。従
って、スタック領域保護回路を設けた本実施例のコンピ
ュータシステムは、第2図に示すページング方式及びメ
モリ保護機構を併存している。
[Embodiment Section 1 shows an embodiment of a stack area protection circuit to which the present invention is applied. This stack area protection circuit has a paging-type address conversion mechanism, and this address conversion mechanism is added to a computer system that has a page-based memory protection mechanism and a stack operation function. Therefore, the computer system of this embodiment provided with the stack area protection circuit coexists with the paging method and memory protection mechanism shown in FIG.

第1図において、10は保護対象となるスタック領域を
示すスタック境界レジスタである。複数の保護しヘル、
たとえばLレベルの保護可能なコンピュータでは、スタ
ック境界レジスタ10はL不用意される。このレジスタ
10の中は、3つのフィールドに分割されており、11
はブロックアドレス(nビット)、12はブロック内上
限(pビット)、13はブロック内下限(qビット)を
示している。
In FIG. 1, 10 is a stack boundary register indicating a stack area to be protected. Multiple protections,
For example, in a computer capable of L level protection, the stack boundary register 10 is not provided. The inside of this register 10 is divided into three fields, 11
indicates the block address (n bits), 12 indicates the upper limit within the block (p bits), and 13 indicates the lower limit within the block (q bits).

20はセレクタであり、L本のスタック境界レジスタ1
0から制御回路60か示す実行時の動作レベルに応じた
スタック境界レジスタ10を選択し、それぞれブロック
アドレス21、ブロック内上限22、ブロック内下限2
3の各位を出力する。
20 is a selector, L stack boundary registers 1
0 to the stack boundary register 10 corresponding to the operating level at the time of execution indicated by the control circuit 60, and block address 21, upper limit within block 22, lower limit within block 2, respectively.
Output each part of 3.

30.31はそれぞれ上限アドレス生成回路、下限アド
レス生成回路である。上限アドレス生成回路30はブロ
ックアドレス21、ブロック内上限22を入力とし、ス
タック上限アドレス32をスタック上限アドレスバスに
出力する。同様に、下限アドレス生成回路31はブロッ
クアドレス21、ブロック内下限23を入力とし、スタ
ック下限アドレス33をスタック下限アドレスバスに出
力する。
30 and 31 are an upper limit address generation circuit and a lower limit address generation circuit, respectively. The upper limit address generation circuit 30 receives the block address 21 and the intra-block upper limit 22 as inputs, and outputs the stack upper limit address 32 to the stack upper limit address bus. Similarly, the lower limit address generation circuit 31 receives the block address 21 and the intra-block lower limit 23 as inputs, and outputs the stack lower limit address 33 to the stack lower limit address bus.

40.41はそれぞれ上限アドレス比較回路、下限アド
レス比較回路である。上限アドレス比較回路40はスタ
ック上限アドレス32およびメモリアクセス制御回路7
0からのメモリアクセスアドレス71を入力とし、両者
の大小比較を行い、結果をスタック上限オーバー検出信
号42として出力する。同様に、下限アドレス比較回路
41はスタック下限アドレス33およびメモリアクセス
アドレス71を入力とし、両者の大小比較を行い、結果
をスタック下限オーバー検出信号43として出力する。
40 and 41 are an upper limit address comparison circuit and a lower limit address comparison circuit, respectively. The upper limit address comparison circuit 40 compares the stack upper limit address 32 and the memory access control circuit 7.
The memory access address 71 starting from 0 is input, the two are compared in magnitude, and the result is output as the stack upper limit over detection signal 42. Similarly, the lower limit address comparison circuit 41 inputs the stack lower limit address 33 and the memory access address 71, compares the two in magnitude, and outputs the result as the stack lower limit over detection signal 43.

50はスタック境界オーバー検出回路であり、スタック
上限オーバー検出信号42、スタック下限オーバー検出
信号43、およびメモリアクセス要求信号72、スタッ
ク境界チエツク有効信号73を入力とし、最終的にスタ
ック境界違反の検出を行い、スタック境界オーバー検出
信号51を出力する。
Reference numeral 50 denotes a stack boundary over detection circuit, which inputs a stack upper limit over detection signal 42, a stack lower limit over detection signal 43, a memory access request signal 72, and a stack boundary check valid signal 73, and finally detects a stack boundary violation. and outputs the stack boundary over detection signal 51.

60は制御回路であり、スタック領域保護回路の制御を
行う。スタック境界オーバー検出信号51はこの制御回
路60に人力され、これにより割り込み処理を起動する
。また、スタック境界チエツクの実行指示を行う制御レ
ジスタも本制御回路60に含まれる。また、メモリへの
アクセスを行う場合ここはメモリアクセス指示信号74
によりメモリアクセス制御回路70への指示を行う。 
70はメモリアクセス制御回路で制御回路60からのメ
モリアクセス指示によりメモリアクセスを行い、メモリ
アクセスアドレス71、メモリアクセス要求信号72、
スタック境界チエツク有効信号73を出力する。なお、
メモリアクセス制御回路70の出力のアドレスバス75
はベージング方式によるアドレス変換装置(図示せず)
へ接続され、アドレスバス上のアドレスに対しアドレス
変換か行われる。
A control circuit 60 controls the stack area protection circuit. The stack boundary over detection signal 51 is input to this control circuit 60, thereby starting interrupt processing. The control circuit 60 also includes a control register for instructing execution of a stack boundary check. Also, when accessing the memory, the memory access instruction signal 74 is used.
The instruction is given to the memory access control circuit 70.
Reference numeral 70 denotes a memory access control circuit which performs memory access in response to a memory access instruction from the control circuit 60, and which outputs a memory access address 71, a memory access request signal 72,
A stack boundary check enable signal 73 is output. In addition,
Address bus 75 for output of memory access control circuit 70
is an address translation device using paging method (not shown)
The address is connected to the address bus, and address translation is performed on the address on the address bus.

以下、メモリアクセス時のスタック境界チエツクの動作
について説明する。スタック境界チエツクを行なうのは
、スタック領域に対するアクセスがあったとき、そのア
クセスアドレスがスタック領域外のアドレスを指定する
と、プログラムが暴走してシステム停止などの異常事態
が生じるため、スタック領域の保護を行なう必要がある
からである。スタック境界チエツクにより境界外のアド
レスが検・出された場合には、スタック領域保護違反の
例外処理の起動をかけて、そのような事態が生じるのを
未然もこ防止する。
The stack boundary check operation during memory access will be explained below. The stack boundary check is performed to protect the stack area because if the access address specifies an address outside the stack area when the stack area is accessed, the program will run out of control and an abnormal situation such as a system stop will occur. Because it is necessary to do so. If an address outside the boundary is detected by the stack boundary check, exception processing for stack area protection violation is activated to prevent such a situation from occurring.

メモリアクセスは制御回路60からのメモリアクセス指
示信号74により指示がなされ、メモリアクセス制御回
路70によって実行される。メモリアクセス制御回路7
0はアクセスが行われると、アドレスバス75にアクセ
スするメモリアクセスアドレス71を送出するとともに
、メモリアクセス要求信号72をアクティブにする。ま
た、メモリアクセス指示信号74でスタック境界のチエ
ツクが指示された場合には、スタック境界チエツク有効
信号73をアクティブにする。
Memory access is instructed by a memory access instruction signal 74 from the control circuit 60 and executed by the memory access control circuit 70. Memory access control circuit 7
0 sends out the memory access address 71 to be accessed to the address bus 75 and activates the memory access request signal 72 when access is performed. Further, when a stack boundary check is instructed by the memory access instruction signal 74, the stack boundary check valid signal 73 is activated.

一方、スタック境界レジスタ10には事前にチエツクす
べき範囲に関する情報が設定されているものとする。
On the other hand, it is assumed that information regarding the range to be checked is set in advance in the stack boundary register 10.

スタック境界レジスタ10は第1図に示されるように3
つのフィールドである、ブロックアドレス11、ブロッ
ク内上限12、ブロック内下限13に分けられている。
Stack boundary register 10 has three stack boundary registers as shown in FIG.
It is divided into three fields: block address 11, intra-block upper limit 12, and intra-block lower limit 13.

第3図はスタック境界レジスタの内容により、保護する
スタック領域の指定方法を示す。メモリは比較的大きな
固定領域であるブロックに分割され、このブロック毎に
保護を行うことができるようここなっている。ここでは
メモリアドレスはNピント輻(スタック境界レジスタの
ビット数)であるとする。フロックのアドレス輻をnビ
ット(N+1と書かれたブロックアドレスのビット数)
とすると1つのブロックの大きさはに2 <N−n)バ
イトとなる。保護はこのブロックの範囲内で行われ、保
護の対象となる範囲はスタック上限、スタック下限によ
り示される。スタック上限、スタック下限はそれぞれブ
ロック内のオフセット値を示しており、それぞれとブロ
ックアドレスとの組み合わせによりスタック上限アドレ
ス32、スタック下限アドレス33が計算される。この
スタック上限アドレス32とスタック下限アドレス33
との間がスタック領域であり、この領域外をアクセスし
た場合にはスタック領域保護違反として割り込み処理を
起動するようにする。スタック領域は通常ページよりも
小さい。
FIG. 3 shows a method of specifying a stack area to be protected based on the contents of the stack boundary register. The memory is divided into blocks, which are relatively large fixed areas, and each block can be protected. Here, it is assumed that the memory address is N pinto (the number of bits of the stack boundary register). Set the block address congestion to n bits (the number of bits of the block address written as N+1)
Then, the size of one block is 2<N-n) bytes. Protection is performed within the range of this block, and the range to be protected is indicated by the stack upper limit and stack lower limit. The stack upper limit and the stack lower limit each indicate an offset value within the block, and the stack upper limit address 32 and the stack lower limit address 33 are calculated by combining each with the block address. This stack upper limit address 32 and stack lower limit address 33
The space between this and the stack area is the stack area, and if an area outside this area is accessed, an interrupt process is activated as a stack area protection violation. Stack space is usually smaller than a page.

事前に保護領域の値が設定されている前記3フイールド
を有するスタック境界レジスタL本の中から、その時の
保護レベルに応したスタック境界レジスタ10の内容か
前記セレクタ20により選択され、ブロックアドレス2
1、ブロック内上限22、ブロック内下限23が出力さ
れる。選択されたそれぞれのアドレス情報は前記上限ア
ドレス生成回路30、下限アドレス生成回路31に入力
される。各回路30.31はブロックアドレスとスタッ
ク上限/スタック下限から加算等の手段を用いることて
スタック上限アドレス32、スタック下限アドレス33
を生成し、スタック上限アドレスバス、スタック下限ア
ドレスバスにそれぞれのアドレスを送出する。
The contents of the stack boundary register 10 corresponding to the protection level at that time are selected by the selector 20 from among the L stack boundary registers having the three fields in which protection area values are set in advance, and the block address 2 is selected by the selector 20.
1, the intra-block upper limit 22 and the intra-block lower limit 23 are output. The selected address information is input to the upper limit address generation circuit 30 and the lower limit address generation circuit 31. Each circuit 30.31 uses a means such as addition from the block address and the stack upper limit/stack lower limit to create a stack upper limit address 32 and a stack lower limit address 33.
and sends the respective addresses to the stack upper limit address bus and stack lower limit address bus.

生成されたスタック上限アドレス32、スタック下限ア
ドレス33、および前記メモリアクセス制御回路70か
ら出力されたメモリアクセスアドレス71は、前記上限
アドレス比較回路40、下限アトしス比較回路41へ入
力される。
The generated stack upper limit address 32, stack lower limit address 33, and memory access address 71 output from the memory access control circuit 70 are input to the upper limit address comparison circuit 40 and the lower limit address comparison circuit 41.

上限アドレス比較回路40:よスタッグ上限アドレス3
2、メモリアクセスアドレス71を入力とし、両者の大
小間係のを比較し、メモリアクセスアドレス71がスタ
ック上限アドレス32より大きい場合にはスタック上限
オーバー検出信号42をアクティブにする。同様に、下
限アドレス比較回路41はスタック下限アドレス33、
メモリアクセスアドレス71を入力とし、両者の大小間
係の比較を行い、メモリアクセスアドレス71がスタッ
ク下限アドレス33より小ならば、スタック下限オーバ
ー検出信号43をアクティブとする。
Upper limit address comparison circuit 40: Yo stag upper limit address 3
2. The memory access address 71 is input, the magnitude of the two is compared, and if the memory access address 71 is larger than the stack upper limit address 32, the stack upper limit over detection signal 42 is activated. Similarly, the lower limit address comparison circuit 41 includes the stack lower limit address 33,
The memory access address 71 is input, the magnitude of the two is compared, and if the memory access address 71 is smaller than the stack lower limit address 33, the stack lower limit over detection signal 43 is activated.

前記スタック境界オーバー検出回路50は、スタック上
限オーバー検出信号42、スタック下限オーバー検出信
号43、およびメモリアクセス制御回路70から送出さ
れるメモリアクセス要求信号72、スタック境界チエツ
ク有効信号73を入力とし、スタック境界チエツク有効
信号73がアクティブであり、メモリアクセス要求信号
72がアクティブでかつ、スタック上限オーバー検出信
号42、スタック下限オーバー検出信号43のいずれか
がアクティブならば、前記スタック境界レジスタ11が
示すスタック領域を外れたアクセスであると判断−し、
スタック境界オーバー検出信号51をアクティブにし、
前記制御回路60に割り込みを要求し、スタック領域保
護違反の例外処理の起動を要求する。
The stack boundary over detection circuit 50 receives as input a stack upper limit over detection signal 42, a stack lower limit over detection signal 43, a memory access request signal 72 sent from the memory access control circuit 70, and a stack boundary check valid signal 73, If the boundary check valid signal 73 is active, the memory access request signal 72 is active, and either the stack upper limit over detection signal 42 or the stack lower limit over detection signal 43 is active, the stack area indicated by the stack boundary register 11 is It is determined that the access is outside the
activating the stack boundary over detection signal 51;
An interrupt is requested to the control circuit 60 to request activation of stack area protection violation exception handling.

以上述べたように本実施例によれば、ベージング方式の
みの記憶保護に比べ、スタック領域をページサイズより
も小さな単位で保護することができ、メモリの使用効率
を上げることができる。特に、同時に並行して動作する
プログラムが極めて多く、かつ個々の領域が使用するメ
モリ量が比較的小さい通信分野に適用すれば、メモリ保
護を目的とするために必要以上のメモリ量を持ったり、
並行動作するプログラム数に制約を加えたりする必要が
なくなるので、低コストでかつ機能/性能に優れた装置
を実現することができる。
As described above, according to this embodiment, the stack area can be protected in units smaller than the page size, and memory usage efficiency can be improved, compared to storage protection using only the paging method. In particular, if applied to the communication field, where there are an extremely large number of programs running concurrently and each area uses a relatively small amount of memory, it may be necessary to use more memory than is necessary for the purpose of memory protection.
Since there is no need to impose restrictions on the number of programs that run in parallel, it is possible to realize a device with excellent functions and performance at low cost.

また、独立した専用のスタック境界レジスタにより、保
護するスタック領域の指定を容易に変更することができ
る。このことは、ページに制約されずに任意の大きさの
スタック領域を保護することができることを意味し、ペ
ージに跨がったスタック領域の保護も可能である。さら
に、保護するスタック領域がページよりも大きい場合に
は、スタック領域を保護することにより、該当するペー
ジ領域をも保護することが可能となる。
Furthermore, the designation of the stack area to be protected can be easily changed using an independent dedicated stack boundary register. This means that a stack area of any size can be protected without being restricted by pages, and it is also possible to protect a stack area that spans pages. Furthermore, if the stack area to be protected is larger than the page, by protecting the stack area, it becomes possible to protect the corresponding page area as well.

[発明の効果] 以上詳細に説明したように本発明によれば、ベージング
方式を用いたコンピュータシステムにおいて、ベージン
グ方式によるアドレス変換機構を有し小容量のメモリし
か持たないシステムにおいても、ベージング方式による
メリットを損うことなく、スタック領域に対してきめの
細かい効率的なメモリ保護を行うことができる。
[Effects of the Invention] As explained in detail above, according to the present invention, even in a computer system using the paging method, even in a system having an address translation mechanism using the paging method and having only a small memory capacity, the paging method can be used. Fine-grained and efficient memory protection can be performed for the stack area without sacrificing any benefits.

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

第1図は本発明の一実施例を示すスタック領域保護回路
のブロック図、第2図は従来のベージング方式によるメ
モリ保護の説明図、第3図は本発明の実施例のスタック
領域保護の説明図である。 10はスタック境界レジスタ、20はセレクタ、30は
上限アドレス生成回路、31は下限アドレス生成回路、
32は上限アドレス、33は下限アドレス、40は上限
アドレス比較回路、41は下限アドレス比較回路、50
はスタック境界領域オーバー検出回路、51はスタック
境界オーバー検圧信号である。
FIG. 1 is a block diagram of a stack area protection circuit showing an embodiment of the present invention, FIG. 2 is an explanatory diagram of memory protection using a conventional paging method, and FIG. 3 is an explanation of stack area protection according to an embodiment of the present invention. It is a diagram. 10 is a stack boundary register, 20 is a selector, 30 is an upper limit address generation circuit, 31 is a lower limit address generation circuit,
32 is an upper limit address, 33 is a lower limit address, 40 is an upper limit address comparison circuit, 41 is a lower limit address comparison circuit, 50
Reference numeral 51 indicates a stack boundary area over detection circuit, and 51 indicates a stack boundary over pressure detection signal.

Claims (1)

【特許請求の範囲】 1、ページング方式のアドレス変換機構を有し、このア
ドレス変換機構はページ単位のメモリ保護機構を有しか
つ、スタック操作機能を有したコンピュータシステムに
おいて、 所定の大きさの領域に分割されたメモリ空間について、
個々の領域を単位として、特定の領域及びこの特定の領
域内に設定するスタック領域の上限アドレス並びに下限
アドレスをそれぞれ指定する第1の回路と、 上記スタック領域に対するアクセスごとに、そのときの
アドレスが上記特定領域内の上限及び下限アドレスが示
す範囲内にあるか否かを判断する第2の回路とを備え、 上記第2の回路の出力に基づいて上記スタック領域に対
するメモリ保護を行うことを特徴とするスタック領域保
護回路。 2、上記コンピュータシステムは、メモリ保護のレベル
を指定することができ、上記スタック領域保護が保護レ
ベルごとに行われることを特徴とする請求項1に記載の
スタック領域保護回路。
[Scope of Claims] 1. In a computer system having a paging-type address conversion mechanism, this address conversion mechanism having a page-based memory protection mechanism, and a stack operation function, an area of a predetermined size. Regarding the memory space divided into
A first circuit that specifies an upper limit address and a lower limit address of a specific area and a stack area set within this specific area, using each area as a unit; and a second circuit that determines whether or not the upper and lower limit addresses in the specific area are within the range indicated, and memory protection for the stack area is performed based on the output of the second circuit. Stack area protection circuit. 2. The stack area protection circuit according to claim 1, wherein the computer system is capable of specifying a level of memory protection, and the stack area protection is performed for each protection level.
JP18259590A 1990-07-12 1990-07-12 Stack area protecting circuit Pending JPH0471050A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP18259590A JPH0471050A (en) 1990-07-12 1990-07-12 Stack area protecting circuit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP18259590A JPH0471050A (en) 1990-07-12 1990-07-12 Stack area protecting circuit

Publications (1)

Publication Number Publication Date
JPH0471050A true JPH0471050A (en) 1992-03-05

Family

ID=16121036

Family Applications (1)

Application Number Title Priority Date Filing Date
JP18259590A Pending JPH0471050A (en) 1990-07-12 1990-07-12 Stack area protecting circuit

Country Status (1)

Country Link
JP (1) JPH0471050A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO1997027544A1 (en) * 1996-01-24 1997-07-31 Sun Microsystems, Inc. Processor with accelerated array access bounds checking

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO1997027544A1 (en) * 1996-01-24 1997-07-31 Sun Microsystems, Inc. Processor with accelerated array access bounds checking

Similar Documents

Publication Publication Date Title
KR860000838B1 (en) Improved memory proterction system using capability registers
US6349355B1 (en) Sharing executable modules between user and kernel threads
US5335334A (en) Data processing apparatus having a real memory region with a corresponding fixed memory protection key value and method for allocating memories therefor
US8364910B2 (en) Hard object: hardware protection for software objects
US6735666B1 (en) Method of providing direct user task access to operating system data structures
US5561788A (en) Method and system for executing programs using memory wrap in a multi-mode microprocessor
US20070050586A1 (en) Memory access control apparatus
JPS63289659A (en) Storage device protecting system
JPS6248258B2 (en)
JP2011008760A (en) Microcomputer
GB2302604A (en) Data memory allocation
US6895583B1 (en) Task control block for a computing environment
JPS6257044A (en) Storage protection device
KR100791815B1 (en) Privilege promotion based on check of previous privilege level
WO2019237862A1 (en) Layout method for linear address space, and computing device
EP1842135B1 (en) Generic low cost hardware mechanism for memory protection
JP2006338426A (en) Calculator system
JPH0471050A (en) Stack area protecting circuit
JPS599937B2 (en) information processing equipment
EP0864983A2 (en) Computer system including memory adress management circuit for protecting memory from illegal writing
EP0285309A2 (en) Memory protection apparatus for use in an electronic calculator
JPS626351A (en) Storage protecting deice
JPS62126448A (en) Memory control and protection system
WO1990005951A1 (en) Method of handling unintended software interrupt exceptions
JPH03113548A (en) Extension memory controller