JP2011145841A - Method for detecting memory overwrite by dma transfer - Google Patents

Method for detecting memory overwrite by dma transfer Download PDF

Info

Publication number
JP2011145841A
JP2011145841A JP2010005419A JP2010005419A JP2011145841A JP 2011145841 A JP2011145841 A JP 2011145841A JP 2010005419 A JP2010005419 A JP 2010005419A JP 2010005419 A JP2010005419 A JP 2010005419A JP 2011145841 A JP2011145841 A JP 2011145841A
Authority
JP
Japan
Prior art keywords
timer
dma
memory area
memory
area
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
JP2010005419A
Other languages
Japanese (ja)
Other versions
JP5183648B2 (en
Inventor
Makoto Ijuin
誠 伊集院
Toru Irie
徹 入江
Minoru Okubo
実 大久保
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.)
Hitachi Astemo Ltd
Original Assignee
Hitachi Automotive Systems Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hitachi Automotive Systems Ltd filed Critical Hitachi Automotive Systems Ltd
Priority to JP2010005419A priority Critical patent/JP5183648B2/en
Publication of JP2011145841A publication Critical patent/JP2011145841A/en
Application granted granted Critical
Publication of JP5183648B2 publication Critical patent/JP5183648B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To allow an abnormality in DMA to be detected and memory overwrite to be minimized, when a transfer destination address error occurs in a DMA transfer operation, and unauthorized DMA accesses are made to an unforeseen memory area. <P>SOLUTION: A controller having a DMA (direct memory access) function includes a memory area A121 which is a transfer destination for a DMA device A13a; a memory area B121a in which an initial value of a timer A14a is stored; a timer A14a which causes time-out at a predetermined time; a timer B14b, which generates a start request signal for a DMA device B13b, at a predetermined time interval that is shorter than the time-out time of the timer A14a; and a DMA device B13b, which transfers the value of the memory area B121a to a counter of the timer A14a and initializes the timer. <P>COPYRIGHT: (C)2011,JPO&INPIT

Description

本発明は、DMA装置を用いてデータ転送を行う制御装置に関する。   The present invention relates to a control device that performs data transfer using a DMA device.

DMAとは、プログラムされた機械語の命令群の実行によってCPUなどを介する方法によらず、メモリとメモリ又はメモリとI/Oデバイスの間で直接データを転送することである。しかしCPUを介さずに独立してメモリにアクセスするため、DMAに誤った転送先アドレスが設定された場合、メモリを上書きしてしまう可能性ある。従来技術では、DMAの転送先アドレスを定時タスクで監視するプログラムやバスを監視する外部デバイスを搭載してメモリ上書きを防止してきた。またメモリプロテクトといったDMAがメモリに書き込みする前に転送先アドレスをチェックし、メモリアクセス許可・禁止を行うマイクロプロセッサを搭載した例もある(例えば、特許文献1参照)。   DMA is the direct transfer of data between memory and memory or memory and I / O devices, regardless of the method via the CPU or the like by executing programmed machine language instructions. However, since the memory is accessed independently without going through the CPU, if an incorrect transfer destination address is set in the DMA, the memory may be overwritten. In the prior art, memory overwriting has been prevented by installing a program for monitoring a DMA transfer destination address by a scheduled task and an external device for monitoring a bus. There is also an example in which a microprocessor such as memory protect is installed that checks the transfer destination address before the DMA writes to the memory and permits / inhibits the memory access (see, for example, Patent Document 1).

特開昭61−121146号公報Japanese Patent Laid-Open No. 61-121146

本発明は、DMAの転送先が意図したアドレスで停止せず動作しつづける故障モードを監視することを目的とする。   An object of the present invention is to monitor a failure mode in which a DMA transfer destination continues to operate without stopping at an intended address.

従来技術を使用する場合、DMAの転送先アドレスを定時タスクで監視するプログラムでは、監視周期を短くするとCPUが高負荷となり、長くするとDMAが不正アクセスした場合に、メモリの上書きされる領域が大きくなる。またバスを監視する外部デバイスでは、コスト的に不利であり、メモリプロテクト機能は、搭載されていないマイクロプロセッサが多いという問題があった。   In the case of using the prior art, in a program for monitoring the DMA transfer destination address with a scheduled task, if the monitoring cycle is shortened, the CPU is heavily loaded, and if it is lengthened, the memory is overwritten in a large area when unauthorized access is made. Become. Further, the external device that monitors the bus is disadvantageous in terms of cost, and there is a problem that there are many microprocessors that are not equipped with the memory protection function.

本発明では、標準的にマイクロプロセッサに搭載されているDMA装置とタイマ機能を用いて、CPUを介さずにDMAによるメモリの上書きを検知する手段を提供することを目的とする。   An object of the present invention is to provide means for detecting overwriting of a memory by DMA without using a CPU by using a DMA device and a timer function which are normally mounted on a microprocessor.

本発明では、制御アプリケーションが使用しているDMA装置Aの転送先領域に隣接する領域に、タイマAの初期値を保存しておき、この値を所定周期でタイマAに転送し初期化する。前記タイマAは、タイムアウトを検知するタイマであり、前記初期値分の時間が経過する前に再び初期化されないと、タイムアウトしCPUにイベントを通知する。CPUは、前記イベントにより前記DMAの初期値が上書きされたことを認識することができる。前記タイマAの初期値転送は、前記DMAとは別のDMA装置Bによって所定周期で実行する。また、前記DMA装置Bによる転送周期は、タイマAとは別のタイマBによってタイミングが生成されるが、前記タイマAのタイムアウトは、前記タイマBの所定周期のイベントよりも長くしておくことで、正常時はタイマAのタイムアウトは発生しないが、前記タイマAの初期値を保存している領域が上書きされ、初期値が小さくなることで、タイマAのタイムアウトが発生し、DMA装置Aの暴走を検知できる。尚、前記タイマAの初期値は、メモリ領域の最大値に近い値である程、上書きされたときの検出率が高くなり、最大値から遠い値であるほど、タイムアウトが早くなるという特徴をもつ。   In the present invention, an initial value of the timer A is stored in an area adjacent to the transfer destination area of the DMA device A used by the control application, and this value is transferred to the timer A and initialized at a predetermined period. The timer A is a timer that detects a timeout, and if it is not initialized again before the time corresponding to the initial value has elapsed, it times out and notifies the CPU of an event. The CPU can recognize that the initial value of the DMA has been overwritten by the event. The initial value transfer of the timer A is executed at a predetermined cycle by the DMA device B different from the DMA. The transfer cycle by the DMA device B is generated by a timer B different from the timer A, but the timeout of the timer A is set longer than the predetermined cycle event of the timer B. In normal operation, the timer A does not time out, but the area storing the initial value of the timer A is overwritten and the initial value becomes small, so that the timer A times out and the DMA device A runs out of control. Can be detected. The initial value of the timer A is characterized in that the closer the value is to the maximum value of the memory area, the higher the detection rate when overwritten, and the longer the value, the faster the timeout. .

上記の手段を用いることで、前記従来技術の機能を搭載していない制御装置において、CPUを介さずにDMAによるメモリの上書きを検出することが可能となる。   By using the above-described means, it becomes possible to detect overwriting of the memory by DMA without using the CPU in the control device not equipped with the function of the prior art.

本発明の組み込み制御装置のシステム構成例を示す図である。It is a figure which shows the system configuration example of the embedded control apparatus of this invention. 本発明の一実施の形態によるエンジン制御ユニットのシステム構成例を示す図である。It is a figure which shows the system structural example of the engine control unit by one embodiment of this invention. 本発明の一実施の形態によるエンジン制御ユニットのDMA装置が正常動作している場合の処理フローを示した図である。It is the figure which showed the processing flow in case the DMA apparatus of the engine control unit by one Embodiment of this invention is operating normally. 本発明の一実施の形態によるエンジン制御ユニットのDMA装置が正常動作している場合のタイマのタイミングチャートを示した図である。It is the figure which showed the timing chart of the timer when the DMA apparatus of the engine control unit by one embodiment of this invention is operating normally. 本発明の一実施の形態によるエンジン制御ユニットのDMA装置が異常動作した場合の処理フローを示した図である。It is the figure which showed the processing flow when the DMA apparatus of the engine control unit by one Embodiment of this invention operate | moves abnormally. 本発明の一実施の形態によるエンジン制御ユニットのDMA装置が異常動作した場合のタイマのタイミングチャートを示した図である。It is the figure which showed the timing chart of the timer when the DMA apparatus of the engine control unit by one embodiment of this invention carries out abnormal operation.

以下に本発明の実施形態による組み込み制御装置について図面を参照しつつ説明を行う。図2は本発明の第一の実施形態である自動車用エンジン制御ユニットに搭載されているマイクロプロセッサの構成例を示す図である。図2に示すように、エンジン制御ユニット2のマイクロプロセッサ1は、CPU15と、内蔵RAM31(Random Access Memory)と、DMAC32(Direct Memory Access Controller)と、ダウンカウントタイマ33b,コンペアマッチタイマ33aを有している。   Hereinafter, an embedded control device according to an embodiment of the present invention will be described with reference to the drawings. FIG. 2 is a diagram showing a configuration example of a microprocessor mounted on the automobile engine control unit according to the first embodiment of the present invention. As shown in FIG. 2, the microprocessor 1 of the engine control unit 2 has a CPU 15, a built-in RAM 31 (Random Access Memory), a DMAC 32 (Direct Memory Access Controller), a downcount timer 33b, and a compare match timer 33a. ing.

DMAC32は、DMAチャネルA32a,DMAチャネルB32bを有している。内蔵RAM31は、DMAC用メモリ領域311を有しており、DMAC用メモリ領域311内は、DMAチャネルA用メモリ領域311a,DMAチャネルB用メモリ領域311bに分かれている。またDMAチャネルB用メモリ領域311bはDMAチャネルA用メモリ領域311aに隣接して置かれている。   The DMAC 32 has a DMA channel A 32a and a DMA channel B 32b. The built-in RAM 31 has a DMAC memory area 311. The DMAC memory area 311 is divided into a DMA channel A memory area 311a and a DMA channel B memory area 311b. The DMA channel B memory area 311b is placed adjacent to the DMA channel A memory area 311a.

ダウンカウントタイマ33bは所定の間隔でカウンタをダウンカウントするタイマのことであり、予め初期値を設定しスタートさせる。カウンタが0になると、CPU15へのイベント要求信号を生成し、カウンタのカウントダウンが停止する。CPU15がダウンカウントタイマ33bのイベント要求信号を検知すると、割り込み処理が発生する。またDMAチャネルB用メモリ領域311bには、ダウンカウントタイマ33bの初期値と同じ値を設定する。   The downcount timer 33b is a timer that counts down the counter at a predetermined interval, and sets and starts an initial value in advance. When the counter reaches 0, an event request signal to the CPU 15 is generated, and the countdown of the counter is stopped. When the CPU 15 detects the event request signal of the downcount timer 33b, an interrupt process is generated. In the DMA channel B memory area 311b, the same value as the initial value of the downcount timer 33b is set.

コンペアマッチタイマ33aは所定の間隔でカウンタをカウントアップするタイマのことであり、ダウンカウントタイマ33bの初期値より短い値を閾値として設定しスタートさせる。コンペアマッチタイマ33aのカウンタ値と設定した閾値とが一致すると、DMAチャネルB32bへのイベント要求信号を生成する。またイベント要求信号を生成と同時にカウンタを自動的に0クリアし、再度カウントを開始する。   The compare match timer 33a is a timer that counts up a counter at a predetermined interval, and starts by setting a value shorter than the initial value of the downcount timer 33b as a threshold value. When the counter value of the compare match timer 33a matches the set threshold value, an event request signal for the DMA channel B 32b is generated. At the same time as generating the event request signal, the counter is automatically cleared to 0 and starts counting again.

DMAチャネルA32aは、外部イベントをトリガとして起動し、DMAチャネルA用メモリ領域311aにデータを転送する。DMAチャネルB32bはコンペアマッチタイマ33aのイベントをトリガとして起動し、DMAチャネルB用メモリ領域311bにある値を、ダウンカウントタイマ33bのカウンタに転送する。   The DMA channel A 32a is activated with an external event as a trigger, and transfers data to the DMA channel A memory area 311a. The DMA channel B 32b is triggered by the event of the compare match timer 33a, and transfers the value in the DMA channel B memory area 311b to the counter of the downcount timer 33b.

DMAが正常に動作する場合の初期動作から通常動作までのフローチャートを図3に示す。図2,図3を参照しつつDMAが正常に動作している場合の初期動作から通常動作までを説明する。コンペアマッチタイマ33a,ダウンカウントタイマ33bを起動する前にDMAチャネルA32a,DMAチャネルB32b,DMAチャネルB用メモリ領域311b,ダウンカウントタイマ33b,コンペアマッチタイマ33aを設定する。S101では、DMAチャネルA32aの起動は外部トリガ,DMAチャネルA用メモリ領域311aにデータを転送する設定とし、DMAチャネルB32bはコンペアマッチタイマ33aのイベント要求信号をトリガとし、DMAチャネルB用メモリ領域311bの値をダウンカウントタイマ33bのカウンタに転送する設定としてDMAチャネルA32a,B32bを起動する。S102ではコンペアマッチタイマ33aの閾値、S103ではダウンカウントタイマ33b,コンペアマッチタイマ33aのカウンタに初期値を設定する。但しダウンカウントタイマ33bのカウンタに設定する初期値はコンペアマッチタイマ33aの閾値より大きい値、またコンペアマッチタイマ33aのカウンタに設定する値は0とする。S104では、DMAチャネルB用メモリ領域311bに初期値を設定する。設定する初期値はダウンカウントタイマ33bの初期値を同じ値とする。S105ではダウンカウントタイマ33b,コンペアマッチタイマ33aを同時に起動し、ダウンカウントタイマ33bはカウンタをカウントダウン、コンペアマッチタイマ33aはカウンタのカウントアップを開始する。S105でタイマを起動して所定時間が経過すると、S106でダウンカウントタイマ33bがタイムアウトする前に、コンペアマッチタイマ33aのカウンタ値が設定した閾値と一致する。S107ではコンペアマッチタイマ33aがDMAチャネルB32bへのイベント要求信号を生成すると同時に、カウンタを0クリアしカウントを再スタートする。S108ではDMAチャネルB32bがイベント要求信号を検知すると、DMAチャネルB用メモリ領域311bの値をダウンカウントタイマ33bに書き込む。S109ではダウンカウントタイマ33bがタイムアウトする前に、初期値を再設定される。またコンペアマッチタイマ33aのカウンタの0クリアとDMAチャネルB32bによるダウンカウントタイマ33bの書き込みは同タイミングで処理されていることとする。以降DMAが正常に動作している場合、S106〜S109の動作を繰り返す。またこの時のダウンカウントタイマ33b,コンペアマッチタイマ33aの起動後におけるカウンタのタイミングチャートを図4に示す。図4に示すように、ダウンカウントタイマ33b,コンペアマッチタイマ33aの起動後、ダウンカウントタイマ33bが0(タイムアウト)になる前に、コンペアマッチタイマ33aのカウンタが閾値と一致して、カウンタが0クリアしている動作となる。またコンペアマッチタイマ33aはカウンタの0クリアすると同時に、DMAチャネルB32bへのイベント要求信号をDMAチャネルB32bに送り、ダウンカウントタイマ33bのカウンタにDMAチャネルB用メモリ領域311bの値を書き込んで初期化しているため、ダウンカウントタイマ33bはタイムアウトしない動作となる。   FIG. 3 shows a flowchart from the initial operation to the normal operation when the DMA operates normally. The initial operation to normal operation when the DMA is operating normally will be described with reference to FIGS. Before starting the compare match timer 33a and down count timer 33b, the DMA channel A 32a, DMA channel B 32b, DMA channel B memory area 311b, down count timer 33b, and compare match timer 33a are set. In S101, activation of the DMA channel A 32a is set as an external trigger, and data is transferred to the DMA channel A memory area 311a. The DMA channel B 32b is triggered by an event request signal from the compare match timer 33a, and the DMA channel B memory area 311b. DMA channels A32a and B32b are activated as a setting for transferring the value of 1 to the counter of the downcount timer 33b. In S102, initial values are set in the threshold values of the compare match timer 33a, and in S103, the counters of the downcount timer 33b and the compare match timer 33a are set. However, the initial value set in the counter of the downcount timer 33b is larger than the threshold value of the compare match timer 33a, and the value set in the counter of the compare match timer 33a is 0. In S104, an initial value is set in the DMA channel B memory area 311b. The initial value to be set is the same as the initial value of the downcount timer 33b. In S105, the downcount timer 33b and the compare match timer 33a are activated simultaneously, the downcount timer 33b counts down the counter, and the compare match timer 33a starts counting up the counter. When a predetermined time elapses after starting the timer in S105, the counter value of the compare match timer 33a matches the set threshold before the downcount timer 33b times out in S106. In S107, the compare match timer 33a generates an event request signal for the DMA channel B 32b, and simultaneously clears the counter to 0 and restarts the count. In S108, when the DMA channel B 32b detects the event request signal, the value of the DMA channel B memory area 311b is written to the downcount timer 33b. In S109, the initial value is reset before the downcount timer 33b times out. Further, it is assumed that the clear of the counter of the compare match timer 33a and the write of the downcount timer 33b by the DMA channel B 32b are processed at the same timing. Thereafter, when the DMA is operating normally, the operations of S106 to S109 are repeated. Further, FIG. 4 shows a timing chart of the counter after the downcount timer 33b and the compare match timer 33a are started at this time. As shown in FIG. 4, after the downcount timer 33b and the compare match timer 33a are activated, before the downcount timer 33b reaches 0 (timeout), the counter of the compare match timer 33a matches the threshold, and the counter is 0. The operation is cleared. The compare match timer 33a clears the counter to 0, and simultaneously sends an event request signal to the DMA channel B 32b to the DMA channel B 32b, writes the value of the DMA channel B memory area 311b into the down count timer 33b counter, and initializes it. Therefore, the downcount timer 33b does not time out.

また図3に示すS106〜S109の動作中にDMAチャネルA32aがDMAチャネルA用メモリ領域311a外のDMAチャネルB用領域311bに不正アクセスした場合の異常検知方法について図5に示す。図5について説明すると、S201でDMAチャネルA32aがDMAチャネルB用メモリ領域311bに不正アクセスし、設定していた初期値が更新される。但し更新される値は、コンペアマッチタイマ33aの閾値よりも小さい値とする。DMAチャネルB用メモリ領域311bの値が更新されると、S109でダウンカウントタイマ33bのカウンタに設定される値がコンペアマッチタイマ33aの閾値よりも小さくなるため、S202でダウンカウントタイマ33bのタイムアウトする。ダウンカウントタイマ33bのタイムアウトによりS203でCPU15へのイベント要求信号が生成される。S204でCPU15がイベント要求信号を検知すると、割り込み処理を発生させ、DMAチャネルA32aの異常を検知し、DMAチャネルA32aを停止する。またこの時のダウンカウントタイマ33b,コンペアマッチタイマ33aの起動後からDMAチャネルA32aの異常検知までにおいてのカウンタのタイミングチャートを図6に示す。図6に示すように、DMAチャネルA32aの異常発生後、DMAチャネルB32bによりダウンカウントタイマ33bの値が更新されるが、コンペアマッチタイマ33aの閾値よりも小さい値となり、次回コンペアマッチタイマ33aのイベント要求信号生成よりも前に、ダウンカウントタイマ33bのタイムアウトし、CPU15へのイベント要求信号が生成される動作となっている。   FIG. 5 shows an abnormality detection method when the DMA channel A 32a illegally accesses the DMA channel B area 311b outside the DMA channel A memory area 311a during the operations of S106 to S109 shown in FIG. Referring to FIG. 5, in S201, the DMA channel A 32a illegally accesses the DMA channel B memory area 311b, and the set initial value is updated. However, the updated value is smaller than the threshold value of the compare match timer 33a. When the value of the DMA channel B memory area 311b is updated, the value set in the counter of the downcount timer 33b in S109 becomes smaller than the threshold value of the compare match timer 33a, so that the downcount timer 33b times out in S202. . Due to the timeout of the downcount timer 33b, an event request signal to the CPU 15 is generated in S203. When the CPU 15 detects an event request signal in S204, it generates an interrupt process, detects an abnormality in the DMA channel A 32a, and stops the DMA channel A 32a. FIG. 6 shows a timing chart of the counter from the time when the downcount timer 33b and the compare match timer 33a are activated until the detection of the abnormality of the DMA channel A32a. As shown in FIG. 6, the value of the downcount timer 33b is updated by the DMA channel B32b after the abnormality of the DMA channel A32a occurs, but becomes a value smaller than the threshold value of the compare match timer 33a, and the event of the next compare match timer 33a Before the request signal is generated, the down count timer 33b times out and an event request signal to the CPU 15 is generated.

以上、本発明の第一の実施形態による制御装置によれば、DMA装置が意図していないメモリ領域に不正アクセスした場合において、ダウンカウントタイマ,コンペアマッチタイマ,DMA装置を用いることで監視し、DMA装置によるメモリ上書きを検知することができる。   As described above, according to the control device according to the first embodiment of the present invention, when the DMA device illegally accesses the memory area that is not intended, the down count timer, the compare match timer, and the DMA device are used for monitoring. Memory overwriting by the DMA device can be detected.

また図2で説明したDMAチャネルB用メモリ領域の下にスタック領域を置くことで、DMAによるメモリ上書きの被害を減らすことができる。更にDMAチャネルB用メモリ領域の形態を工夫することで、DMAによるメモリ上書きの検出確率を高くすることができる。例えばDMAチャネルB用メモリ領域の値を連続して複数個置き、コンペアマッチタイマのイベント毎にDMAチャネルBの転送元を順次変える方法や複数のDMA装置を有している場合に、一定の間隔でDMAチャネルB用メモリ領域を設け、コンペアマッチタイマのイベント毎にDMAチャネルBの転送元を順次変更することで、DMAによるメモリ上書きの検出確率を高くすることができる。   Further, by placing a stack area under the DMA channel B memory area described with reference to FIG. 2, it is possible to reduce the damage of memory overwriting by DMA. Further, by devising the form of the DMA channel B memory area, it is possible to increase the detection probability of memory overwrite by DMA. For example, when a plurality of DMA channel B memory area values are continuously placed and a DMA channel B transfer source is sequentially changed for each compare match timer event or a plurality of DMA devices are provided, a fixed interval is used. By providing a memory area for DMA channel B and sequentially changing the transfer source of DMA channel B for each event of the compare match timer, it is possible to increase the probability of memory overwriting by DMA.

次に本発明の第二の実施形態による制御装置について説明を行う。   Next, a control device according to a second embodiment of the present invention will be described.

本発明の第一の実施形態においては、マイクロプロセッサ内のDMAC,コンペアマッチタイマ,ダウンカウントタイマ,内臓RAM,CPUを用いた例を示したが、本実施の形態による制御装置のように、コンペアマッチタイマ,ダウンカウントタイマがなく、代わりに所定の時間で起動する定常タスクで有していれば、DMAのメモリ上書きをソフトウェアで検知することができる。方法としては、まず定常タスク毎にDMAチャネルB用メモリ領域の値をチェックする。DMAチャネルB用メモリ領域が上書きされた場合に、保存していた初期値が変わることで、DMAチャネルAの転送先が転送先領域外になることを検知する。また本発明の第一の実施形態で説明したDMAチャネルB用メモリ領域の形態を同じように工夫することで、DMAによるメモリ上書きの検出確率を高くすることができる。   In the first embodiment of the present invention, the example using the DMAC, the compare match timer, the downcount timer, the built-in RAM, and the CPU in the microprocessor has been shown. However, like the control device according to the present embodiment, the compare is used. If there is no match timer or down-count timer and the task is a stationary task that starts instead at a predetermined time, DMA memory overwrite can be detected by software. As a method, first, the value of the memory area for DMA channel B is checked for each stationary task. When the DMA channel B memory area is overwritten, it is detected that the DMA channel A transfer destination is outside the transfer destination area by changing the stored initial value. Further, by devising the form of the memory area for DMA channel B described in the first embodiment of the present invention in the same way, it is possible to increase the detection probability of memory overwrite by DMA.

本発明は、2つ以上のDMA装置を具備する制御装置に適用できる。   The present invention can be applied to a control device including two or more DMA devices.

1 マイクロプロセッサ
2 エンジン制御ユニット
13a DMA装置A
13b DMA装置B
14a タイマA
14b タイマB
15 CPU
31 内蔵RAM
32 DMAC
32a DMAチャネルA
32b DMAチャネルB
33a コンペアマッチタイマ
33b ダウンカウントタイマ
121 メモリ領域A
121a メモリ領域B
311 DMAC用メモリ領域
311a DMAチャネルA用メモリ領域
311b DMAチャネルB用メモリ領域
1 Microprocessor 2 Engine control unit 13a DMA device A
13b DMA device B
14a Timer A
14b Timer B
15 CPU
31 Built-in RAM
32 DMAC
32a DMA channel A
32b DMA channel B
33a Compare match timer 33b Down count timer 121 Memory area A
121a Memory area B
311 Memory area for DMAC 311a Memory area for DMA channel A 311b Memory area for DMA channel B

Claims (8)

DMA装置Aの転送先であるメモリ領域Aと、所定の時間でタイムアウトするタイマAと、前記メモリ領域Aに隣接し前記タイマAの初期値を保存したメモリ領域Bと、前記メモリ領域Bの値を前記タイマAに転送し初期化するDMA装置Bと、前記タイマAのタイムアウトよりも短い所定の間隔で前記DMA装置Bの転送要求信号を生成するタイマBを有する制御装置において、
前記タイマAの初期値を保存した前記メモリ領域Bが上書きされた場合に、DMA装置Bによって転送される前記タイマAの初期値が小さくなることにより、前記タイマBによる前記タイマAの初期化のタイミングよりも先に前記タイマAのタイムアウトすることで前記DMA装置Aの転送先が転送先領域外であることを検知する手段。
A memory area A that is a transfer destination of the DMA device A, a timer A that times out in a predetermined time, a memory area B that is adjacent to the memory area A and stores an initial value of the timer A, and a value of the memory area B A controller having a DMA device B that transfers and initializes the timer A and a timer B that generates a transfer request signal of the DMA device B at a predetermined interval shorter than the timeout of the timer A;
When the memory area B storing the initial value of the timer A is overwritten, the initial value of the timer A transferred by the DMA device B is reduced, so that the initialization of the timer A by the timer B is performed. Means for detecting that the transfer destination of the DMA device A is outside the transfer destination area by timing out of the timer A before timing;
請求項1において、前記メモリ領域Aとスタック領域の間に前記メモリ領域Bを置き、前記メモリ領域A外が上書きされた場合の被害を少なくすることを特徴としたDMA装置の異常検知手段。   2. An abnormality detecting means for a DMA apparatus according to claim 1, wherein said memory area B is placed between said memory area A and a stack area, and damage caused when the outside of said memory area A is overwritten is reduced. 請求項1において、前記メモリ領域Bを連続した領域に複数個有し、前記タイマBのイベント毎に前記DMA装置Bの転送元領域を順次変更することで、前記メモリ領域A外が上書きされた場合の検出確率を高くすることを特徴としたDMA装置の異常検知手段。   2. The memory area B according to claim 1, wherein a plurality of the memory areas B are provided in a continuous area, and the outside of the memory area A is overwritten by sequentially changing the transfer source area of the DMA device B for each event of the timer B. An abnormality detection means for a DMA device, characterized in that the detection probability in the case is increased. 請求項1において、前記制御装置が複数個のDMA装置を有している場合に、一定間隔で前記メモリ領域Bを複数個設け、前記タイマBのイベント毎に前記DMA装置Bの転送元を順次変更することで、DMA装置の異常を検出することを特徴とした手段。   2. The control device according to claim 1, wherein when the control device has a plurality of DMA devices, a plurality of the memory areas B are provided at regular intervals, and the transfer source of the DMA device B is sequentially set for each event of the timer B. Means for detecting abnormality of the DMA device by changing. 請求項1において、前記タイマA,Bの代わりに所定の時間で起動する定常タスクを有する制御装置の場合に、前記定常タスク毎に前記メモリ領域Bの値をチェックする処理プログラムを有し、前記メモリ領域Bが上書きされた場合に、保存していた初期値が変化することで、前記DMA装置Aの転送先が転送先領域外になることを検知する手段。   The control program according to claim 1, further comprising: a processing program for checking a value of the memory area B for each stationary task in the case of a control device having a stationary task that starts at a predetermined time instead of the timers A and B, Means for detecting that when the memory area B is overwritten, the stored initial value is changed, so that the transfer destination of the DMA device A is outside the transfer destination area. 請求項5において、前記メモリ領域Bの下にスタック領域を置くことで、前記メモリ領域A外が上書きされた場合の被害を少なくすることを特徴としたDMA装置の異常検知手段。   6. The abnormality detection means for a DMA device according to claim 5, wherein a damage is caused when the outside of the memory area A is overwritten by placing a stack area under the memory area B. 請求項5において、前記メモリ領域Bを連続した領域に複数個有し、前記定常タスク毎にチェックすることで、前記メモリ領域A外が上書きされた場合の検出確率を高くすることを特徴としたDMA装置の異常検知手段。   6. The method according to claim 5, wherein a plurality of the memory areas B are provided in a continuous area, and the detection probability when the outside of the memory area A is overwritten is increased by checking each of the stationary tasks. Means for detecting abnormality of DMA device. 請求項5において、前記制御装置が複数個のDMA装置と前記メモリ領域Aを有している場合に、一定間隔でメモリ領域Bを複数個設け、前記定常タスク毎に前記メモリ領域Bをチェックすることで、DMA装置の異常を検出することを特徴とした手段。   6. The control device according to claim 5, wherein when the control device has a plurality of DMA devices and the memory region A, a plurality of memory regions B are provided at regular intervals, and the memory region B is checked for each regular task. Thus, a means for detecting an abnormality of the DMA device.
JP2010005419A 2010-01-14 2010-01-14 Method for detecting memory overwrite by DMA transfer Active JP5183648B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2010005419A JP5183648B2 (en) 2010-01-14 2010-01-14 Method for detecting memory overwrite by DMA transfer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2010005419A JP5183648B2 (en) 2010-01-14 2010-01-14 Method for detecting memory overwrite by DMA transfer

Publications (2)

Publication Number Publication Date
JP2011145841A true JP2011145841A (en) 2011-07-28
JP5183648B2 JP5183648B2 (en) 2013-04-17

Family

ID=44460640

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2010005419A Active JP5183648B2 (en) 2010-01-14 2010-01-14 Method for detecting memory overwrite by DMA transfer

Country Status (1)

Country Link
JP (1) JP5183648B2 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2017151529A (en) * 2016-02-22 2017-08-31 キヤノン株式会社 Information processor and control method thereof
CN109240954A (en) * 2017-07-10 2019-01-18 恩智浦美国有限公司 Dma controller with trigger sequence generator

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0721093A (en) * 1993-06-30 1995-01-24 Toshiba Corp Abnormality monitor system for direct memory access device
JP2001297054A (en) * 2000-04-11 2001-10-26 Sharp Corp Method for preventing transfer deviation of dma and dma controller

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0721093A (en) * 1993-06-30 1995-01-24 Toshiba Corp Abnormality monitor system for direct memory access device
JP2001297054A (en) * 2000-04-11 2001-10-26 Sharp Corp Method for preventing transfer deviation of dma and dma controller

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2017151529A (en) * 2016-02-22 2017-08-31 キヤノン株式会社 Information processor and control method thereof
CN109240954A (en) * 2017-07-10 2019-01-18 恩智浦美国有限公司 Dma controller with trigger sequence generator

Also Published As

Publication number Publication date
JP5183648B2 (en) 2013-04-17

Similar Documents

Publication Publication Date Title
US8954801B2 (en) Microcomputer and method of operation thereof
US7966528B2 (en) Watchdog mechanism with fault escalation
CN111324494A (en) Processor control method, apparatus and storage medium
JP5183648B2 (en) Method for detecting memory overwrite by DMA transfer
JP2008146542A (en) Multiprocessor system, processor device, and exceptional processing method
JP2008518313A (en) Data processing system with variable clock rate
JP2007136862A (en) Image forming apparatus
US8726099B2 (en) Data processing system
JP2008225807A (en) Control device, and program runaway monitoring method for the same
JP4812699B2 (en) Power control device
JP5627414B2 (en) Action log collection system and program
JP6904918B2 (en) Control device and its data writing method
JP5003530B2 (en) Watchdog timer control device, watchdog timer control method and program, and CPU system
US10969819B2 (en) Security control and method for operating a security control
WO2014112039A1 (en) Information processing device, method for controlling information processing device and information processing device control program
WO2018003560A1 (en) Electronic control device
TWI643063B (en) Detection method
JP2019020869A (en) Vehicle control device
EP3776302B1 (en) Method for activating sensors in a multi-unit device
JP2005031724A (en) Abnormality detecting device
JPH02293939A (en) Stack overflow detection time processing system
JP5768434B2 (en) Mutual monitoring system
JP6799404B2 (en) Information processing device and information processing method
JP5906807B2 (en) Arithmetic processing device and stall monitoring method
JP2009020545A (en) Anomaly monitoring device for computer

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20111114

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20111114

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20121002

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20121003

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20121129

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20121218

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20130115

R150 Certificate of patent or registration of utility model

Ref document number: 5183648

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20160125

Year of fee payment: 3

S533 Written request for registration of change of name

Free format text: JAPANESE INTERMEDIATE CODE: R313533

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250