JPS5873099A - Data processor - Google Patents

Data processor

Info

Publication number
JPS5873099A
JPS5873099A JP56168828A JP16882881A JPS5873099A JP S5873099 A JPS5873099 A JP S5873099A JP 56168828 A JP56168828 A JP 56168828A JP 16882881 A JP16882881 A JP 16882881A JP S5873099 A JPS5873099 A JP S5873099A
Authority
JP
Japan
Prior art keywords
address
stack
memory
stack pointer
upper limit
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
JP56168828A
Other languages
Japanese (ja)
Inventor
Yoichi Kawabata
洋一 川端
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Canon Inc
Original Assignee
Canon Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Canon Inc filed Critical Canon Inc
Priority to JP56168828A priority Critical patent/JPS5873099A/en
Publication of JPS5873099A publication Critical patent/JPS5873099A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Storage Device Security (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)
  • Executing Machine-Instructions (AREA)
  • Debugging And Monitoring (AREA)

Abstract

PURPOSE:To prevent the runaway of a program, by comparing an address signal in an address bus and an upper/lower limit address at each accessing of a stack memory and generating an interrupting signal to a CPU when both the address are coincident. CONSTITUTION:When a program advances and write is done for all stack area SM, since a value 7,000 set to an upper limit register 4 and an address 7,000 instructed to a memory 2 via a bus B from a stack pointer SP are made equal, a coincidence circuit 6 outputs an interruption signal INT. A CPU1 receives it and writes the content from the address 7,000 of the stack memory SM to the address 7FFF is written in a floppy disc 3 at an upper limit coincidence interruption processing routine, then the SM is vacant and the SP in the CPU1 is reset to the address 8,000. Thus, the program runaway when the stack pointer overflows, can be prevented.

Description

【発明の詳細な説明】 本発明は後入れ先出し方式のメモリ、すなわちスタック
メふりな有するデータ処理装置に関するもので、特に1
スタツタポインタかオーバフ四−したとき、そのオーバ
70−したデータを二次配憶装置に退避させるよ5にし
た装置に関するものである。
DETAILED DESCRIPTION OF THE INVENTION The present invention relates to a data processing device having a last-in, first-out memory, that is, a stacked memory, and particularly relates to a
This invention relates to a device in which, when a starter pointer is overflowed, the overflowed data is saved to a secondary storage device.

市販の8ビツトマイクロプロセツサのよ5に1スタツク
ポインタを有するが、そのスタックポインタのオーバ7
0−をチェックする機能のないCPUを用いたデータ処
理装置においては、どの程度のメモリの容量をスタック
領域に割当てるかを決定することは困難な問題であった
。スタックの消費量が予測可能な場合(は、その消費量
の最大値を計算して求めたり、また予測できない場合に
は、ブーグラムを1回走らせて試行したり、または最悪
の場合のテストデータな作って処理する実験を行って、
スタック領域の大きさを求めるのが通常である。しかし
、これらの方法は、スタックポインタのオーバフローに
起因する問題の根本的な解決4Cはなつ【いない。例え
ば、リアルタイム制御的な応用勢で再現不能な場合には
、スタック消費量が未知のデータによるので、致命的に
暴走になる場合が少くない。
Commercially available 8-bit microprocessors have one stack pointer in 5, but if the stack pointer exceeds 7
In a data processing device using a CPU without a function of checking 0-, it is difficult to determine how much memory capacity to allocate to the stack area. If the stack consumption is predictable (in which case you can calculate the maximum consumption value), if not, you can try running the boogram once or use worst-case test data. We conducted experiments to create and process
Usually, the size of the stack area is determined. However, these methods do not fundamentally solve the problem caused by stack pointer overflow. For example, if it cannot be reproduced in a real-time control application, the stack consumption is based on unknown data, which often leads to fatal runaway.

本発明の目的は、上述の欠点を除去し、スタックポイン
タのオーバフローによるプログラムの潜在的危険性を除
去したデータ処理装置を提供するととKある。
SUMMARY OF THE INVENTION It is an object of the present invention to provide a data processing device which eliminates the above-mentioned drawbacks and eliminates the potential danger of a program due to stack pointer overflow.

本発明は、スタックポインタのオーバフローのチェック
機能を具え、かつ、スタックポインタのオーバ70一時
にも、二次記憶装置を利用してオーバフローデータをス
タックメモリから一時退避させ、以てデータ処理を連続
して行えるよう和したことを特徴とする。
The present invention has a stack pointer overflow check function, and even when the stack pointer exceeds 70, the overflow data is temporarily saved from the stack memory using a secondary storage device, and data processing continues. It is characterized by being harmonized so that it can be performed easily.

以下、図面を参照して、本発明の詳細な説明する。Hereinafter, the present invention will be described in detail with reference to the drawings.

第1図は本発明データ処理装置の一実施例を示すブロッ
ク線図である。ここで、1はスタックポインタspを有
する中央処理装置(CPU)、2はメモリ、3はフロッ
ピーディスクで、これらはパス藤を介して接続されてい
る。CPU 1はメモリ雪中のある領域たとえば16進
数で7000書地から7FFF番地までをスタックメモ
リSMとして使うものとする。ここで、スタックメモリ
8Mは0番地の方向(第1内で上方、すなわちバスに近
いooooで示す方向)へ向って伸びると仮定すると、
CPU 1は上限レジスタ4&C対して1000を、下
限レジスタ611C対しc 5oooを設定する1、6
およびフは一致回路である。また、CPU l中のスタ
ックポインタgFは、スタックメモリ8Mが空のときは
、 soo。
FIG. 1 is a block diagram showing an embodiment of the data processing apparatus of the present invention. Here, 1 is a central processing unit (CPU) having a stack pointer sp, 2 is a memory, and 3 is a floppy disk, and these are connected via a path. It is assumed that the CPU 1 uses a certain area in the memory, for example, from address 7000 in hexadecimal to address 7FFF, as the stack memory SM. Here, assuming that the stack memory 8M extends in the direction of address 0 (in the first direction upward, that is, in the direction indicated by oooo near the bus),
CPU 1 sets 1000 for upper limit register 4 & C and c 5ooo for lower limit register 611C 1, 6
and f are matching circuits. Furthermore, the stack pointer gF in CPU I is soo when the stack memory 8M is empty.

に初期化される。ここで、スタックポインタSPは、常
にスタックにブツシュ(書込み、pwsh−d@vn 
)された現時点での最上端の要素のアドレスを指示する
レジスタのことである。従って上述の空のスタックメモ
リ8Mに1要素がブツシュされルト、スタックポインタ
は7FFFを指示するし。
is initialized to . Here, the stack pointer SP always writes (writes, pwsh-d@vn
) is a register that indicates the address of the current topmost element. Therefore, one element is pushed into the above-mentioned empty stack memory 8M, and the stack pointer points to 7FFF.

スタックメモりSM一杯に書込みがなされると7000
を指示することになる。
7000 when the stack memory SM is full
will be instructed.

さて、プログラムが走り始め、スタック領域叫のすべて
に書込みがなされると、上限レジスタ4に設定された値
7000と、スタックがインクBFよりバスlを介して
メモリ2#C指示されるアドレス7000が等しくなる
ので、一致回路6カを割込信号INτを出力する。CP
U 1は割込信号INT W−より【起動される割込処
理ルーチン中の[上限一致割。
Now, when the program starts running and the entire stack area is written, the value 7000 set in the upper limit register 4 and the address 7000 specified by the stack from the ink BF to the memory 2#C via the bus l are Since they are equal, the six matching circuits output an interrupt signal INτ. C.P.
U1 is the upper limit match percentage in the interrupt processing routine that is activated by the interrupt signal INT W-.

込jl&llルーチン」でスタックメモ9 BMの70
00書地から7FFF番地まtの内容を70ツビーデイ
スク3に書込む。この結果、スタックメモリ8M it
空となり、CPU i中のスタックポインタ5pit8
000に再設定されて、割込みMIJを終了する。
Stack memo 9 BM's 70 with "Including jl&ll routine"
Write the contents of address 7FFF from address 00 to 70TB disk 3. As a result, the stack memory is 8M it
It becomes empty and the stack pointer 5pit8 in CPU i
It is reset to 000 and the interrupt MIJ is terminated.

さらにプログラムが走り続けるときは、スタックメモリ
8Mヘラ田グラム要素が送り込まれ、スタックメモリ謂
が一杯とならない場合、たとえ&fアドレスγλAムで
書込み内容の送り込み力を止ったときは、スタックポイ
ンタ8PはマAAA K整定される。スタックメモリB
Mが、再び一杯となる場合、すなわち7000 Kなる
と上述と同様に、スタック中の1000から7FFFま
での内容は、フロッピーディスク3#C書込まれ、スタ
ックポインタSPは易000 K整定される。さらに、
スタックメモリ8Mが一杯となれば、同様の処理が行わ
れる。
Furthermore, when the program continues to run, stack memory 8M spaller datagram elements are sent, and if the stack memory is not full, even if the sending of written contents is stopped at &f address γλAM, the stack pointer 8P is AAAK is set. Stack memory B
When M becomes full again, that is, 7000 K, the contents from 1000 to 7FFF in the stack are written to floppy disk 3#C, and the stack pointer SP is easily set to 000 K, as described above. moreover,
When the stack memory 8M becomes full, similar processing is performed.

次に、今度はスタックメモリ8Mが空になった場合に取
出しくポツプ5pot−up)が行われる場合を考える
。即ちスタックポインタSPが7FFFをこえて5oo
o番地の内容をポツプしようとした時には、バスBには
アドレス8000の信号が流れるので、一致回路7が割
込信号を出力する。cpυ1は割込信号INTによって
起動される割込み処理ルーチン中の[下限一致割込処理
ルーチン」によりフロッピーディスク3に、最後に書き
込ん・だlブロックのデータを読出し【メモリ雪中の7
FFFから7000書地のスタックメモリSMにストア
する。
Next, let us consider a case where a pop-up (pot-up) is performed when the stack memory 8M becomes empty. In other words, the stack pointer SP exceeds 7FFF and becomes 5oo.
When an attempt is made to pop the contents of address o, a signal of address 8000 flows on bus B, so coincidence circuit 7 outputs an interrupt signal. cpυ1 reads the data of the last written block from the floppy disk 3 by the [lower limit match interrupt processing routine] in the interrupt processing routine activated by the interrupt signal INT.
Store from FFF to stack memory SM with 7000 write locations.

この操作が完了した後、スタックポインタSPを760
0に設定し、ポツプ動作を再開始し割込処理を終了する
After this operation is completed, set the stack pointer SP to 760
The flag is set to 0, the pop operation is restarted, and the interrupt processing is ended.

以後、ブツシュ動作およびポツプ動作がどのよ5な順番
で続いても、スタックポインタ8P が−上下限の間、
即ち7000〜7FFFの間にある限りは、通常通りス
タックメモリ8Mは使用され、上下限のいづれかに一致
した場合は、上述のそれ和相当する「割込処理ルーチン
」が実施される。このよ5に1.て、プログラム処理は
、スタックポインタ8Pのオーバフローを意識すること
なく続行される。
From then on, no matter how the push and pop operations continue in any order, the stack pointer 8P remains between the -high and low limits.
That is, as long as the value is between 7000 and 7FFF, the stack memory 8M is used normally, and if it matches either of the upper or lower limits, the "interrupt processing routine" corresponding to the above-mentioned sum is executed. This is 1 in 5. Thus, program processing continues without being aware of the overflow of the stack pointer 8P.

ここで、上述の[割込み処理ルーチン]を別の見方で説
明する。第2図はフロッピー7デイスク3中のデータも
含めて大きなスタックを形成し【いると考えた場合のメ
モリ全体の模式−を示し、ここでは「上限一致割込処理
ルーチン」が3回続けて行われた後の記憶状態を示して
いる。フロッピーディスク3中には上述の例の場合には
、各アドレスに対し!ワードを割当てているとすれば、
約4にワードを1ブロツクとしてプμツク単位〒フロッ
ピーディスク3#c対してプツシエ動作およびポツプ動
作を行っていると考えられる。フロッピーディスク3中
の記憶内容の現在綾上位置を示しているポインタD8P
は、フロッピーディスクSに対するポインタと考えられ
る。メモリ2内のスタので、そのスタックの上限現在ア
ドレスがスタックポインタSPにより細かく示されると
考えると、菖1図示の実i例におけるメモリ2中のスタ
ックと70ツビーデイスク3との関連動作が容易に堆解
される。
Here, the above-mentioned [interrupt processing routine] will be explained from a different perspective. Figure 2 shows a schematic diagram of the entire memory assuming that a large stack is formed, including the data on the floppy disk 3. Here, the ``upper limit match interrupt handling routine'' is executed three times in a row. It shows the state of memory after being exposed. In the above example, floppy disk 3 contains ! for each address! If you are assigning a word,
It is considered that the push and pop operations are performed on the floppy disk 3#c in push unit with approximately 4 words as one block. Pointer D8P indicating the current position of the memory contents in the floppy disk 3
can be considered a pointer to the floppy disk S. Since the stack is in the memory 2, considering that the upper limit current address of the stack is indicated in detail by the stack pointer SP, the related operations between the stack in the memory 2 and the 70-bit disk 3 in the example shown in the iris 1 can be easily performed. Decomposed.

なお、v11図示の実施例においては、上述したスタッ
クポインタ8Pを割込みの制御に用いられるスタックポ
インタとは別物とするが、メ毫り2中のスタック領域以
外の部分KCPUI中のすべ【のレジスタを割当てるだ
けの余裕をもたせておけばスタック領域および他のメモ
リ部分に対して共通のスタックポインタを用いることも
できる。
In the embodiment illustrated in v11, the stack pointer 8P mentioned above is different from the stack pointer used for interrupt control, but all the registers in the part KCPUI other than the stack area in the memory 2 are If there is enough room for allocation, a common stack pointer can be used for the stack area and other memory parts.

以上述べたところより明かな如く、本発明データ処理装
置によれば、どの程度のメモリ容倉なスタック領域に割
当てるべきかということを予め定めておく必要がないの
で、スタックポインタがオーバ70−する場合において
もプログラムの暴にが防げ、プログラムを中断すること
なく実行することができる効果が得られ、一般に市販さ
れていルオーパフローチェック機能のないマイクロブ關
セッサを用いても有効なスタック手段を実現することが
できる。
As is clear from the above description, according to the data processing device of the present invention, it is not necessary to determine in advance how much memory capacity should be allocated to the stack area, so the stack pointer may exceed 70 -. This method prevents program abuse and allows programs to be executed without interruption, even in cases where the program is not interrupted, and provides an effective stacking method even when using a microprocessor that does not have a flow check function that is generally available on the market. can do.

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

第1図は本発明の一実施例を示すブロック−図、第2図
は第1図の動作説明図である。 1・・・CPU、        2・・・メモリ、3
・・・フロッピーディスク。 4・・・上限レジスタ、   5・・・下限レジスタ、
6.7・・・一致回路、 B・・・パス、sp−・・スタックポインタ、INT・
・・割込信号、    DBP・・・フロッピーディス
クポインタ。 特許出願人  キャノン株式会社 代理人 弁理士   谷     義  −蟲第1図 第2図
FIG. 1 is a block diagram showing one embodiment of the present invention, and FIG. 2 is an explanatory diagram of the operation of FIG. 1. 1...CPU, 2...Memory, 3
···floppy disk. 4... Upper limit register, 5... Lower limit register,
6.7... Match circuit, B... Path, sp-... Stack pointer, INT...
...Interrupt signal, DBP...floppy disk pointer. Patent applicant Canon Co., Ltd. agent Patent attorney Yoshi Tani - Figure 1 Figure 2

Claims (1)

【特許請求の範囲】 1)スタックメモリと、該スタックメモリの上限アドレ
スおよび下限アドレスをそれぞれ貯えたレジスタをアド
レスバスな介して中*鵡境装置に結合したデータII&
瑠装置において、前記スタックメモリなア・クセスする
毎に前記アドレスバス内のアドレス信号と前記上下限ア
ドレスとを比較し、両アドレスが一致したとぎに前記中
央処理装置に対し【割込み信号を発生する。ようにした
ことを41像とするデータ処理装置。 2、特許請求の範囲第1項記載の装置におい【、前記上
限アドレスと前記アドレス信号との一致により発生した
前記割込信号によつ″C前記スタックメモリ内のメモリ
内容の一部または全部を二次記憶装置に退避させ、前記
下限アドレスと前記アドレス信号との一致により発生し
た前記割込信号によって前記二次記憶装置に退避してい
る前記メモリ内容を前記スタックメモリへ復元するよう
に一部たことを4I徴とするデータ処理装置。
[Claims] 1) A stack memory and a register storing the upper limit address and lower limit address of the stack memory, respectively, are connected to a medium-terminal device via an address bus.
The device compares the address signal in the address bus with the upper and lower limit addresses each time the stack memory is accessed, and when the two addresses match, generates an interrupt signal to the central processing unit. . A data processing device with 41 images. 2. In the apparatus according to claim 1, "C, a part or all of the memory contents in the stack memory are processed by the interrupt signal generated by the coincidence of the upper limit address and the address signal. A portion of the memory contents saved in the secondary storage device are restored to the stack memory by the interrupt signal generated by the match between the lower limit address and the address signal. A data processing device with 4I characteristics.
JP56168828A 1981-10-23 1981-10-23 Data processor Pending JPS5873099A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP56168828A JPS5873099A (en) 1981-10-23 1981-10-23 Data processor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP56168828A JPS5873099A (en) 1981-10-23 1981-10-23 Data processor

Publications (1)

Publication Number Publication Date
JPS5873099A true JPS5873099A (en) 1983-05-02

Family

ID=15875265

Family Applications (1)

Application Number Title Priority Date Filing Date
JP56168828A Pending JPS5873099A (en) 1981-10-23 1981-10-23 Data processor

Country Status (1)

Country Link
JP (1) JPS5873099A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6057439A (en) * 1983-09-08 1985-04-03 Matsushita Electric Ind Co Ltd Stack overflow detector
JPH02299025A (en) * 1989-05-12 1990-12-11 Nec Corp Microcomputer
JPH036618A (en) * 1989-06-02 1991-01-14 Fuji Electric Co Ltd Abnormality detecting circuit for stack pointer
JPH11203166A (en) * 1998-01-19 1999-07-30 Nec Corp Stack pointer tracing device and its method, and recording medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6057439A (en) * 1983-09-08 1985-04-03 Matsushita Electric Ind Co Ltd Stack overflow detector
JPH02299025A (en) * 1989-05-12 1990-12-11 Nec Corp Microcomputer
JPH036618A (en) * 1989-06-02 1991-01-14 Fuji Electric Co Ltd Abnormality detecting circuit for stack pointer
JPH11203166A (en) * 1998-01-19 1999-07-30 Nec Corp Stack pointer tracing device and its method, and recording medium

Similar Documents

Publication Publication Date Title
US7380245B1 (en) Technique for detecting corruption associated with a stack in a storage device
EP0566243A1 (en) Free memory cell management system
GB1410631A (en) Data processing system interrupt arrangements
JPS59130000A (en) Method of protecting virtual memory device
US6038631A (en) Data processing system and method using virtual storage system
US4368532A (en) Memory checking method
JPS5873099A (en) Data processor
EP0117930A1 (en) Interactive work station with auxiliary microprocessor for storage protection
AU565149B2 (en) Improvements in or relating to computer systems
JPS5848289A (en) Buffer memory controlling system
JPH05100847A (en) Memory protection system for information processor
JP2671160B2 (en) Exception handling method
JPH0821009B2 (en) CHANNEL CONTROLLER INITIALIZATION METHOD AND SYSTEM FOR THE INITIALIZATION
JPH0427583B2 (en)
JPS5826043B2 (en) Processor reset method
JPS58154043A (en) Information processor
JPS5845699A (en) Memory protection circuit
JPS6020779B2 (en) Composite computer system
JP2533931B2 (en) Data contents protection method of dynamic allocation area
JP2982181B2 (en) Central processing unit
JPS6097448A (en) Memory protection system
JPS5994148A (en) Hardware stack memory circuit
JPS59121455A (en) Prefixing system
JPS57125454A (en) System for processing of multiprocessor
JPS6227855A (en) Deleting system for initial program loading fixed memory device