JP2015035155A - Information processor - Google Patents
Information processor Download PDFInfo
- Publication number
- JP2015035155A JP2015035155A JP2013166466A JP2013166466A JP2015035155A JP 2015035155 A JP2015035155 A JP 2015035155A JP 2013166466 A JP2013166466 A JP 2013166466A JP 2013166466 A JP2013166466 A JP 2013166466A JP 2015035155 A JP2015035155 A JP 2015035155A
- Authority
- JP
- Japan
- Prior art keywords
- cpu
- information processing
- access
- processing apparatus
- peripheral devices
- 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
Links
Images
Abstract
Description
この発明は、メモリ保護ユニットを用いてメモリおよび周辺デバイスへのアクセスを制限する情報処理装置に関する。 The present invention relates to an information processing apparatus that restricts access to a memory and peripheral devices using a memory protection unit.
組込みソフトウェアの大規模化に伴い、各機能を安全に動作させるために組込みシステムにおいてもメモリ保護の必要性が高まっている。メモリ保護とは、組込みソフトウェアを構成するアプリケーションソフトウェアごとにアクセス可能なメモリおよび周辺デバイスを制限することである。 As the scale of embedded software increases, the need for memory protection is increasing in embedded systems in order to operate each function safely. Memory protection is to limit the accessible memory and peripheral devices for each application software constituting the embedded software.
組込みシステムでは、メモリ保護ユニット(MPU:Memory Protection Unit)と呼ばれるハードウェアによってメモリ保護を実現することが多い。MPUはアドレス空間に複数の領域を設定し、その領域毎にアクセス権を与える(MPUの概要は、たとえば、下記の非特許文献1,2を参照)。
In embedded systems, memory protection is often realized by hardware called a memory protection unit (MPU). The MPU sets a plurality of areas in the address space and gives an access right for each area (for example, refer to the following
MPUによって設定できる領域の数には上限があり、通常は10個以下である。このため、一般的なOSとアプリケーションプログラムとを動作させると、メモリの保護のために多数の領域を使用してしまい、周辺デバイスの保護に使用可能な領域の数が不足する。この結果、各周辺デバイス単位でのアクセス保護が実現できないという問題が生じる。 There is an upper limit to the number of areas that can be set by the MPU, and is usually 10 or less. For this reason, when a general OS and an application program are operated, a large number of areas are used for memory protection, and the number of areas usable for protection of peripheral devices is insufficient. As a result, there arises a problem that access protection for each peripheral device cannot be realized.
その他の課題と新規な特徴は、本明細書の記述および添付図面から明らかになるであろう。 Other problems and novel features will become apparent from the description of the specification and the accompanying drawings.
一実施の形態による情報処理装置は、メモリ保護ユニットとアクセス制御部とを備える。CPUのアドレス空間は複数のI/Oエイリアスアドレス範囲を含み、各I/Oエイリアスアドレス範囲ごとに情報処理装置に設けられた複数の周辺デバイスがマッピングされている。メモリ保護ユニットは、CPUからのアクセスを許可するアクセス許可領域をアドレス空間内に設定する。アクセス制御部は、上記の複数のI/Oエイリアスアドレス範囲のうちどのI/Oエイリアスアドレス範囲がCPUによってアクセスされているかに応じて、CPUからのアクセスが有効か無効かを周辺デバイスごとに切り替える。 An information processing apparatus according to an embodiment includes a memory protection unit and an access control unit. The CPU address space includes a plurality of I / O alias address ranges, and a plurality of peripheral devices provided in the information processing apparatus are mapped for each I / O alias address range. The memory protection unit sets an access permission area for permitting access from the CPU in the address space. The access control unit switches whether the access from the CPU is valid or invalid for each peripheral device according to which I / O alias address range of the plurality of I / O alias address ranges is accessed by the CPU. .
上記の一実施の形態の情報処理装置によれば、周辺デバイス単位でのアクセス保護が実現できる。 According to the information processing apparatus of the above-described embodiment, access protection in units of peripheral devices can be realized.
以下、各実施の形態について図面を参照して詳しく説明する。なお、同一または相当する部分には同一の参照符号を付して、その説明を繰返さない。 Hereinafter, each embodiment will be described in detail with reference to the drawings. The same or corresponding parts are denoted by the same reference numerals, and description thereof will not be repeated.
<実施の形態1>
[情報処理装置の構成]
図1は、実施の形態1による情報処理装置の構成を概略的に示すブロック図である。
<
[Configuration of information processing device]
FIG. 1 is a block diagram schematically showing the configuration of the information processing apparatus according to the first embodiment.
図1を参照して、情報処理装置100は、組込みシステムなどのコンピュータシステムとして構成される。情報処理装置100は、中央処理装置(CPU:Central Processing Unit)10と、フラッシュメモリ12と、DRAM(Dynamic Random Access Memory)13と、n個の周辺デバイス1〜n(D1〜Dn)と、メモリ保護ユニット(MPU:Memory Protection Unit)11と、アクセス制御部20と、バス14とを含む。図1に示すように、情報処理装置100を構成する各要素は、共通のバス14を介して相互に接続されている。
Referring to FIG. 1,
CPU10は、情報処理装置全体の制御処理および演算処理を行う。この実施の形態では、CPU10が扱えるデータのビット数を32ビットとする。CPU10は、バス14を介して、フラッシュメモリ12、DRAM13、および周辺デバイス1〜n(D1〜Dn)と接続され、これらのメモリおよび各周辺デバイスにアクセスする。
The
フラッシュメモリ12は、ROM(Read Only Memory)および外部記憶装置として用いられる。フラッシュメモリ12には、OS(Operating System)および複数のアプリケーションプログラムが予め格納されている。DRAM13は主記憶装置として用いられ、実行時に必要なプログラムがフラッシュメモリ12から呼び出される。なお、図1には図示されていないが、情報処理装置100は、プロセッサ内蔵メモリなど、その他のメモリを有していてもよい。
The
周辺デバイス1〜n(D1〜Dn)は、たとえば、タイマ、シリアル通信インターフェイス、DMA(Direct Memory Access)コントローラ、割り込みコントローラ、汎用入出力ポート、および表示コントローラなどにそれぞれ対応する。この明細書では、周辺デバイスを単にデバイスと記載する場合ある。
The
MPU11は、メモリ保護に特化したハードウェアである。組込みシステムでは、メモリ管理ユニット(MMU:Memory Management Unit)を用いた仮想記憶によってメモリ保護を実現するのではなく、MPUによってメモリ保護が実現される場合が多い。 The MPU 11 is hardware specialized for memory protection. In embedded systems, memory protection is often realized by MPU rather than by virtual storage using a memory management unit (MMU).
具体的に、MPU11は、CPU10のアドレス空間内に複数の領域(アクセス許可領域とも称する)を指定し、その領域毎にアクセス権(リード/ライト)を与えることができる。リード/ライトの一方のみが許可される場合もあるし、両方とも許可される場合もある。領域の指定はアドレスの上限と下限を指定する方法が一般的であるが、開始アドレスとサイズを指定することもある。作成可能な領域の数には上限があり一般的には10枚以下である。これは、領域の数を増やすと、コンパレータが多くなるために、回路面積が大きくなるばかりか、遅延が発生するためである。
Specifically, the MPU 11 can designate a plurality of areas (also referred to as access permission areas) in the address space of the
[デバイスアクセス保護について]
次に実施の形態1による情報処理装置100において、周辺デバイスのアクセス保護の特徴について説明する。情報処理装置100は、以下の特徴を有している。
[About device access protection]
Next, features of access protection for peripheral devices in the
(1) 周辺デバイスへのデータ入出力のためにアドレス空間内に複数のアドレス範囲(以下、I/O(Input/Output)エイリアスアドレス範囲と称する)が設けられる。周辺デバイス1〜n(D1〜Dn)は、各I/Oエイリアスアドレス範囲ごとにマッピングされる。
(1) A plurality of address ranges (hereinafter referred to as I / O (Input / Output) alias address ranges) are provided in the address space for data input / output to / from peripheral devices.
(2) メモリ保護ユニット(MPU)を有するプロセッサ(CPU)が用いられる。好ましくは、MPUによって複数のI/Oエイリアスアドレス範囲のうちいずれか1つのアクセスが許可される。 (2) A processor (CPU) having a memory protection unit (MPU) is used. Preferably, any one of a plurality of I / O alias address ranges is permitted by the MPU.
(3) 複数のI/Oエイリアスアドレス範囲のうちどのI/Oエイリアスアドレス範囲がアクセスされたかに応じて、各周辺デバイスに対するアクセスを有効または無効に切り替えるための機構(アクセス制御部)が設けられる。以下、各特徴について詳しく説明する。 (3) A mechanism (access control unit) is provided for switching access to each peripheral device to be valid or invalid according to which I / O alias address range is accessed among a plurality of I / O alias address ranges. . Hereinafter, each feature will be described in detail.
(1.周辺デバイスのマッピング方式)
図2は、CPU10のアドレス空間の一例を示す図である。
(1. Peripheral device mapping method)
FIG. 2 is a diagram illustrating an example of the address space of the
図2に示す例では、4GB(ギガバイト)のアドレス空間(0x00000000〜0xFFFFFFFF)のうち、フラッシュメモリ12が0x00000000〜0x0FFFFFFFにマッピングされ、DRAM13が0x10000000〜0x1FFFFFFFにマッピングされる。なお、アドレスが16進数であることを明示するためにアドレスの先頭に“0x”が付加されている。
In the example shown in FIG. 2, in the 4 GB (gigabyte) address space (0x0000000 to 0xFFFFFFFF), the
この実施の形態では、各周辺デバイスにデータを入出力する方式として、メモリマップトI/Oが用いられる。メモリマップトI/Oでは、アドレス空間内にメモリと周辺デバイスとが共存し、メモリのリード/ライト命令が各周辺デバイスにも用いられる。具体的に図2の例では、周辺デバイス1〜n(D1〜Dn)が0x20000000〜0x2FFFFFFFにマッピングされている。
In this embodiment, a memory mapped I / O is used as a method for inputting / outputting data to / from each peripheral device. In memory-mapped I / O, a memory and a peripheral device coexist in the address space, and a memory read / write command is also used for each peripheral device. Specifically, in the example of FIG. 2, the
図3は、周辺デバイスのアドレスマッピングをより詳細に示す図である。
図3を参照して、CPU10のアドレス空間には、周辺デバイス1〜n(D1〜Dn)をアクセスするために複数のアドレス範囲(I/Oエイリアスアドレス範囲1,2,3,…)が設けられる。周辺デバイス1〜n(D1〜Dn)は、各I/Oエイリアスアドレス範囲ごとにマッピングされている。たとえば、図3に示すように、デバイス1は、I/Oエイリアスアドレス範囲1のうちアドレス範囲0x20010000〜0x20010FFFにマッピングされるとともに、I/Oエイリアスアドレス範囲2のうちアドレス範囲0x20020000〜0x20020FFFにマッピングされている。デバイス1は、さらに、I/Oエイリアスアドレス範囲3のうちアドレス範囲0x20030000〜0x20030FFFにマッピングされている。他のデバイス2,3,…についても同様である。
FIG. 3 is a diagram showing the address mapping of peripheral devices in more detail.
Referring to FIG. 3, the address space of
(2.MPUによる保護領域の設定)
上記の各I/Oエイリアスアドレス範囲は、各アプリケーションソフトウェアに個別に対応する。たとえば、I/Oエイリアスアドレス範囲1,2,3…は、アプリケーションソフトウェア1,2,3にそれぞれ対応する。MPUは、動作中のアプリケーションソフトウェアに対応するI/Oエイリアスアドレス範囲をアクセス許可領域に指定する。したがって、図3のI/Oエイリアスアドレス範囲はアプリケーションソフトウェアの個数分必要になる。なお、MPUによる保護領域の切替えは、動作させるアプリケーションソフトウェアの切替時にOSなどのシステムソフトウェアによって実行される。
(2. Protection area setting by MPU)
Each of the above I / O alias address ranges individually corresponds to each application software. For example, the I / O alias address ranges 1, 2, 3,... Correspond to the
(3.アクセス制御部)
アクセス制御部20は、上記のI/Oエイリアスアドレス範囲1,2,3,…のうちどのI/Oエイリアスアドレス範囲がCPUによってアクセスされているかに応じて、周辺デバイスごとにアクセスが有効か無効かを切り替える。アクセス制御部20のこの機能とMPUによる保護領域の設定とを組み合わせることによって、アプリケーションソフトウェアに応じてアクセス可能な周辺デバイスを周辺デバイス単位で切替えることができる。以下、具体例を用いて各デバイスに対するアクセス制御についてさらに説明する。
(3. Access control unit)
The
(4.デバイスアクセス制御の具体例)
図4は、実施の形態1の情報処理装置において、どのアプリケーションソフトウェアの実行時にどの周辺デバイスがアクセス可能になるように設定されるかを表形式で示す図である。図4に示す例では、周辺デバイス1および4は、アプリケーションソフトウェア1の動作時にアクセス可能であるが、その他のアプリケーションソフトウェアの動作時にはアクセスできないように設定される。周辺デバイス2および3は、アプリケーションソフトウェア2の動作時にアクセス可能であるが、その他のアプリケーションソフトウェアの動作時にはアクセスできないように設定される。このようなアプリケーションごとのデバイスアクセス制御をデバイス単位で実現するために、MPU11とアクセス制御部20とが設けられている。
(4. Specific examples of device access control)
FIG. 4 is a diagram showing in tabular form which peripheral device is set to be accessible when executing which application software in the information processing apparatus of the first embodiment. In the example shown in FIG. 4, the
なお、図4の場合とは異なるが、たとえば、デバイス1について、アプリケーションソフトウェア1および2のいずれの動作時でもアクセス可能であるように設定することもできる。
Although different from the case of FIG. 4, for example, the
図5は、アプリケーションソフトウェア1の動作時において、MPUによる領域設定について説明するための図である。図5を参照して、アプリケーションソフトウェア1の動作時には、図1のMPU11によって、I/Oエイリアスアドレス範囲1(0x20010000〜0x2001FFFF)がアクセス許可領域(MPU領域1)に設定される。その他のアドレス範囲はアクセス不許可となる。なお、図5に示す取り消し線は、図6で説明するようにアクセスされたときに無効とされることを示している。
FIG. 5 is a diagram for explaining region setting by the MPU during operation of the
図6は、アプリケーションソフトウェア1の動作時において、アクセス制御部20の動作について説明するための図である。なお、図6に示す取り消し線は、以下に説明するようにアクセスされたときに無効となることを示している。
FIG. 6 is a diagram for explaining the operation of the
図6を参照して、アクセス制御部20の制御に従うと、デバイス1(D1)は、I/Oエイリアスアドレス範囲1のアドレス0x20010000〜0x20010FFFによってアクセスされた場合には有効だが、I/Oエイリアスアドレス範囲2のアドレス0x20020000〜0x20020FFFによってアクセスされた場合には無効になる。デバイス2(D2)は、I/Oエイリアスアドレス範囲1のアドレス0x20011000〜0x20011FFFによってアクセスされた場合には無効だが、I/Oエイリアスアドレス範囲2のアドレス0x20021000〜0x20021FFFによってアクセスされた場合には有効になる。デバイス3(D3)は、I/Oエイリアスアドレス範囲1のアドレス0x20012000〜0x20012FFFによってアクセスされた場合には無効だが、I/Oエイリアスアドレス範囲2のアドレス0x20022000〜0x20022FFFによってアクセスされた場合には有効になる。デバイス4(D4)は、I/Oエイリアスアドレス範囲1のアドレス0x20013000〜0x20013FFFによってアクセスされた場合には有効だが、I/Oエイリアスアドレス範囲2のアドレス0x20022000〜0x20022FFFによってアクセスされた場合には無効になる。
Referring to FIG. 6, according to the control of
上記のアクセス制御部20の制御動作と、図5で説明したMPUによる領域設定とが組み合わされることにより、アプリケーションソフトウェア1の動作時には、デバイス1および4はCPU10からアクセス可能になり、デバイス2および3はCPU10からアクセスできなくなる。すなわち、図4に示した設定でのデバイスのアクセス制御が実現できる。
By combining the control operation of the
図7は、アプリケーションソフトウェア2の動作時において、MPUによる領域設定について説明するための図である。図7を参照して、アプリケーションソフトウェア2の動作時には、図1のMPU11によって、I/Oエイリアスアドレス範囲2(0x20020000〜0x2002FFFF)がアクセス許可領域に設定される。その他のアドレス範囲はアクセス不許可となる。なお、図7に示す取り消し線は、アクセスされたときに無効とされることを示している。
FIG. 7 is a diagram for explaining area setting by the MPU during the operation of the application software 2. Referring to FIG. 7, during operation of application software 2, I / O alias address range 2 (0x20000000 to 0x2002FFFF) is set in the access permission area by
図8は、アプリケーションソフトウェア2の動作時において、アクセス制御部20の動作について説明するための図である。図8を参照して、アクセス制御部20の制御動作自体は、図6で説明したアプリケーションソフトウェア1の動作時と同じである。このアクセス制御部20の制御動作と図7で説明したMPUによる領域設定とが組み合わされることにより、アプリケーションソフトウェア2の動作時には、デバイス2および3はCPU10からアクセス可能になり、デバイス1および4はCPU10からアクセスできなくなる。すなわち、図4に示した設定でのデバイスのアクセス制御が実現できる。なお、図8に示す取り消し線は、アクセスされたときに無効とされることを示している。
FIG. 8 is a diagram for explaining the operation of the
ここで、図6と図8とを比較すると、MPUによってアクセス許可領域として設定されるのは、連続した1領域(MPU領域1とする)のみである。すなわち、図6の場合(アプリケーションソフトウェア1を実行する場合)には、I/Oエイリアスアドレス範囲1(0x20010000〜0x2001FFFF)がMPU領域1に設定される。一方、図8の場合(アプリケーションソフトウェア2を実行する場合)には、I/Oエイリアスアドレス範囲2(0x20020000〜0x2002FFFF)がMPU領域1に設定される。すなわち、デバイスアクセス制御のために設定されるMPU領域の数を削減して1つにすることができる。
Here, when FIG. 6 is compared with FIG. 8, only one continuous area (referred to as MPU area 1) is set as an access permission area by the MPU. That is, in the case of FIG. 6 (when the
[実施の形態1の効果]
以下、実施の形態1の効果について説明する。
[Effect of Embodiment 1]
Hereinafter, effects of the first embodiment will be described.
まず、実施の形態1による情報処理装置100では、周辺デバイス単位でのアクセス保護が実現できる。すなわち、MPU領域を設定しただけでは、設定されたMPU領域内に配置された周辺デバイスが全てアクセス可能になってしまう。そこで、MPU領域の設定と、周辺デバイス単位でアクセスの有効・無効を設定可能なアクセス制御部20の機能とを組み合わせることにより、周辺デバイス単位でのアクセス可否の設定をアプリケーションごとに実現できる。
First, the
さらに、アプリケーション切替時には、MPUによって1領域の設定のみを変更すればよいので、実行オーバヘッドを低減できる。この結果、アプリケーション切替処理の高速化が実現される。さらに、CPUを変更する必要がないので、汎用CPUを使用することができる。 Furthermore, when switching applications, only the setting of one area needs to be changed by the MPU, so that the execution overhead can be reduced. As a result, high-speed application switching processing is realized. Furthermore, since there is no need to change the CPU, a general-purpose CPU can be used.
以下、比較例の情報処理装置と対比することにより、実施の形態1の効果について補足する。ここで、比較例の情報処理装置では、図1に示すアクセス制御部20が設けられておらず、さらに図3に示すような複数のI/Oエイリアスアドレス範囲は設定されておらず、各周辺デバイスは単一のアドレス範囲にマッピングされているとする。
Hereinafter, the effects of the first embodiment will be supplemented by comparing with the information processing apparatus of the comparative example. Here, in the information processing apparatus of the comparative example, the
図9は、比較例の情報処理装置において、どのアプリケーションソフトウェアの実行時にどの周辺デバイスがアクセス可能になるように設定されるかを表形式で示す図である。図9に示す例では、周辺デバイス1、2および5は、アプリケーションソフトウェア1の動作時にアクセス可能であるが、他のアプリケーションソフトウェアの動作時にはアクセスできないように設定される。周辺デバイス3、4、6および8は、アプリケーションソフトウェア2の動作時にアクセス可能であるが、他のアプリケーションソフトウェアの動作時にはアクセスできないように設定される。周辺デバイス7は、アプリケーションソフトウェア3の動作時にはアクセス可能であるが、他のアプリケーションソフトウェアの動作時にはアクセスできないように設定される。
FIG. 9 is a diagram showing in tabular form which peripheral device is set to be accessible when executing which application software in the information processing apparatus of the comparative example. In the example shown in FIG. 9, the
図10は、比較例の情報処理装置の場合のアプリケーションソフトウェア1の動作時において、MPUによる領域設定について説明するための図である。
FIG. 10 is a diagram for explaining region setting by the MPU during the operation of the
図10を参照して、まず、周辺デバイスのアドレスマッピングについて説明すると、デバイス1は、単一のアドレス範囲0x20010000〜0x20011000にマッピングされている。他のデバイス2,3,…についても同様であり、個別に設定された単一のアドレス範囲にマッピングされている。どのデバイスがどのアドレス範囲にマッピングされるかは、ハードウェア設計時に決定される。
Referring to FIG. 10, first, address mapping of peripheral devices will be described.
図9のアクセス設定を実現するためには、アプリケーションソフトウェア1の動作時には周辺デバイス1、2および5をアクセス可能に設定する必要がある。ここで、MPUによって1領域として指定可能なのは連続したアドレス範囲に限られる。しかし、各アプリケーションが使用するデバイスはシステム毎に異なるため、使用する全てデバイスが連続したアドレスに配置されていない場合が多い。
In order to realize the access setting of FIG. 9, it is necessary to set the
具体的に周辺デバイス1および2は連続したアドレス範囲にマッピングされているが、周辺デバイス5は、周辺デバイス1,2とは離間したアドレス範囲にマッピングされている。したがって、周辺デバイス1,2がマッピングされているアドレス範囲0x20010000〜0x20011FFFをMPU領域1に設定し、周辺デバイス5が設定されているアドレス範囲0x20014000〜0x20014FFFをMPU領域2に設定する必要がある。設定するMPU領域数は2つになる。
Specifically, the
図11は、比較例の情報処理装置の場合のアプリケーションソフトウェア2の動作時において、MPUによる領域設定について説明するための図である。 FIG. 11 is a diagram for explaining region setting by the MPU during the operation of the application software 2 in the case of the information processing apparatus of the comparative example.
図11を参照して、アプリケーションソフトウェア2の動作時には、周辺デバイス3、4、6および8をアクセス可能に設定する必要がある。ここで、周辺デバイス3および4は連続したアドレス範囲にマッピングされているが、周辺デバイス6および8のアドレス範囲は互いに離間するともに、周辺デバイス3,4のアドレス範囲とも離間している。したがって、周辺デバイス3,4がマッピングされているアドレス範囲0x20012000〜0x20013FFFをMPU領域1に設定し、周辺デバイス6がマッピングされているアドレス範囲0x20015000〜0x20015FFFをMPU領域2に設定する。さらに、周辺デバイス8がマッピングされているアドレス範囲0x20017000〜0x20017FFFをMPU領域3に設定する必要がある。
Referring to FIG. 11, when application software 2 operates,
ここで、一般的なOSとアプリケーションプログラムとを動作させると、メモリの保護のために多数のMPU領域が使用される。このため、周辺デバイスの保護に使用可能なMPU領域の枚数はわずかとなる。この結果、アプリケーションソフトウェアが使用する複数の周辺デバイスのアドレスが連続したアドレス範囲に配置されていない場合、MPU領域の数が不足して一部デバイスが使えないという問題が生じることがある。図11の場合で、デバイス保護のために利用可能なMPU領域が2枚に限られる場合は、周辺デバイス8がMPU領域に設定できなくなる。実施の形態1の情報処理装置100では、設定すべきMPU領域数は1つで十分であるので上記の問題を回避することができる。
Here, when a general OS and an application program are operated, a large number of MPU areas are used for memory protection. Therefore, the number of MPU areas that can be used for protecting peripheral devices is small. As a result, when the addresses of a plurality of peripheral devices used by the application software are not arranged in a continuous address range, there is a problem that the number of MPU areas is insufficient and some devices cannot be used. In the case of FIG. 11, when the number of MPU areas available for device protection is limited to two, the peripheral device 8 cannot be set as the MPU area. In the
[変形例]
上記の実施の形態ではメモリマップトI/O方式の場合について説明した。これに対して、ポートマップトI/O方式の場合にも、周辺デバイス用のアドレス空間に複数のI/Oエイリアスアドレス範囲を設定し、各I/Oエイリアスアドレス範囲ごとに情報処理装置内の複数の周辺デバイスがマッピングされるようにすれば、上記と同様のデバイスアクセス保護を実現することができる。
[Modification]
In the above embodiment, the case of the memory mapped I / O method has been described. On the other hand, also in the case of the port mapped I / O method, a plurality of I / O alias address ranges are set in the address space for peripheral devices, and each I / O alias address range is set in the information processing apparatus. If a plurality of peripheral devices are mapped, device access protection similar to the above can be realized.
<実施の形態2>
[情報処理装置の構成]
図12は、実施の形態2による情報処理装置101の構成を示すブロック図である。図12の情報処理装置101では、図1のアクセス制御部20がアドレスデコーダ21によって具体的に実現される。その他の情報処理装置101の構成は、図1の場合と同様であるので同一または相当する部分には同一の参照符号を付して説明を繰り返さない。特に、図3で示した各周辺デバイスに対するアドレスマッピングは実施の形態2においても同じである。
<Embodiment 2>
[Configuration of information processing device]
FIG. 12 is a block diagram illustrating a configuration of the
なお、図12では、図1のフラッシュメモリ12およびDRAM13の図示が省略されている。周辺デバイス1〜n(D1〜Dn)は、4個の周辺デバイスD1〜D4のみが代表的に示されている。
In FIG. 12, the
図12を参照して、アドレスデコーダ21は比較器群22を含む。比較器群22に含まれる比較器(イコールコンパレータ)A1,A2,…は、周辺デバイス1,2,…(D1,D2,…)にそれぞれ対応する。各比較器は、CPU10から出力されるアドレスのうち上位20ビットが、各自のレジスタに保持されている基準値と一致するか否かを判定する。なお、以下の説明では、最上位ビット(MSB)をビット31とし、最下位ビット(LSB)をビット0とする。上位20ビットはビット31〜12に対応する。
Referring to FIG. 12,
具体的に比較器A1は、CPUが出力するアドレスの上位20ビットが基準値“0x200X0”と一致するか否かを判定する(ビット19〜16の値Xについては後述する)。比較器A1は、一致する場合に、自身(比較器A1)に対応するデバイス1(D1)のイネーブルポートENに活性化されたチップセレクト信号15を出力する。チップセレクト信号15が活性化されているとき、デバイス1(D1)へのアクセスが有効になる。
Specifically, the comparator A1 determines whether or not the upper 20 bits of the address output by the CPU match the reference value “0x200X0” (the value X of the bits 19 to 16 will be described later). If they match, the comparator A1 outputs the activated chip
同様に、比較器A2は、CPUが出力するアドレスの上位20ビットが基準値“0x200X1”に一致するか否かを判定し、一致する場合に対応のデバイス2(D2)のイネーブルポートENに出力するチップセレクト信号15を活性化する。比較器A3は、CPUが出力するアドレスの上位20ビットが基準値“0x200X2”に一致するか否かを判定し、一致する場合に対応のデバイス3(D3)のイネーブルポートENに出力するチップセレクト信号15を活性化する。比較器A4は、CPUが出力するアドレスの上位20ビットが基準値“0x200X3”に一致するか否かを判定し、一致する場合に対応のデバイス4(D4)のイネーブルポートENに出力するチップセレクト信号15を活性化する。
Similarly, the comparator A2 determines whether or not the upper 20 bits of the address output by the CPU matches the reference value “0x200X1”, and outputs the same to the enable port EN of the corresponding device 2 (D2) if they match. The chip
ここで、ビット19〜16の値“X”はアプリケーションソフトに対応する値に設定される。アプリケーションソフトウェア1の場合はX=0x1であり、アプリケーションソフトウェア2場合はX=0x2である。アプリケーションソフトウェア1および2のいずれにも対応する場合には、比較器は、アドレスのビット19〜16の値がX=0x1およびX=0x2のいずれかに一致するか否かを判定する。この場合、たとえば、デバイス1用に2つのイコールコンパレータとこれらのコンパレータの出力のOR演算を行う論理回路とが設けられる。
Here, the value “X” of bits 19 to 16 is set to a value corresponding to the application software. In the case of
他の方法として、アドレスの割り付けを工夫してビット単位でのアクセスの禁止・許可を設定可能にすれば、1つのデバイスに複数のアプリケーションソフトウェアを割付けることが可能になる。たとえば、図5、図12を参照して、ビット16の値が“1”(ビット19〜17の値は任意とする)の場合にデバイス1へのアクセスが可能であるとすると、アプリケーションソフトウェア1,3,5,…の各々の実行時にデバイス1へのアクセスが可能になる。一般的には各デバイスごとに、(1)許可するアドレスのビットのパターンを設定するレジスタ(アドレスパターンレジスタ)および(2)そのうちアクセス許可に用いるビットを設定するレジスタ(アドレスマスクレジスタ)を用意すれば、デバイスごとに複数のアプリケーションソフトに対してアクセスを許可することが可能になる。
As another method, if it is possible to set access prohibition / permission in bit units by devising address allocation, a plurality of application software can be allocated to one device. For example, referring to FIG. 5 and FIG. 12, when the value of bit 16 is “1” (the values of bits 19 to 17 are arbitrary), it is assumed that access to
ビット15〜12は、周辺デバイス1,2,…(D1,D2,…)を特定するために用いられる。ビット15〜12の値が0x0のとき周辺デバイス1を示す。同様にビット15〜12の値が0x1のとき周辺デバイス2を示し、ビット15〜12の値が0x2のとき周辺デバイス3を示し、ビット15〜12の値が0x3のとき周辺デバイス4を示す。
[具体的な動作例]
以下、実施の形態2による情報処理装置101の具体的な動作例について説明する。
[Specific operation example]
Hereinafter, a specific operation example of the
図13は、実施の形態2の情報処理装置において、どのアプリケーションソフトウェアの実行時にどの周辺デバイスがアクセス可能になるように設定されるかを表形式で示す図である。図13に示す例では、周辺デバイス1および4は、アプリケーションソフトウェア1の動作時にアクセス可能であるが、その他のアプリケーションソフトウェアの動作時にはアクセスできないように設定される。周辺デバイス2および3は、アプリケーションソフトウェア2の動作時にアクセス可能であるが、その他のアプリケーションソフトウェアの動作時にはアクセスできないように設定される。
FIG. 13 is a diagram showing in tabular form which peripheral device is set to be accessible when executing which application software in the information processing apparatus of the second embodiment. In the example shown in FIG. 13, the
上記の設定例の場合には、図12の比較器A1〜A4においてアドレスと比較される基準値は、それぞれ0x20010,0x20021,0x20022,0x20013となる。これらの基準値は、情報処理装置101の立上げ時にOSなどのシステムソフトウェアによって設定される。アプリケーションソフトウェアの切替時には再設定する必要はない。
In the case of the above setting example, the reference values compared with the addresses in the comparators A1 to A4 in FIG. 12 are 0x20010, 0x20021, 0x20022, and 0x20013, respectively. These reference values are set by system software such as an OS when the
図14は、図13の設定例における情報処理装置101の動作を説明するための図である。図14を参照して、アドレスデコーダ21による比較動作に基づいて、CPU10からアドレス0x20010000〜0x20010FFFによってデバイス1(D1)がアクセスされたときにそのアクセスは有効になる。同様に、CPU10からアドレス0x20021000〜0x20021FFFによってデバイス2(D2)がアクセスされたときにそのアクセスは有効になる。CPU10からアドレス0x20022000〜0x20022FFFによってデバイス3(D3)がアクセスされたときにそのアクセスは有効になる。CPU10からアドレス0x20013000〜0x20013FFFによってデバイス4(D4)がアクセスされたときにそのアクセスは有効になる。上記以外のアドレスによって各デバイスがアクセスされた場合には、そのアクセスは無効になる。なお、図14に示す取り消し線は、アクセスされたときに無効とされることを示している。
FIG. 14 is a diagram for explaining the operation of the
アプリケーションソフトウェア1の動作時には、実施の形態1の場合と同様に、MPU11によって図3のI/Oエイリアスアドレス範囲1(0x20010000〜0x2001FFFF)がアクセス許可領域(MPU領域1)に設定される。その他のアドレス範囲はアクセス不許可となる。したがって、アドレスデコーダ21の機能と組み合わされることによって、アプリケーションソフトウェア1の動作時には、デバイス1および4はCPU10からアクセス可能になり、デバイス2および3はCPU10からアクセスできなくなる。
When the
アプリケーションソフトウェア2の動作時には、MPU11によって図3のI/Oエイリアスアドレス範囲2(0x20020000〜0x2002FFFF)がアクセス許可領域に設定される。その他のアドレス範囲はアクセス不許可となる。したがって、アドレスデコーダ21の機能と組み合わされることによって、アプリケーションソフトウェア2の動作時には、デバイス2および3はCPU10からアクセス可能になり、デバイス1および4はCPU10からアクセスできなくなる。
When the application software 2 operates, the
[実施の形態2の効果]
以上のとおり、実施の形態2の情報処理装置101によれば、図1のアクセス制御部20がアドレスデコーダ21として具体的に実現されている。この結果、実施の形態1の場合と同様の効果を奏することができる。
[Effect of Embodiment 2]
As described above, according to the
<実施の形態3>
図15は、実施の形態3による情報処理装置102の構成を示すブロック図である。なお、図15では、図1のフラッシュメモリ12およびDRAM13の図示が省略されている。周辺デバイス1〜n(D1〜Dn)は、4個の周辺デバイスD1〜D4のみが代表的に示されている。
<Embodiment 3>
FIG. 15 is a block diagram illustrating a configuration of the
図15を参照して、実施の形態3による情報処理装置102は、周辺デバイス1,2,3,…(D1,D2,D3,…)の内部にそれぞれ設けられた比較器C1,C2,C3,…を含む点で図12の情報処理装置101と異なる。CPUから各周辺デバイスのデバイス本体(B1,B2,B3,…)へのアクセスは、アドレスデコーダ21に設けられた対応する比較器A1,A2,A3,…の比較結果とともに、対応する比較器C1,C2,C3,…の比較結果に基づいて、有効または無効に切り替えられる。
Referring to FIG. 15,
各比較器A1,A2,A3,A4は、CPU10によって対応する周辺デバイスがアクセスされているか否かを判定する。具体的には、比較器A1,A2,A3,A4の各々は、CPU10から出力されたアドレスのうちビット31〜20およびビット15〜12が各比較器ごとに定められた基準値と一致するか否かを判定する。比較器A1,A2,A3,A4においてアドレスと比較される基準値は、それぞれ0x200X0,0x200X1,0x200X2,0x200X3である(ただし、Xは任意の値)。
Each of the comparators A1, A2, A3, A4 determines whether or not the corresponding peripheral device is accessed by the
周辺デバイス1〜4にそれぞれ設けられた比較器C1,C2,C3,C4の各々は、対応する周辺デバイスで動作させるべきアプリケーションソフトウェアを判別するために設けられている。具体的には、比較器C1,C2,C3,C4の各々は、CPU10から出力されたアドレスのうちビット19〜16が各比較器ごとに定められた基準値と一致するか否かを判定する。図15に示す例では、この基準値は、比較器C1,C2,C3,C4の場合にそれぞれ0x1,0x2,0x2,0x1である。
Each of the comparators C1, C2, C3, and C4 provided in each of the
したがって、図15に示す例では、周辺デバイス1および4は、アプリケーションソフトウェア1の動作時にアクセス可能になり、周辺デバイス2および3は、アプリケーションソフトウェア2の動作時にアクセス可能になる。
Accordingly, in the example shown in FIG. 15, the
図15のその他の点は図12、図14の場合と同じであるので、同一または相当する部分には同一の参照符号を付して説明を繰り返さない。なお、図15に示す取り消し線は、アクセスされたときに無効とされることを示している。 Other points in FIG. 15 are the same as those in FIGS. 12 and 14, and thus the same or corresponding parts are denoted by the same reference numerals and description thereof will not be repeated. Note that the strikethrough shown in FIG. 15 is invalidated when accessed.
上記のように実施の形態3の場合には、アドレスデコーダ21に設けられた比較器A1,A2,A3,…と個々のデバイスに設けられた比較器C1,C2,C3,…とによって、図13に示すアドレスデコーダ21と同等の機能(すなわち、図1のアクセス制御部20の機能)が実現できる。この結果、実施の形態3の情報処理装置102は、実施の形態1,2の場合と同様の効果を奏する。
As described above, in the case of the third embodiment, the comparators A1, A2, A3,... Provided in the
以上、本発明者によってなされた発明を実施の形態に基づき具体的に説明したが、本発明は上記実施の形態に限定されるものではなく、その要旨を逸脱しない範囲で種々変更可能であることは言うまでもない。 As mentioned above, the invention made by the present inventor has been specifically described based on the embodiment. However, the present invention is not limited to the above embodiment, and various modifications can be made without departing from the scope of the invention. Needless to say.
10 CPU、11 メモリ保護ユニット(MPU)、12 フラッシュメモリ、13 DRAM、14 バス、15 チップセレクト信号、20 アクセス制御部、21 アドレスデコーダ、22 比較器群、100,101,102 情報処理装置、A1〜A4,C1〜C4 比較器、D1〜D4 周辺デバイス。 10 CPU, 11 Memory protection unit (MPU), 12 Flash memory, 13 DRAM, 14 bus, 15 Chip select signal, 20 Access control unit, 21 Address decoder, 22 Comparator group, 100, 101, 102 Information processing device, A1 -A4, C1-C4 comparator, D1-D4 peripheral device.
Claims (7)
複数の周辺デバイスとを備え、
前記CPUのアドレス空間は複数のI/Oエイリアスアドレス範囲を含み、前記I/Oエイリアスアドレス範囲ごとに前記複数の周辺デバイスがマッピングされ、
さらに、前記アドレス空間内に、前記CPUからのアクセスを許可するアクセス許可領域を設定するメモリ保護ユニットと、
前記複数のI/Oエイリアスアドレス範囲のうちどのI/Oエイリアスアドレス範囲が前記CPUによってアクセスされているかに応じて、前記CPUからのアクセスが有効か無効かを前記周辺デバイスごとに切り替えるアクセス制御部とを備える、情報処理装置。 CPU (Central Processing Unit)
With multiple peripheral devices,
The CPU address space includes a plurality of I / O alias address ranges, and the plurality of peripheral devices are mapped for each I / O alias address range.
Furthermore, a memory protection unit that sets an access permission area for permitting access from the CPU in the address space;
An access control unit that switches whether access from the CPU is valid or invalid for each peripheral device, depending on which I / O alias address range of the plurality of I / O alias address ranges is accessed by the CPU. An information processing apparatus comprising:
前記メモリ保護ユニットは、実行しているアプリケーションソフトウェアに対応するI/Oエイリアスアドレス範囲を前記アクセス許可領域に設定する、請求項2に記載の情報処理装置。 The plurality of I / O alias address ranges respectively correspond to a plurality of application software executed by the information processing apparatus,
The information processing apparatus according to claim 2, wherein the memory protection unit sets an I / O alias address range corresponding to the application software being executed in the access permission area.
各前記比較器は、前記CPUから出力されたアドレスのうちの複数の特定ビットの値が、各前記比較器ごとに定められた基準値に一致するか否かを判定し、
前記CPUから各前記周辺デバイスへのアクセスは、前記複数の特定ビットの値が対応の比較器について定められた前記基準値に一致するときに有効になる、請求項1に記載の情報処理装置。 The access control unit includes a plurality of comparators corresponding to the plurality of peripheral devices,
Each of the comparators determines whether or not the values of a plurality of specific bits in the address output from the CPU match a reference value determined for each of the comparators,
The information processing apparatus according to claim 1, wherein access from the CPU to each peripheral device is enabled when the values of the plurality of specific bits match the reference value defined for a corresponding comparator.
前記複数の周辺デバイスにそれぞれ対応する複数の第1の比較器と、
前記複数の周辺デバイスにそれぞれ対応する複数の第2の比較器とを含み、
各前記第1の比較器は、前記CPUから出力されたアドレスのうち複数の第1の特定ビットの値が、前記第1の比較器ごとに定められた第1の基準値に一致するか否かを判定し、
各前記第2の比較器は、前記CPUから出力されたアドレスのうち複数の第2の特定ビットの値が、前記第2の比較器ごとに定められた第2の基準値に一致するか否かを判定し、
前記CPUから各前記周辺デバイスへのアクセスは、前記複数の第1の特定ビットの値が対応の第1の比較器について定められた前記第1の基準値に一致し、かつ、前記複数の第2の特定ビットの値が対応の第2の比較器について定められた前記第2の基準値に一致するときに有効になる、請求項1に記載の情報処理装置。 The access control unit
A plurality of first comparators respectively corresponding to the plurality of peripheral devices;
A plurality of second comparators respectively corresponding to the plurality of peripheral devices;
Each of the first comparators determines whether or not the values of a plurality of first specific bits in the address output from the CPU match a first reference value determined for each of the first comparators. Determine whether
Each of the second comparators determines whether or not the values of a plurality of second specific bits in the address output from the CPU match a second reference value determined for each of the second comparators. Determine whether
The access from the CPU to each of the peripheral devices is such that the values of the plurality of first specific bits coincide with the first reference value determined for the corresponding first comparator, and The information processing apparatus according to claim 1, wherein the information processing apparatus is effective when a value of a specific bit of 2 matches the second reference value determined for a corresponding second comparator.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2013166466A JP2015035155A (en) | 2013-08-09 | 2013-08-09 | Information processor |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2013166466A JP2015035155A (en) | 2013-08-09 | 2013-08-09 | Information processor |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2015035155A true JP2015035155A (en) | 2015-02-19 |
Family
ID=52543621
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2013166466A Pending JP2015035155A (en) | 2013-08-09 | 2013-08-09 | Information processor |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2015035155A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2019525319A (en) * | 2016-07-19 | 2019-09-05 | サイプレス セミコンダクター コーポレーション | Context-based protection system |
-
2013
- 2013-08-09 JP JP2013166466A patent/JP2015035155A/en active Pending
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2019525319A (en) * | 2016-07-19 | 2019-09-05 | サイプレス セミコンダクター コーポレーション | Context-based protection system |
JP7001670B2 (en) | 2016-07-19 | 2022-01-19 | サイプレス セミコンダクター コーポレーション | Context-based protection system |
US11416421B2 (en) | 2016-07-19 | 2022-08-16 | Cypress Semiconductor Corporation | Context-based protection system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP6761891B2 (en) | Memory controller with flexible address decoding function | |
JP5654056B2 (en) | Hierarchical translation table control | |
JP6158952B2 (en) | Operation of data processor memory access operations | |
IL183909A (en) | Data processing apparatus having memory protection unit | |
JP6504984B2 (en) | Data processor | |
WO2014098979A1 (en) | Controlling access to groups of memory pages in a virtualized environment | |
JP4514066B2 (en) | Data processing apparatus and access control method in data processing apparatus | |
ES2606128T3 (en) | Data Space Arbitrator | |
JP2003006046A (en) | Method and circuit for memory protection | |
TW202240413A (en) | Pcie device and operating method thereof | |
JP2014081819A (en) | Information processing apparatus | |
JP7001670B2 (en) | Context-based protection system | |
JP2013092852A (en) | Bus connection circuit, semiconductor device, and operation method for bus connection circuit | |
JP2015035155A (en) | Information processor | |
KR20140135796A (en) | Microcontroller with context switch | |
US10706178B2 (en) | Data processing apparatus and access control method | |
TWI814167B (en) | System operative to support virtual machines and method for controlling access to a physical address space in thereof | |
JP6235088B2 (en) | Information processing device | |
JP6603100B2 (en) | Memory control device and memory control method | |
JP5469085B2 (en) | Server apparatus provided with MRA switch | |
JP5324676B2 (en) | Processor, bus interface device, and computer system | |
JP5380392B2 (en) | Semiconductor device, bus interface device, and computer system | |
JP2020009498A (en) | Memory controller and memory control method | |
JP5915624B2 (en) | Electronic control unit | |
JP2019117664A5 (en) |