JP2004280801A - Processor and compiler apparatus for generating program for the processor - Google Patents
Processor and compiler apparatus for generating program for the processor Download PDFInfo
- Publication number
- JP2004280801A JP2004280801A JP2004048531A JP2004048531A JP2004280801A JP 2004280801 A JP2004280801 A JP 2004280801A JP 2004048531 A JP2004048531 A JP 2004048531A JP 2004048531 A JP2004048531 A JP 2004048531A JP 2004280801 A JP2004280801 A JP 2004280801A
- Authority
- JP
- Japan
- Prior art keywords
- branch
- instruction
- operation mode
- program
- illegal
- 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.)
- Withdrawn
Links
Images
Landscapes
- Storage Device Security (AREA)
- Executing Machine-Instructions (AREA)
Abstract
Description
本発明は、命令メモリに対して外部からプログラムを追加できるプロセッサにおける命令実行保護に関するものである。 The present invention relates to instruction execution protection in a processor that can externally add a program to an instruction memory.
通常、プロセッサは、命令メモリに格納されたプログラムに従って、データ処理、演算処理などの各種処理を実行する。 Generally, a processor executes various processes such as data processing and arithmetic processing in accordance with a program stored in an instruction memory.
以上のような従来のプロセッサについて、図面を参考にしながら以下に説明する。 The conventional processor as described above will be described below with reference to the drawings.
図6は、従来の技術によって開発されたプロセッサを用いたICカードシステムを表すブロック図である。 FIG. 6 is a block diagram showing an IC card system using a processor developed by a conventional technique.
従来の技術によって開発されたプロセッサを用いたICカードシステムは、図6に示すように、CPU101と、命令ROM102と、RAM103と、フラッシュメモリ104と、外部I/F105と、アンテナコイル106と、アドレスバス107aと、データバス107dと、割り込み制御回路108と、分岐許可アドレス判定回路109によって構成される。
As shown in FIG. 6, an IC card system using a processor developed by a conventional technique includes a
CPU101は、命令フェッチ部1011と、命令解読部1012と、命令実行部1013と、プログラムカウンタ1014と、メモリアクセス制御回路1015とによって構成される。
The
CPU101は、命令ROM102またはフラッシュメモリ104に格納された命令を読み出し実行していく。フラッシュメモリ104に対しては、アンテナコイル106および外部I/F105を介して、外部からプログラムデータを追加することが可能である。
The
図7は、従来の技術によって開発されたプロセッサを用いたメモリ空間の領域区分の概念図である。 FIG. 7 is a conceptual diagram of an area division of a memory space using a processor developed by a conventional technique.
図7において、200は全論理アドレス空間を表す。全論理アドレス空間200は、外部I/F105、命令ROM102、RAM103、および、フラッシュメモリ104に割り当てられている。全論理アドレス空間200のうち、命令ROM空間は特権領域211とAPI領域212に、RAM領域は特権領域221とAPI領域222とユーザ領域223に、フラッシュメモリはユーザ領域231に、外部I/Fはユーザ領域241に、それぞれ区分されている。
In FIG. 7,
図8は、従来の技術によって開発されたプロセッサ用のプログラム概念図である。図8において、ユーザプログラム302における命令群3021は、ユーザプログラム302から特権プログラム301(命令群3011)への実行の移行を行うための処理を記述したものであり、ユーザプログラム302における命令群3022は、ユーザプログラム302から特権プログラム301(命令群3012)への実行の移行を行うための処理を記述したものである。特権プログラム301における命令群3011は、その処理内容の詳細な図示は省略してあるが、ユーザプログラム302から命令群3012または命令群3013への実行の移行を行うための処理を記述したものである。
FIG. 8 is a conceptual diagram of a program for a processor developed by a conventional technique. In FIG. 8, an
従来の技術によって開発された上記ICカードシステムにおいては、ユーザプログラムによって特権プログラムおよびAPIプログラムが不正に実行されることを防ぎ、セキュリティを確保するために、動作モードの移行を伴う分岐が発生した場合は、以下に示す方法がとられる(例えば特許文献1を参照。)。 In the above-described IC card system developed by the conventional technology, in order to prevent a privileged program and an API program from being illegally executed by a user program and to ensure security, when a branch accompanied by an operation mode transition occurs. The following method is used (see, for example, Patent Document 1).
第一に、ユーザプログラム上で実行を希望する特権プログラムまたはAPIプログラムが格納されているアドレスを、演算用レジスタに設定する。第二に、分岐許可アドレス判定回路109によって定められた特定の分岐許可アドレスに対して分岐命令を実行する。第三に、分岐許可アドレス上に格納されている条件判定プログラムによって、演算用レジスタに設定されたアドレスの正当性が判定され、正当であれば、ユーザプログラムが実行を希望する特権プログラムまたはAPIプログラムが格納されているアドレスに対し、再度分岐命令が実行される。
First, an address at which a privileged program or an API program desired to be executed on a user program is stored is set in an arithmetic register. Second, a branch instruction is executed for a specific branch permission address determined by the branch permission
また、ユーザプログラムから、分岐許可アドレス判定回路109に定められていない特権プログラムまたはAPIプログラム中のアドレスに対して分岐命令を実行した場合は、分岐許可アドレス判定回路109によって割り込み要求が出力されるため、セキュリティが確保される。
しかしながら、上記のようなプロセッサを用いたICカードシステムにおいては、ユーザプログラムから特権プログラムに実行が移行する際に条件判定プログラムの実行が発生するため、リアルタイム性が低下するという問題がある。 However, in the IC card system using the processor as described above, the execution of the condition determination program occurs when the execution shifts from the user program to the privileged program.
本発明は、上記従来の問題点を解決するためのものであり、例えばユーザプログラムから特権プログラムへ実行が移行する際のセキュリティを確保しつつ、リアルタイム性向上が可能なプロセッサを提供することを目的とする。 An object of the present invention is to solve the above-mentioned conventional problems, and an object of the present invention is to provide a processor capable of improving real-time performance while ensuring security when execution shifts from a user program to a privileged program. And
上記の目的を達成するために、本発明のプロセッサは、CPUと、プログラムを格納するための命令メモリと、前記命令メモリに格納されているプログラムによって、動作モードを異なる動作モードへ変更する分岐命令が実行された際、分岐先アドレスに分岐許可命令が存在するか否かを判断し、前記分岐許可命令が存在する場合は動作モードの変更を許可する一方、前記分岐許可命令が存在しない場合は不正分岐検出信号を出力する不正分岐検出部とを備えたことを特徴とする。 In order to achieve the above object, a processor according to the present invention comprises a CPU, an instruction memory for storing a program, and a branch instruction for changing an operation mode to a different operation mode depending on a program stored in the instruction memory. Is executed, it is determined whether or not a branch permission instruction is present at the branch destination address.If the branch permission instruction is present, the operation mode change is permitted. An illegal branch detection unit that outputs an illegal branch detection signal.
上述の構成にかかる本発明のプロセッサに関して、動作モードの変更とは、例えば、ある動作モードから、当該動作モードよりも高い権限を必要とする動作モードへの変更を言う。 In the processor according to the present invention having the above-described configuration, the change in the operation mode refers to, for example, a change from a certain operation mode to an operation mode requiring higher authority than the operation mode.
上記の構成を備えたことにより、本発明のプロセッサは、ユーザプログラムから例えば特権プログラムまたはAPIプログラム中のアドレスに対して分岐命令が実行された際、分岐先アドレス上に分岐許可命令が格納されていない場合は不正分岐検出部が不正分岐検出信号を出力するため、ユーザプログラムによって特権プログラム等が不正に実行されることを防ぎ、セキュリティを確保できる。またユーザプログラム上から、特権プログラムまたはAPIプログラムを正当に実行する際、ユーザプログラム上で実行を希望する特権プログラムまたはAPIプログラムが格納されているアドレスに対して、分岐命令を直接実行することができるため、動作モードの移行に伴う処理時間が削減され、リアルタイム性が向上する。 With the above configuration, when the processor of the present invention executes the branch instruction from the user program to, for example, the address in the privileged program or the API program, the branch permission instruction is stored on the branch destination address. If not, the illegal branch detection unit outputs an illegal branch detection signal, so that a privileged program or the like can be prevented from being illegally executed by the user program, and security can be ensured. When a privileged program or an API program is properly executed from a user program, a branch instruction can be directly executed at an address where the privileged program or the API program desired to be executed on the user program is stored. Therefore, the processing time associated with the transition of the operation mode is reduced, and the real-time property is improved.
本発明のプロセッサは、前記CPUが実行している命令のプログラムカウンタの値によって実行領域を判定する実行領域判定部と、前記実行領域判定部の判定結果によって、実行中の動作モードを決定する実行動作モード決定部と、前記命令メモリに格納されているプログラムによって分岐命令が実行された際、分岐先アドレスの値によって分岐先領域を判定する分岐先領域判定部と、前記分岐先領域判定部の判定結果によって、前記分岐命令による移行先の動作モードを決定する分岐先動作モード決定部と、前記実行動作モード決定部によって決定された実行動作モードと、前記分岐先動作モードによって決定された移行先動作モードとを比較することによって動作モードが変更されたか否かを検出する動作モード変更検出部とをさらに備え、前記不正分岐検出部が、前記命令メモリに格納されているプログラムによって分岐命令が実行された際、分岐先アドレスに分岐許可命令が存在しない場合は、前記動作モード変更検出部によって動作モードの変更が検出されたことを条件として前記不正分岐検出信号を出力することが好ましい。 The processor according to the present invention includes: an execution region determining unit that determines an execution region based on a value of a program counter of an instruction executed by the CPU; and an execution unit that determines an operation mode being executed based on a determination result of the execution region determination unit. An operation mode determining unit, a branch destination region determining unit that determines a branch destination region based on a value of a branch destination address when a branch instruction is executed by a program stored in the instruction memory, and a branch destination region determining unit. A branch destination operation mode determining unit that determines an operation mode of a transfer destination by the branch instruction according to the determination result; an execution operation mode determined by the execution operation mode determination unit; and a transfer destination determined by the branch destination operation mode An operation mode change detection unit that detects whether the operation mode has been changed by comparing the operation mode with the operation mode; When the illegal branch detection unit executes the branch instruction by the program stored in the instruction memory, and there is no branch enable instruction at the branch destination address, the operation mode change detection unit changes the operation mode. It is preferable to output the illegal branch detection signal on the condition that the signal is detected.
前記の構成において、分岐許可命令には、他の命令と重複しない特定の命令コードを割り当てることが好ましい。これにより、他の命令を処理するための資源に影響を与えることがなく、リアルタイム性を向上させることができる。 In the above configuration, it is preferable that a specific instruction code that does not overlap with other instructions is assigned to the branch permission instruction. Thereby, the real-time property can be improved without affecting resources for processing other instructions.
また、本発明のプロセッサは、前記不正分岐検出部が、前記命令メモリに格納されているプログラムによって分岐命令が実行された際、分岐先アドレスに分岐許可命令が存在しない場合は、前記動作モード変更検出部によって動作モードの変更が検出され、かつ、前記動作モード変更検出部によって検出された動作モードの変更と分岐許可命令が指定する動作モードの変更とが一致しないことを条件として、不正分岐検出信号を出力することがさらに好ましい。また、この構成において、前記分岐許可命令には、1つまたは複数の他の命令に対応する命令コードを重複して割り当てることが好ましい。あるいは、分岐許可命令が検出された際、当該命令コードを他の命令に対応する命令コードに変換する分岐許可命令コード変換部をさらに備えた構成とすることも好ましい。 Further, in the processor according to the present invention, when the illegal branch detection unit executes a branch instruction according to a program stored in the instruction memory, if there is no branch enable instruction at a branch destination address, the operation mode change is performed. Illegal branch detection is performed on condition that a change in the operation mode is detected by the detection unit and that the change in the operation mode detected by the operation mode change detection unit does not match the change in the operation mode specified by the branch permission instruction. More preferably, a signal is output. In this configuration, it is preferable that an instruction code corresponding to one or a plurality of other instructions is assigned to the branch permission instruction in an overlapping manner. Alternatively, it is preferable that the apparatus further includes a branch permission instruction code conversion unit that converts the instruction code into an instruction code corresponding to another instruction when the branch permission instruction is detected.
また、本発明のプロセッサは、前記不正分岐検出部より前記不正分岐検出信号が出力されたことを検知すると、前記CPUに対して割り込み要求を出力する割り込み出力部をさらに備えた構成とすることが好ましい。 The processor of the present invention may further include an interrupt output unit that outputs an interrupt request to the CPU when detecting that the illegal branch detection signal is output from the illegal branch detection unit. preferable.
あるいは、本発明のプロセッサは、前記不正分岐検出部より前記不正分岐検出信号が出力されたことを検知すると、前記CPUに対してリセット信号を出力するリセット出力部をさらに備えた構成としても良い。 Alternatively, the processor of the present invention may further include a reset output unit that outputs a reset signal to the CPU when detecting that the illegal branch detection signal is output from the illegal branch detection unit.
また、本発明のプロセッサは、前記不正分岐検出部より前記不正分岐検出信号が出力されたことを検知すると、分岐先アドレスの命令を未定義命令に置き換える命令変換部をさらに備えた構成としても良い。 Further, the processor of the present invention may further include an instruction conversion unit that replaces an instruction at a branch destination address with an undefined instruction when detecting that the illegal branch detection signal is output from the illegal branch detection unit. .
また、上記の目的を達成するために、本発明にかかるコンパイラ装置は、上述のいずれかの構成にかかるプロセッサ用のプログラムを生成するコンパイラ装置であって、ソースプログラムをコンパイルしアセンブラに変換する際に、ソースプログラム内の関数構造と動作モードとを判定することにより、特権領域のプログラムの所定位置に前記分岐許可命令を挿入することを特徴とする。 In order to achieve the above object, a compiler device according to the present invention is a compiler device that generates a program for a processor according to any one of the configurations described above, and is used when compiling a source program and converting it into an assembler. The branch permission instruction is inserted at a predetermined position of the program in the privileged area by determining a function structure and an operation mode in the source program.
以下、本発明のプロセッサおよびコンパイラ装置の具体例について、図面を参照しながら説明する。 Hereinafter, specific examples of the processor and the compiler device of the present invention will be described with reference to the drawings.
(実施の形態1)
本発明のプロセッサの一実施形態について、図1を参照しながら説明する。
(Embodiment 1)
One embodiment of the processor of the present invention will be described with reference to FIG.
図1は、本実施形態のプロセッサ400を用いたICカードシステムを表すブロック図である。
FIG. 1 is a block diagram illustrating an IC card system using the
本実施形態のプロセッサ400を用いたICカードシステムは、図1に示すように、CPU401と、命令ROM402と、RAM403と、フラッシュメモリ404と、外部I/F405と、アンテナコイル406と、アドレスバス407aと、データバス407dと、割り込み制御回路408と、不正分岐検出回路409と、実行領域判定回路410と、実行動作モード決定回路411と、分岐先領域判定回路412と、分岐先動作モード決定回路413と、動作モード変更検出回路414とによって構成される。
As shown in FIG. 1, the IC card system using the
更に、CPU401は、命令フェッチ部4011と、命令解読部4012と、命令実行部4013と、プログラムカウンタ4014と、メモリアクセス制御回路4015とによって構成される。
Further, the
CPU401は、命令ROM402またはフラッシュメモリ404に格納された命令を読み出し実行していく。フラッシュメモリ404に対しては、アンテナコイル406および外部I/F405を介して、外部からプログラムデータを追加することが可能である。
The
図7は、本実施形態のプロセッサ400を用いたメモリ空間の領域区分の概念図である。
FIG. 7 is a conceptual diagram of an area division of a memory space using the
図7において、200は全論理アドレス空間を表し、命令ROM空間は特権領域211とAPI領域212に、RAM領域は特権領域221とAPI領域222とユーザ領域223に、フラッシュメモリはユーザ領域231に、外部I/Fはユーザ領域241に、それぞれ区分されている。
In FIG. 7,
図2は、本実施形態のプロセッサ400用のプログラム概念図である。
FIG. 2 is a conceptual diagram of a program for the
図2に示すように、特権領域中の特権プログラム501およびAPI領域中のAPIプログラム502のそれぞれには、ユーザ領域中のユーザプログラム503から、分岐命令(jmp)によって、特権領域中の特権プログラム501またはAPI領域中のAPIプログラム502に実行が移行する際に、分岐先アドレスが正当なアドレスかどうかを指定するための分岐許可命令(accept)を記述する。ここで、分岐許可命令(accept)は、既存命令の命令コードと一致しない特別の命令コードを持つ。
As shown in FIG. 2, the
実行領域判定回路410は、実行プログラムカウンタ値s4018から、図7に示したメモリ空間の領域区分に従い、現在実行されている命令の領域が特権領域、API領域、ユーザ領域のいずれであるかを判定する。判定結果は、実行領域判定信号s410として実行動作モード決定回路411へ出力される。実行動作モード決定回路411は、実行領域判定信号s410の値に従い、実行動作モードを、特権モード、APIモード、ユーザモードのいずれかに決定する。決定結果は、実行動作モード決定信号s411として出力される。
The execution
CPU401は、命令フェッチプログラムカウンタ値s4015または分岐先アドレス値s4014のいずれかをメモリアクセス制御回路4015によって選択して、メモリアクセスアドレス信号s4016として出力する。
The
分岐先領域判定回路412は、メモリアクセスアドレス信号s4016から、図7に示したメモリ空間の領域区分に従い、分岐先命令の領域が特権領域、API領域、ユーザ領域のいずれであるかを判定し、判定結果として分岐先領域判定信号s412を出力する。分岐先動作モード決定回路413は、分岐先領域判定信号s412の値に従い、動作モードを特権モード、APIモード、ユーザモードのいずれかに決定し、決定結果として分岐先動作モード決定信号s413を出力する。
The branch destination
動作モード変更検出回路414は、実行動作モード決定信号s411と分岐先動作モード決定信号s413から動作モードの変化を検出し、動作モード変更検出信号s414を出力する。
The operation mode
不正分岐検出回路409は、動作モード変更検出信号s414と命令フェッチデータs407dとに従い、以下の処理を行う。
The illegal
不正分岐検出回路409は、動作モード変更検出信号s414によって、ユーザプログラムからAPIプログラム、または、ユーザプログラムから特権プログラムへの実行の移行を伴う分岐命令が発生したと判定した場合は、分岐先アドレスに格納されている命令コードを解読し、ユーザプログラムからの分岐を許可する分岐許可命令(accept)でない場合は、不正分岐検出信号s409をアクティブとする。
If the illegal
なお、不正分岐検出回路409は、動作モード変更検出信号s414によって動作モードが変更しないと判定した場合、あるいは、動作モードが変更する場合であっても、その動作モードの変更が、ユーザプログラムからAPIプログラムへの変更、または、ユーザプログラムから特権プログラムへの変更のいずれでもないと判定した場合は、不正分岐検出信号s409を非アクティブとする。
Note that the illegal
CPU401内部での分岐許可命令(accept)に対する処理は、命令解読部4012を機能拡張し、命令実行部4013の制御をノーオペレーション命令と同一とすることで、CPU401内部のデータ・演算処理用の資源に影響を与えることなく、最短実行処理サイクルで実行される。
The processing for the branch permission instruction (accept) in the
以上により、動作モードの移行を伴う分岐命令が実行された際、分岐先アドレス上にその分岐命令の実行を許可する分岐許可命令が格納されていない場合は、不正分岐検出回路409が不正分岐検出信号s409を出力する。不正分岐検出信号s409は、OR回路415へ与えられる。OR回路415には、割り込み制御回路408から割り込み信号s4081も与えられており、不正分岐検出信号s409がアクティブである場合に、割り込み要求s40812がCPU401へ出力される。
As described above, when a branch instruction with an operation mode transition is executed, if the branch enable instruction that permits the execution of the branch instruction is not stored in the branch destination address, the illegal
これにより、例えばフラッシュメモリ404に外部から追加されたユーザプログラム等によって命令ROM402に格納された特権プログラムが不正に実行されることを防ぎ、セキュリティを確保できる。また、正当な処理の場合、実行を希望するプログラムが格納されているアドレスに対して直接分岐命令を実行できるので、動作モードの移行を最短実行処理サイクルで処理でき、リアルタイム性が向上する。
This prevents unauthorized execution of the privileged program stored in the
なお、本実施形態では、不正分岐検出信号s409がアクティブである場合にCPU401へ割り込み要求を出力する構成を例示したが、図1に示す割り込み制御回路408の代わりに、CPU401に対するリセット信号を出力するリセット制御回路を備えた構成としても良い。この場合、不正分岐検出信号s409がアクティブである場合に、CPU401へリセット信号s40812が出力されることとなり、上述の構成と同様に、特権プログラムが不正に実行されることを防ぐという効果が得られる。
In the present embodiment, an example has been described in which an interrupt request is output to the
(実施の形態2)
本発明の実施の形態2にかかるプロセッサ400を用いたICカードシステムについて、以下に説明する。
(Embodiment 2)
An IC card system using the
本実施形態のプロセッサ400を用いたICカードシステムのハードウェア構成は、実施の形態1のICカードシステムと同様である(図1参照)。また、本実施形態のプロセッサ400を用いたメモリ空間の領域区分も、実施の形態1と同様である(図7参照)。
The hardware configuration of an IC card system using the
図3は、本実施形態のプロセッサ400用のプログラム概念図である。
FIG. 3 is a conceptual diagram of a program for the
API領域中のAPIプログラム602には、ユーザ領域中のユーザプログラム603から分岐命令(jmp)によってAPI領域中のAPIプログラム602に実行が移行する際に、API領域中の分岐先アドレスが正当なアドレスかどうかを指定するための分岐許可命令(accept usr)を記述する。 When the execution shifts from the user program 603 in the user area to the API program 602 in the API area by a branch instruction (jmp), the branch destination address in the API area is a valid address. A branch permission instruction (accept usr) for specifying whether or not the instruction is described.
特権領域中の特権プログラム601には、ユーザ領域中のユーザプログラム603から分岐命令(jmp)によって特権領域中の特権プログラム601に実行が移行する際に、特権領域中の分岐先アドレスが正当なアドレスかどうかを指定するための分岐許可命令(accept usr)を記述する。
When execution shifts from the user program 603 in the user area to the
また、特権領域中の特権プログラム601には、API領域中のAPIプログラム602から分岐命令(jmp)によって特権領域中の特権プログラム601に実行が移行する際に、特権領域中の分岐先アドレスが正当なアドレスかどうかを指定するための分岐許可命令(accept api)を記述する。
Also, when execution shifts from the API program 602 in the API area to the
ここで、分岐許可命令(accept)は既存命令の命令コードと一致しない特別の命令コードを持つ。 Here, the branch permission instruction (accept) has a special instruction code that does not match the instruction code of the existing instruction.
実行領域判定回路410は、実行プログラムカウンタ値s4018から、図7に示したメモリ空間の領域区分に従い、現在実行されている命令の領域が特権領域、API領域、ユーザ領域のいずれであるかを判定し、判定結果として実行領域判定信号s410を出力する。実行動作モード決定回路411は、実行領域判定信号s410の値に従い、実行動作モードを特権モード、APIモード、ユーザモードのいずれかに決定する。決定結果は、実行動作モード決定信号s411として出力される。
The execution
CPU401は、命令フェッチプログラムカウンタ値s4015または分岐先アドレス値s4014いずれかをメモリアクセス制御回路4015によって選択し、メモリアクセスアドレス信号s4016として出力する。
The
分岐先領域判定回路412は、メモリアクセスアドレス信号s4016から、図7に示したメモリ空間の領域区分に従い、分岐先の領域が特権領域、API領域、ユーザ領域のいずれであるかを判定し、判定結果として分岐先領域判定信号s412を出力する。分岐先動作モード決定回路413は分岐先領域判定信号s412の値に従い動作モードを特権モード、APIモード、ユーザモードのいずれかに決定する。決定結果は、分岐先動作モード決定信号s413として出力される。
The branch destination
動作モード変更検出回路414は、実行動作モード決定信号s411と分岐先動作モード決定信号s413から動作モードの変化を検出し、動作モード変更検出信号s414を出力する。
The operation mode
不正分岐検出回路409は、動作モード変更検出信号s414と、命令フェッチデータs407dに従い、以下の処理を行う。
The illegal
不正分岐検出回路409は、動作モード変更検出信号s414によってユーザプログラムからAPIプログラムまたはユーザプログラムから特権プログラムへの実行の移行を伴う分岐命令が発生したことを判定した場合は、分岐先アドレスに格納されている命令コードを解読し、ユーザプログラムからの分岐を許可する分岐許可命令(accept usr)でない場合は、不正分岐検出信号s409をアクティブとする。
If the illegal
不正分岐検出回路409は、動作モード変更検出信号s414によってAPIプログラムから特権プログラムへの実行の移行を伴う分岐命令が発生したことを判定した場合は、分岐先アドレスに格納されている命令コードを解読し、ユーザプログラムからの分岐を許可する分岐許可命令(accept usr)またはAPIプログラムからの分岐を許可する分岐許可命令(accept api)でない場合は、不正分岐検出信号s409をアクティブとする。
If the illegal
不正分岐検出回路409は、動作モード変更検出信号s414によって、動作モードが変更しないと判定した場合、あるいは、動作モードが変更する場合であっても、その動作モードの変更が、ユーザプログラムからAPIプログラムへの変更、ユーザプログラムから特権プログラム、または、APIプログラムから特権プログラムへの変更のいずれでもないと判定した場合は、不正分岐検出信号s409を非アクティブとする。
If the operation mode change detection signal s414 determines that the operation mode is not changed, or if the operation mode is changed, the illegal
CPU401内部の分岐許可命令(accept)に対する処理は、命令解読部4012を機能拡張し、命令実行部4013の制御をノーオペレーション命令と同一にすることで、CPU401内部のデータ・演算処理用の資源に影響を与えることなく、最短実行処理サイクルで実行される。
The processing for the branch permission instruction (accept) inside the
以上により、動作モードの移行を伴う分岐命令が実行された際、分岐先アドレス上にその分岐命令の実行を許可する分岐許可命令が格納されていない場合は、不正分岐検出回路409が不正分岐検出信号s409を出力する。
As described above, when a branch instruction with an operation mode transition is executed, if the branch enable instruction that permits the execution of the branch instruction is not stored in the branch destination address, the illegal
不正分岐検出信号s409は、OR回路415へ与えられる。OR回路415には、割り込み制御回路408から割り込み信号s4081も与えられており、不正分岐検出信号s409がアクティブである場合に、割り込み要求s40812がCPU401へ出力される。これにより、フラッシュメモリ404に外部から追加されたユーザプログラム等によって命令ROM402に格納された特権プログラムが不正に実行されることを防ぎ、セキュリティを確保できる。正当な処理の場合、実行を希望するプログラムが格納されているアドレスに対して直接分岐命令を実行できるので、動作モードの移行を最短実行処理サイクルで処理でき、リアルタイム性が向上する。
The illegal branch detection signal s409 is provided to the OR circuit 415. The OR circuit 415 is also provided with an interrupt signal s4081 from the interrupt
なお、本実施形態では、不正分岐検出信号s409がアクティブである場合にCPU401へ割り込み要求を出力する構成を例示したが、図1に示す割り込み制御回路408の代わりに、CPU401に対するリセット信号を出力するリセット制御回路を備えた構成としても良い。この場合、不正分岐検出信号s409がアクティブである場合に、CPU401へリセット信号s40812が出力されることとなり、上述の構成と同様に、特権プログラムが不正に実行されることを防ぐという効果が得られる。
In the present embodiment, an example has been described in which an interrupt request is output to the
(実施の形態3)
本発明の実施の形態3にかかるプロセッサ400を用いたICカードシステムについて、以下に説明する。
(Embodiment 3)
An IC card system using the
本実施形態のプロセッサ400を用いたICカードシステムのハードウェア構成は、実施の形態1のICカードシステムと同様である(図1参照)。また、本実施形態のプロセッサ400を用いたメモリ空間の領域区分も、実施の形態1と同様である(図7参照)。
The hardware configuration of an IC card system using the
図3は、本実施形態のプロセッサ400用のプログラム概念図である。
FIG. 3 is a conceptual diagram of a program for the
API領域中のAPIプログラム602には、ユーザ領域中のユーザプログラム603から分岐命令(jmp)によってAPI領域中のAPIプログラム602に実行が移行する際に、API領域中の分岐先アドレスが正当なアドレスかどうかを指定するための分岐許可命令(accept usr)を記述する。 When the execution shifts from the user program 603 in the user area to the API program 602 in the API area by a branch instruction (jmp), the branch destination address in the API area is a valid address. A branch permission instruction (accept usr) for specifying whether or not the instruction is described.
特権領域中の特権プログラム601には、ユーザ領域中のユーザプログラム603から分岐命令(jmp)によって特権領域中の特権プログラム601に実行が移行する際に、特権領域中の分岐先アドレスが正当なアドレスかどうかを指定するための分岐許可命令(accept usr)を記述する。
When execution shifts from the user program 603 in the user area to the
また特権領域中の特権プログラム601には、API領域中のAPIプログラム602から分岐命令(jmp)によって特権領域中の特権プログラム601に実行が移行する際に、特権領域中の分岐先アドレスが正当なアドレスかどうかを指定するための分岐許可命令(accept api)を記述する。
When execution shifts from the API program 602 in the API area to the
上述のように、本実施形態のプロセッサ400用のプログラム記述方法は、実施の形態2と同じである。しかし、本実施形態のプロセッサ400は、ユーザプログラムからの分岐を許可する分岐許可命令(accept usr)およびAPIプログラムからの分岐を許可する分岐許可命令(accept api)に、それぞれ特殊な命令コードを割り当てず、実プログラム上での使用頻度が低く、かつ、CPU401のデータ・演算処理用の資源に影響を与えることのない、既存命令のいずれかと同じ命令コードを重複して割り当てる点において、実施の形態2と異なっている。
As described above, the program description method for the
実行領域判定回路410は、実行プログラムカウンタ値s4018から、図7に示したメモリ空間の領域区分に従い、現在実行されている命令の領域が特権領域、API領域、ユーザ領域のいずれであるかを判定し、判定結果として実行領域判定信号s410を出力する。実行動作モード決定回路411は、実行領域判定信号s410の値に従い、実行動作モードを特権モード、APIモード、ユーザモードのいずれかに決定する。決定結果は、実行動作モード決定信号s411として出力される。
The execution
CPU401は、命令フェッチプログラムカウンタ値s4015または分岐先アドレス値s4014いずれかをメモリアクセス制御回路4015によって選択し、メモリアクセスアドレス信号s4016として出力する。
The
分岐先領域判定回路412は、メモリアクセスアドレス信号s4016から、図7に示したメモリ空間の領域区分に従い、分岐先命令の領域が特権領域、API領域、ユーザ領域のいずれであるかを判定し、判定結果として分岐先領域判定信号s412を出力する。分岐先動作モード決定回路413は、分岐先領域判定信号s412の値に従い、動作モードを特権モード、APIモード、ユーザモードのいずれかに決定する。決定結果は、分岐先動作モード決定信号s413として出力される。
The branch destination
動作モード変更検出回路414は、実行動作モード決定信号s411と分岐先動作モード決定信号s413から動作モードの変化を検出し、動作モード変更検出信号s414を出力する。
The operation mode
不正分岐検出回路409は、動作モード変更検出信号s414と、命令フェッチデータs407dに従い、以下の処理を行う。
The illegal
不正分岐検出回路409は、動作モード変更検出信号s414によって、ユーザプログラムからAPIプログラムへ、または、ユーザプログラムから特権プログラムへの実行の移行を伴う分岐命令が発生したことを判定した場合は、分岐先アドレスに格納されている命令コードを解読し、ユーザプログラムからの分岐を許可する分岐許可命令(accept usr)でない場合は、不正分岐検出信号s409をアクティブとする。
If the illegal
不正分岐検出回路409は、動作モード変更検出信号s414によって、APIプログラムから特権プログラムへの実行の移行を伴う分岐命令が発生したことを判定した場合は、分岐先アドレスに格納されている命令コードを解読し、ユーザプログラムからの分岐を許可する分岐許可命令(accept usr)またはAPIプログラムからの分岐を許可する分岐許可命令(accept api)でない場合は、不正分岐検出信号s409をアクティブとする。
If the illegal
不正分岐検出回路409は、動作モード変更検出信号s414によって、動作モードが変更しないと判定した場合、あるいは、動作モードが変更する場合であっても、その動作モードの変更が、ユーザプログラムからAPIプログラムへの変更、ユーザプログラムから特権プログラム、またはAPIプログラムから特権プログラムへの変更のいずれでもないと判定した場合は、不正分岐検出信号s409を非アクティブとする。
If the operation mode change detection signal s414 determines that the operation mode is not changed, or if the operation mode is changed, the illegal
分岐許可命令(accept)は既存命令と同一の命令コードに割り当てられているため、命令解読部4012は既存のものを使用できる。また、CPU401内部の分岐許可命令(accept)に対する処理は、割り当てられた既存命令と同一の実行処理内容、実行処理サイクルで実行される。
Since the branch permission instruction (accept) is assigned to the same instruction code as the existing instruction, the
以上により、動作モードの移行を伴う分岐命令が実行された際、分岐先アドレス上にその分岐命令の実行を許可する分岐許可命令が格納されていない場合は、不正分岐検出回路409が不正分岐検出信号s409を出力する。
As described above, when a branch instruction with an operation mode transition is executed, if the branch enable instruction that permits the execution of the branch instruction is not stored in the branch destination address, the illegal
不正分岐検出信号s409は、OR回路415へ与えられる。OR回路415には、割り込み制御回路408から割り込み信号s4081も与えられており、不正分岐検出信号s409がアクティブである場合に、割り込み要求s40812がCPU401へ出力される。例えばフラッシュメモリ404に外部から追加されたユーザプログラム等によって命令ROM402に格納された特権プログラムが不正に実行されることを防ぎ、セキュリティを確保できる。
The illegal branch detection signal s409 is provided to the OR circuit 415. The OR circuit 415 is also provided with an interrupt signal s4081 from the interrupt
正当な処理の場合、実行を希望するプログラムが格納されているアドレスに対して直接分岐命令を実行できるので、動作モードの移行を分岐許可命令に割り当てられた既存命令1命令分と同一の実行処理サイクルで処理でき、リアルタイム性が向上する。また、CPU401に関しては既存のものを流用できるため設計容易性が高い。 In the case of legitimate processing, a branch instruction can be directly executed at the address where the program desired to be executed is stored, so that the operation mode shifts to the same execution processing as one existing instruction assigned to the branch enable instruction. Can be processed in cycles, improving real-time performance. In addition, since the existing CPU can be used, the design is easy.
なお、本実施形態では、不正分岐検出信号s409がアクティブである場合にCPU401へ割り込み要求を出力する構成を例示したが、図1に示す割り込み制御回路408の代わりに、CPU401に対するリセット信号を出力するリセット制御回路を備えた構成としても良い。この場合、不正分岐検出信号s409がアクティブである場合に、CPU401へリセット信号s40812が出力されることとなり、上述の構成と同様に、特権プログラムが不正に実行されることを防ぐという効果が得られる。
In the present embodiment, an example has been described in which an interrupt request is output to the
(実施の形態4)
図4は、実施の形態4にかかるプロセッサ700を用いたICカードシステムを表すブロック図である。
(Embodiment 4)
FIG. 4 is a block diagram illustrating an IC card system using the
本実施形態のプロセッサ700を用いたICカードシステムは、図4に示すように、CPU701と、命令ROM702と、RAM703と、フラッシュメモリ704と、外部I/F705と、アンテナコイル706と、アドレスバス707aと、データバス707dと、割り込み制御回路708と、不正分岐検出回路709と、実行領域判定回路710と、実行動作モード決定回路711と、分岐先領域判定回路712と、分岐先動作モード決定回路713と、動作モード変更検出回路714と、分岐許可命令コード変換回路715とによって構成される。
As shown in FIG. 4, the IC card system using the
更に、CPU701は、命令フェッチ部7011と、命令解読部7012と、命令実行部7013と、プログラムカウンタ7014と、メモリアクセス制御回路7015とによって構成される。
Further, the
CPU701は、命令ROM702またはフラッシュメモリ704に格納された命令を読み出し実行していく。フラッシュメモリ704に対しては、アンテナコイル706および外部I/F705を介して、外部からプログラムデータを追加することが可能である。
The
本実施形態のプロセッサ700を用いたメモリ空間の領域区分の概念図は、実施の形態1で説明した図7のとおりである。
The conceptual diagram of the area division of the memory space using the
図3は、実施の形態4のプロセッサ700用のプログラム概念図である。
FIG. 3 is a conceptual diagram of a program for a
API領域中のAPIプログラム602には、ユーザ領域中のユーザプログラム603から分岐命令(jmp)によってAPI領域中のAPIプログラム602に実行が移行する際に、API領域中の分岐先アドレスが正当なアドレスかどうかを指定するための分岐許可命令(accept usr)を記述する。 When the execution shifts from the user program 603 in the user area to the API program 602 in the API area by a branch instruction (jmp), the branch destination address in the API area is a valid address. A branch permission instruction (accept usr) for specifying whether or not the instruction is described.
特権領域中の特権プログラム601には、ユーザ領域中のユーザプログラム603から分岐命令(jmp)によって特権領域中の特権プログラム601に実行が移行する際に、特権領域中の分岐先アドレスが正当なアドレスかどうかを指定するための分岐許可命令(accept usr)を記述する。
When execution shifts from the user program 603 in the user area to the
また特権領域中の特権プログラム601には、API領域中のAPIプログラム602から分岐命令(jmp)によって特権領域中の特権プログラム601に実行が移行する際に、特権領域中の分岐先アドレスが正当なアドレスかどうかを指定するための分岐許可命令(accept api)を記述する。
When execution shifts from the API program 602 in the API area to the
すなわち、本実施形態のプロセッサ700用のプログラム記述は、前述の実施の形態3と同様である。ただし、本実施形態では、分岐許可命令(accept)は、既存命令の命令コードと一致しない特別の命令コードを持つ。
That is, the program description for the
実行領域判定回路710は、実行プログラムカウンタ値s7018から、図7に示したメモリ空間の領域区分に従い、現在実行されている命令の領域が特権領域、API領域、ユーザ領域のいずれであるかを判定し、判定結果として実行領域判定信号s710を出力する。実行動作モード決定回路711は、実行領域判定信号s710の値に従い、実行動作モードを特権モード、APIモード、ユーザモードのいずれかに決定する。決定結果は、実行動作モード決定信号s711として出力される。
The execution
CPU701は、命令フェッチプログラムカウンタ値s7015または分岐先アドレス値s7014いずれかをメモリアクセス制御回路7015によって選択し、メモリアクセスアドレス信号s7016として出力する。
The
分岐先領域判定回路712は、メモリアクセスアドレス信号s7016から、図7に示したメモリ空間の領域区分に従い、分岐先命令の領域が特権領域、API領域、ユーザ領域のいずれであるかを判定し、判定結果として分岐先領域判定信号s712を出力する。分岐先動作モード決定回路713は、分岐先領域判定信号s712の値に従い、動作モードを特権モード、APIモード、ユーザモードのいずれかに決定する。決定結果は、分岐先動作モード決定信号s713として出力される。
The branch destination
動作モード変更検出回路714は、実行動作モード決定信号s711と分岐先動作モード決定信号s713から動作モードの変化を検出し、動作モード変更検出信号s714を出力する。
The operation mode
不正分岐検出回路709は、動作モード変更検出信号s714と、命令フェッチデータs707dに従い、以下の処理を行う。
The illegal
不正分岐検出回路709は、動作モード変更検出信号s714によって、ユーザプログラムからAPIプログラム、または、ユーザプログラムから特権プログラムへの実行の移行を伴う分岐命令が発生したことを判定した場合は、分岐先アドレスに格納されている命令コードを解読し、ユーザプログラムからの分岐を許可する分岐許可命令(accept usr)でない場合は、不正分岐検出信号s709をアクティブとする。
If the illegal
不正分岐検出回路709は、動作モード変更検出信号s714によって、APIプログラムから特権プログラムへの実行の移行を伴う分岐命令が発生したことを判定した場合は、分岐先アドレスに格納されている命令コードを解読し、ユーザプログラムからの分岐を許可する分岐許可命令(accept usr)またはAPIプログラムからの分岐を許可する分岐許可命令(accept api)でない場合は、不正分岐検出信号s709をアクティブとする。
If the illegal
不正分岐検出回路709は、動作モード変更検出信号s714によって、動作モードが変更しないと判定した場合、あるいは、動作モードが変更する場合であっても、その動作モードの変更が、ユーザプログラムからAPIプログラムへの変更、ユーザプログラムから特権プログラム、またはAPIプログラムから特権プログラムへの変更のいずれでもないと判定した場合は、不正分岐検出信号s709を非アクティブとする。
When the operation mode change detection signal s714 determines that the operation mode is not changed, or even when the operation mode is changed, the illegal
分岐許可命令コード変換回路715は、不正分岐検出信号s709が非アクティブな場合は、ユーザプログラムからの分岐を許可する分岐許可命令(accept usr)の命令コードまたはAPIプログラムからの分岐を許可する分岐許可命令(accept api)からノーオペレーション命令へ、不正分岐検出信号s709がアクティブな場合は、すべての命令コードから未定義命令へ、命令フェッチデータs707dのデータ変換を行い、CPU701に対し、命令フェッチデータ信号s7011を出力する。
When the illegal branch detection signal s709 is inactive, the branch permission instruction
分岐許可命令をCPU701が持っている既存命令に変換することで、命令解読部7012は既存のものを使用できる。また、CPU701内部での処理は、割り当てられた既存命令と同一の実行処理内容、実行処理サイクルで実行される。
By converting the branch permission instruction into an existing instruction of the
以上により、動作モードの移行を伴う分岐命令が実行された際、分岐先アドレス上にその分岐命令の実行を許可する分岐許可命令が格納されていない場合は、不正分岐検出回路709が割り込み要求信号s709を出力するため、例えばフラッシュメモリ404に外部から追加されたユーザプログラム等によって命令ROM402に格納された特権プログラムが不正に実行されることを防ぎ、セキュリティを確保できる。
As described above, when a branch instruction with an operation mode transition is executed, if the branch enable instruction that permits the execution of the branch instruction is not stored in the branch destination address, the illegal
また、分岐許可命令コード変換回路715が、CPU701に対し、未定義命令に変換された命令フェッチデータ信号s7011を出力することによって、CPU701に対し未定義命令による例外処理を発生させる。これにより、以降の命令実行が妨げられ、セキュリティを確保できる。
The branch permission instruction
正当な処理の場合、実行を希望するプログラムが格納されているアドレスに対して直接分岐命令を実行できるので、動作モードの移行を最短実行処理サイクルで処理でき、リアルタイム性が向上する。また、CPU701に関しては既存のものを流用できるため設計容易性が高い。
In the case of legitimate processing, a branch instruction can be directly executed at the address where the program desired to be executed is stored, so that the transition of the operation mode can be processed in the shortest execution processing cycle, and the real-time property is improved. Further, as for the
なお、上述の実施の形態1〜4では、不正分岐検出部、実行領域判定部、実行動作モード決定部等のそれぞれを別個独立した回路として形成したが、これらの各部ブロックをどのように実装するかは任意である。すなわち、例えば、実行領域判定部と実行動作モード決定部のような複数のブロックを一つの回路で実現した構成も、本発明の技術的範囲に属する。 In the above-described first to fourth embodiments, each of the illegal branch detection unit, the execution region determination unit, the execution operation mode determination unit, and the like is formed as a separate and independent circuit, but how these unit blocks are implemented. Is optional. That is, for example, a configuration in which a plurality of blocks such as an execution region determination unit and an execution operation mode determination unit are realized by one circuit also belongs to the technical scope of the present invention.
また、実施の形態1〜4では、本発明のプロセッサをICカードシステムに適用した例を示したが、本発明のプロセッサの用途はこれに限定されない。 Further, in the first to fourth embodiments, an example in which the processor of the present invention is applied to an IC card system has been described, but the application of the processor of the present invention is not limited to this.
(実施の形態5)
図5は、実施の形態5を用いたコンパイラ装置の構成およびコンパイルフローである。
(Embodiment 5)
FIG. 5 shows a configuration and a compilation flow of a compiler device using the fifth embodiment.
本実施形態にかかるコンパイラ802は、C言語ソースコード801を入力してコンパイルし、アセンブラ803に変換する。
The
C言語ソースコード801は、ユーザ領域中に記述されたメイン関数(main#1)16011と、特権領域中に記述された関数16012(function#a)と関数16013(function#b)によって構成されている。また、ユーザプログラムのメイン関数(main#1)16011は、プログラム中で関数16012(function#a)および関数16013(function#b)を呼び出し使用する。
The C
コンパイラ802は、コンパイルを行う際に、C言語ソースコード801中の関数が、それぞれ特権領域、ユーザ領域のいずれに記述されているか判定し、特権領域中に記述された関数を特権プログラムとして決定する。コンパイラ802は、コンパイルを実行する際に、特権プログラムのソースコードから生成されるアセンブラコードの先頭に、分岐許可命令(accept)16032,16033を挿入する。
When compiling, the
以上により、特権領域中のプログラムの開発を行う設計者は、C言語によるプログラム記述方法を使用しても、コンパイル時に分岐許可命令(accept)が自動挿入され、動作モードの移行を伴う分岐が発生した際の命令実行に対するセキュリティを確保できる。 As described above, even if the designer who develops a program in the privileged area uses the program description method in the C language, a branch permission instruction (accept) is automatically inserted at the time of compiling, and a branch accompanied by an operation mode transition occurs. Security for the execution of the instruction at the time of execution can be ensured.
以上のように、ユーザプログラムから特権プログラムまたはAPIプログラム中のアドレスに対して分岐命令が実行された際、分岐先アドレス上に分岐許可命令が格納されていない場合は不正分岐検出部が不正分岐検出信号を出力するため、ユーザプログラムによって特権プログラムが不正に実行されることを防ぎセキュリティを確保できる。またユーザプログラム上から特権プログラムまたはAPIプログラムを正当に実行する際、ユーザプログラム上で実行を希望する特権プログラムまたはAPIプログラムが格納されているアドレスに対して直接分岐命令を実行することができるため、動作モードの移行に伴う処理時間が削減されリアルタイム性が向上する。 As described above, when the branch instruction is executed from the user program to the address in the privileged program or the API program, if the branch enable instruction is not stored in the branch destination address, the illegal branch detection unit detects the illegal branch. Since the signal is output, the privilege program can be prevented from being illegally executed by the user program, and security can be ensured. In addition, when a privileged program or an API program is properly executed from a user program, a branch instruction can be directly executed at an address where the privileged program or the API program desired to be executed on the user program is stored. The processing time associated with the transition of the operation mode is reduced, and the real-time property is improved.
200 全論理アドレス空間
211 命令ROM空間特権領域
212 命令ROM空間API領域
221 RAM空間特権領域
222 RAM空間API領域
223 RAM空間ユーザ領域
231 フラッシュ空間ユーザ領域
241 外部I/F空間ユーザ領域
301 特権領域
302 ユーザ領域
400 プロセッサ
401,701 CPU
4011,7011 命令フェッチ部
4012,7012 命令解読部
4013,7013 命令実行部
4014,7014 プログラムカウンタ
4015,7015 メモリアクセス制御回路
402,702 命令ROM
403,703 RAM
404,704 フラッシュメモリ
405,705 外部I/F
406,706 アンテナコイル
407a,707a アドレスバス
407d,707d データバス
408,708 割り込み制御回路
409,709 不正分岐検出回路
410,710 実行領域判定回路
411,711 実行動作モード決定回路
412,712 分岐先領域判定回路
413,713 分岐先動作モード決定回路
414,714 動作モード変更検出回路
501 特権領域
502 API領域
503 ユーザ領域
600 プロセッサ
601 特権領域
602 API領域
603 ユーザ領域
715 分岐許可命令コード変換回路
801 C言語ソースコード
802 コンパイラ
803 アセンブラソースファイル
200 All
4011, 7011 instruction fetch
403,703 RAM
404, 704
406,706 Antenna coil 407a,
Claims (10)
プログラムを格納するための命令メモリと、
前記命令メモリに格納されているプログラムによって、動作モードを異なる動作モードへ変更する分岐命令が実行された際、分岐先アドレスに分岐許可命令が存在するか否かを判断し、前記分岐許可命令が存在する場合は動作モードの変更を許可する一方、前記分岐許可命令が存在しない場合は不正分岐検出信号を出力する不正分岐検出部とを備えたことを特徴とするプロセッサ。 A CPU,
An instruction memory for storing programs,
When a branch instruction for changing an operation mode to a different operation mode is executed by a program stored in the instruction memory, it is determined whether or not a branch permission instruction is present at a branch destination address. A processor comprising: an illegal branch detection unit that permits an operation mode change when the instruction is present, and outputs an illegal branch detection signal when the branch permission instruction is not present.
前記実行領域判定部の判定結果によって、実行中の動作モードを決定する実行動作モード決定部と、
前記命令メモリに格納されているプログラムによって分岐命令が実行された際、分岐先アドレスの値によって分岐先領域を判定する分岐先領域判定部と、
前記分岐先領域判定部の判定結果によって、前記分岐命令による移行先の動作モードを決定する分岐先動作モード決定部と、
前記実行動作モード決定部によって決定された実行動作モードと、前記分岐先動作モード決定部によって決定された移行先動作モードとを比較することによって動作モードが変更されたか否かを検出する動作モード変更検出部とをさらに備え、
前記不正分岐検出部が、前記命令メモリに格納されているプログラムによって分岐命令が実行された際、分岐先アドレスに分岐許可命令が存在しない場合は、前記動作モード変更検出部によって動作モードの変更が検出されたことを条件として前記不正分岐検出信号を出力する、請求項1に記載のプロセッサ。 An execution area determination unit that determines an execution area based on a value of a program counter of an instruction executed by the CPU;
An execution operation mode determination unit that determines an operation mode being executed according to a determination result of the execution region determination unit;
When a branch instruction is executed by a program stored in the instruction memory, a branch destination area determination unit that determines a branch destination area based on a value of a branch destination address;
A branch destination operation mode determination unit that determines an operation mode of a transition destination by the branch instruction according to a determination result of the branch destination area determination unit;
An operation mode change that detects whether or not the operation mode has been changed by comparing the execution operation mode determined by the execution operation mode determination unit with the transition destination operation mode determined by the branch destination operation mode determination unit. Further comprising a detection unit,
When the illegal branch detection unit executes the branch instruction by the program stored in the instruction memory, if the branch permission instruction does not exist at the branch destination address, the operation mode change detection unit changes the operation mode. The processor according to claim 1, wherein the processor outputs the illegal branch detection signal on condition that the signal is detected.
ソースプログラムをコンパイルしアセンブラに変換する際に、ソースプログラム内の関数構造と動作モードとを判定することにより、特権領域のプログラムの所定位置に前記分岐許可命令を挿入することを特徴とするコンパイラ装置。 A compiler device for generating a processor program according to any one of claims 1 to 9,
Compiler apparatus which inserts the branch permission instruction at a predetermined position of a program in a privileged area by determining a function structure and an operation mode in the source program when compiling the source program and converting it into an assembler. .
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2004048531A JP2004280801A (en) | 2003-02-24 | 2004-02-24 | Processor and compiler apparatus for generating program for the processor |
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2003046484 | 2003-02-24 | ||
JP2004048531A JP2004280801A (en) | 2003-02-24 | 2004-02-24 | Processor and compiler apparatus for generating program for the processor |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2004280801A true JP2004280801A (en) | 2004-10-07 |
Family
ID=33301694
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2004048531A Withdrawn JP2004280801A (en) | 2003-02-24 | 2004-02-24 | Processor and compiler apparatus for generating program for the processor |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2004280801A (en) |
Cited By (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2007020758A1 (en) * | 2005-08-15 | 2007-02-22 | Matsushita Electric Industrial Co., Ltd. | Lsi for ic card |
GB2448149A (en) * | 2007-04-03 | 2008-10-08 | Advanced Risc Mach Ltd | Protected function calling across domains |
US7966466B2 (en) | 2007-04-03 | 2011-06-21 | Arm Limited | Memory domain based security control with data processing systems |
US8006078B2 (en) | 2007-04-13 | 2011-08-23 | Samsung Electronics Co., Ltd. | Central processing unit having branch instruction verification unit for secure program execution |
JP2013161479A (en) * | 2012-02-08 | 2013-08-19 | Arm Ltd | Data processing apparatus and method using secure domain and less secure domain |
JP2013539574A (en) * | 2010-08-11 | 2013-10-24 | アーム・リミテッド | Incorrect mode change operation |
JP2014073397A (en) * | 2013-11-26 | 2014-04-24 | Daito Giken:Kk | Game machine |
US10025923B2 (en) | 2012-02-08 | 2018-07-17 | Arm Limited | Data processing apparatus and method for protecting secure data and program code from non-secure access when switching between secure and less secure domains |
US10083040B2 (en) | 2012-02-08 | 2018-09-25 | Arm Limited | Exception handling in a data processing apparatus having a secure domain and a less secure domain |
US10169573B2 (en) | 2012-02-08 | 2019-01-01 | Arm Limited | Maintaining secure data isolated from non-secure access when switching between domains |
US10210349B2 (en) | 2012-02-08 | 2019-02-19 | Arm Limited | Data processing apparatus and method using secure domain and less secure domain |
WO2020095410A1 (en) * | 2018-11-08 | 2020-05-14 | ソニー株式会社 | Communication device |
-
2004
- 2004-02-24 JP JP2004048531A patent/JP2004280801A/en not_active Withdrawn
Cited By (17)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2007020758A1 (en) * | 2005-08-15 | 2007-02-22 | Matsushita Electric Industrial Co., Ltd. | Lsi for ic card |
GB2448149A (en) * | 2007-04-03 | 2008-10-08 | Advanced Risc Mach Ltd | Protected function calling across domains |
JP2008257735A (en) * | 2007-04-03 | 2008-10-23 | Arm Ltd | Protected function calling |
GB2448149B (en) * | 2007-04-03 | 2011-05-18 | Advanced Risc Mach Ltd | Protected function calling |
US7966466B2 (en) | 2007-04-03 | 2011-06-21 | Arm Limited | Memory domain based security control with data processing systems |
US8010772B2 (en) | 2007-04-03 | 2011-08-30 | Arm Limited | Protected function calling |
US8006078B2 (en) | 2007-04-13 | 2011-08-23 | Samsung Electronics Co., Ltd. | Central processing unit having branch instruction verification unit for secure program execution |
JP2013539574A (en) * | 2010-08-11 | 2013-10-24 | アーム・リミテッド | Incorrect mode change operation |
US8959318B2 (en) | 2010-08-11 | 2015-02-17 | Arm Limited | Illegal mode change handling |
JP2013161479A (en) * | 2012-02-08 | 2013-08-19 | Arm Ltd | Data processing apparatus and method using secure domain and less secure domain |
US10025923B2 (en) | 2012-02-08 | 2018-07-17 | Arm Limited | Data processing apparatus and method for protecting secure data and program code from non-secure access when switching between secure and less secure domains |
US10083040B2 (en) | 2012-02-08 | 2018-09-25 | Arm Limited | Exception handling in a data processing apparatus having a secure domain and a less secure domain |
US10169573B2 (en) | 2012-02-08 | 2019-01-01 | Arm Limited | Maintaining secure data isolated from non-secure access when switching between domains |
US10210349B2 (en) | 2012-02-08 | 2019-02-19 | Arm Limited | Data processing apparatus and method using secure domain and less secure domain |
JP2014073397A (en) * | 2013-11-26 | 2014-04-24 | Daito Giken:Kk | Game machine |
WO2020095410A1 (en) * | 2018-11-08 | 2020-05-14 | ソニー株式会社 | Communication device |
US11422949B2 (en) | 2018-11-08 | 2022-08-23 | Sony Group Corporation | Communication device |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP3757853B1 (en) | Cryptographic computing using encrypted base addresses and used in multi-tenant environments | |
US11416624B2 (en) | Cryptographic computing using encrypted base addresses and used in multi-tenant environments | |
US7367057B2 (en) | Processor based system and method for virus detection | |
US20220382885A1 (en) | Cryptographic computing using encrypted base addresses and used in multi-tenant environments | |
US8745406B2 (en) | Program executable image encryption | |
Tullsen et al. | Storageless value prediction using prior register values | |
CN110659244A (en) | Inline coding capability | |
US20130054934A1 (en) | Method and Apparatus for Performing Mapping Within a Data Processing System Having Virtual Machines | |
KR20130036189A (en) | Restricting memory areas for an instruction read in dependence upon a hardware mode and a security flag | |
JP2013533567A (en) | Memory access control | |
US8132002B2 (en) | Fast system call method | |
US20010005882A1 (en) | Circuit and method for initiating exception routines using implicit exception checking | |
KR20130137591A (en) | Illegal mode change handling | |
JP2004280801A (en) | Processor and compiler apparatus for generating program for the processor | |
US20080140995A1 (en) | Information processor and instruction fetch control method | |
US20040168047A1 (en) | Processor and compiler for creating program for the processor | |
JP3202497B2 (en) | Information processing device | |
Sinharoy et al. | Advanced features in IBM POWER8 systems | |
US20070050619A1 (en) | Processor having program protection function | |
JP2005084721A (en) | Microcomputer | |
JP2005275841A (en) | Memory protection system | |
US7143270B1 (en) | System and method for adding an instruction to an instruction set architecture | |
JP2007286921A (en) | Information processor and security release program unauthorized execution prohibition method using it | |
JPH05257815A (en) | Central processing unit | |
WO2023188905A1 (en) | Information processing device and method for controlling operation of information processing device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A300 | Withdrawal of application because of no request for examination |
Free format text: JAPANESE INTERMEDIATE CODE: A300 Effective date: 20070501 |