JP6233134B2 - Electronic information storage medium, information processing method, and information processing program - Google Patents

Electronic information storage medium, information processing method, and information processing program Download PDF

Info

Publication number
JP6233134B2
JP6233134B2 JP2014067506A JP2014067506A JP6233134B2 JP 6233134 B2 JP6233134 B2 JP 6233134B2 JP 2014067506 A JP2014067506 A JP 2014067506A JP 2014067506 A JP2014067506 A JP 2014067506A JP 6233134 B2 JP6233134 B2 JP 6233134B2
Authority
JP
Japan
Prior art keywords
data
writing
predetermined size
dummy
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.)
Active
Application number
JP2014067506A
Other languages
Japanese (ja)
Other versions
JP2015191395A (en
Inventor
直樹 勝又
直樹 勝又
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.)
Dai Nippon Printing Co Ltd
Original Assignee
Dai Nippon Printing Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Dai Nippon Printing Co Ltd filed Critical Dai Nippon Printing Co Ltd
Priority to JP2014067506A priority Critical patent/JP6233134B2/en
Publication of JP2015191395A publication Critical patent/JP2015191395A/en
Application granted granted Critical
Publication of JP6233134B2 publication Critical patent/JP6233134B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Read Only Memory (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)

Description

不揮発性メモリを備えるICチップ等の電子情報記憶媒体の技術分野に関する。   The present invention relates to a technical field of an electronic information storage medium such as an IC chip including a nonvolatile memory.

ICチップの不揮発性メモリの状態は、大別して、「消去済み」と、「書き込み済みと、「不定」との3つの状態に分けることができる。消去済みとは、全てのbitが0、もしくは1の安定している状態(以下、「消去状態」という)である(0か1かは、ICチップにより異なる)。この消去状態になるのは、正常に消去動作が完了した場合、消去または書き込み途中に電源断が発生し、かつ、不定とならなかった場合などが挙げられる。書き込み済みとは、いくつかのbitが消去状態から変化しており、かつ、安定している状態(以下、「書き込み状態」という)である。この書き込み状態になるのは、正常に書き込み動作が完了した場合、消去または書き込み途中に電源断が発生し、かつ、不定とならなかった場合などが挙げられる。不定とは、不揮発性メモリの状態が安定していない状態(以下、「不定状態」という)であり、例えば、時間経過により不揮発性メモリに格納されているデータが変化した状態や、該当領域に書き込みを行った際、書き込み結果が意図した値とならない状態、浅く書き込まれた結果、「0」か「1」どちらの値にも変化しうる状態である。この不定状態となるのは、消去または書き込み途中に電源断が発生し、かつ安定しなかった場合や、ICチップが故障した場合などが挙げられる。   The state of the non-volatile memory of the IC chip can be roughly divided into three states: “erased”, “written”, and “undefined”. Erased is a stable state in which all bits are 0 or 1 (hereinafter referred to as “erased state”) (0 or 1 depends on the IC chip). Examples of the erased state include a case where the erase operation is normally completed, a case where a power interruption occurs during erasure or writing, and no indefinite state occurs. “Writed” means a state in which some bits have changed from the erased state and are stable (hereinafter referred to as “written state”). Examples of the writing state include a case where the writing operation is normally completed, a case where a power interruption occurs during erasing or writing, and a case where the power is not indefinite. Indeterminate is a state in which the state of the nonvolatile memory is not stable (hereinafter referred to as “indefinite state”). For example, the state in which data stored in the nonvolatile memory has changed over time, When writing is performed, the writing result does not become the intended value, and as a result of shallow writing, the value can change to either “0” or “1”. This indefinite state is caused when the power supply is interrupted during erasing or writing and is not stable, or when the IC chip breaks down.

これらの状態を取りうる不揮発性メモリにおいて、意図しない状態とならないようにするため、トランザクション(Transaction)という仕組みが利用されている。トランザクションとは、一連の消去または書き込み処理において、開始前もしくは終了後のどちらかの状態のみを取り得るようにする仕組みのことを言う。特許文献1には、電源供給が中断した場合に、データの書き込み前の状態に戻すことが記載されている。トランザクションでは、消去または書き込み処理の対象領域データを事前にバックアップしておき、消去または書き込み処理が失敗した場合には、バックアップしておいたデータを書き戻す一方、消去または書き込み処理が成功した場合には、バックアップしておいたデータを無効化するようになっている。このように、消去または書き込み処理の動作を保証するためのトランザクション内においても、消去または書き込み処理が実施されており、トランザクションとは異なる仕組みでその動作を保証する必要がある。トランザクション内での消去または書き込み処理の保証に関して、従来技術では、バックアップ処理において、バックアップ用のデータは、必要に応じて書き足すことで書き換えを実施しない対策、或いは、チェックサムやCRC(Cyclic Redundancy Check)等の妥当性確認データを保存しておき、必要に応じて確認するなどの対策が講じられている。   In a non-volatile memory capable of taking these states, a mechanism called a transaction is used to prevent an unintended state. A transaction refers to a mechanism that allows only a state before or after the start of a series of erasing or writing processes. Patent Document 1 describes that when power supply is interrupted, the state before data writing is restored. In the transaction, the target area data for the erase or write process is backed up in advance, and if the erase or write process fails, the backed up data is written back while the erase or write process is successful. Will invalidate the data you have backed up. As described above, even in a transaction for guaranteeing the operation of the erase or write process, the erase or write process is performed, and it is necessary to guarantee the operation by a mechanism different from that of the transaction. With regard to guaranteeing erasure or write processing within a transaction, in the conventional technology, in backup processing, backup data is not rewritten by writing as needed, or checksum or CRC (Cyclic Redundancy Check) ), Etc. are stored, and measures are taken such as checking if necessary.

特許4195822号Japanese Patent No. 4195822

従来技術での対策により、多くのケースにおいてはバックアップされたデータの内容を保証することが可能となる。しかしながら、不揮発性メモリの状態が不定状態となっている場合については、その領域を検知、回避することができず、そのまま不定状態の領域を使用してしまうことでデータが破損してしまう可能性があった。   The measures taken in the prior art make it possible to guarantee the contents of backed up data in many cases. However, when the state of the nonvolatile memory is indefinite, the area cannot be detected and avoided, and data may be damaged by using the indefinite state as it is. was there.

そこで、本発明は、消去または書き込み途中の電源断により、不揮発性メモリの状態が不定状態となった場合でも、そのことによる影響を受けずにデータの内容を保証することが可能な電子情報記憶媒体、情報処理方法、及び情報処理プログラムを提供することを目的とする。   Therefore, the present invention provides an electronic information storage capable of guaranteeing the contents of data without being influenced by the non-volatile memory even when the state of the nonvolatile memory becomes indefinite due to power interruption during erasing or writing. It is an object to provide a medium, an information processing method, and an information processing program.

上記課題を解決するために、請求項1に記載の発明は、不揮発性メモリとプロセッサとを備える電子情報記憶媒体において、前記プロセッサは、所定のデータを前記不揮発性メモリに書き込む第1書き込み手段と、前記書き込まれた前記所定のデータと同じ所定サイズのダミーデータを当該所定のデータに続けて前記不揮発性メモリに書き込む第2書き込み手段と、当該プロセッサの再起動時に、前記ダミーデータと同じ所定サイズの領域であって消去状態にある領域を少なくとも1つ分空けた後に続けて当該ダミーデータと同じ所定サイズの次のダミーデータを前記不揮発性メモリに書き込む第3書き込み手段と、を備えることを特徴とする。   In order to solve the above-mentioned problem, the invention described in claim 1 is an electronic information storage medium comprising a nonvolatile memory and a processor, wherein the processor includes first writing means for writing predetermined data into the nonvolatile memory. Second writing means for writing dummy data having the same predetermined size as the written predetermined data to the nonvolatile memory following the predetermined data, and the same predetermined size as the dummy data when the processor is restarted And a third writing means for writing the next dummy data of the same predetermined size as the dummy data into the non-volatile memory after vacating at least one area in the erased state. And

請求項2に記載の発明は、請求項1に記載の電子情報記憶媒体において、前記不揮発性メモリは、実データを格納するデータ格納領域と、前記実データのバックアップデータを格納するバックアップ領域と、前記バックアップデータのログデータであって少なくとも前記バックアップデータの格納先を示すログデータを前記所定のデータとして格納するログデータ格納領域と、を有し、前記第1書き込み手段は、前記データ格納領域の前記実データを書き換える場合、当該実データのバックアップデータを前記バックアップ領域に書き込み、且つ、前記バックアップデータの前記ログデータをログデータ格納領域に書き込んだ後に、当該実データを書き換え、前記第2書き込み手段は、前記ログデータ格納領域に書き込まれた前記ログデータと同じ所定サイズのダミーデータを当該ログデータに続けて前記ログデータ格納領域に書き込み、前記第3書き込み手段は、当該プロセッサの再起動時に、前記ダミーデータと同じ所定サイズの領域であって消去状態にある領域を少なくとも1つ分空けた後に続けて当該ダミーデータと同じ所定サイズの次のダミーデータを前記ログデータ格納領域に書き込むことを特徴とする。   According to a second aspect of the present invention, in the electronic information storage medium according to the first aspect, the nonvolatile memory includes a data storage area for storing actual data, a backup area for storing backup data of the actual data, A log data storage area for storing at least log data indicating the storage destination of the backup data as the predetermined data, and the first writing means includes: When rewriting the actual data, after writing the backup data of the actual data to the backup area and writing the log data of the backup data to the log data storage area, the actual data is rewritten, and the second writing means Is the log data written in the log data storage area The dummy data of the same predetermined size is written to the log data storage area following the log data, and the third writing means is an area of the same predetermined size as the dummy data and is erased when the processor is restarted. It is characterized in that the next dummy data having the same predetermined size as the dummy data is written to the log data storage area after at least one area has been made free.

請求項3に記載の発明は、請求項2に記載の電子情報記憶媒体において、前記第3書き込み手段は、当該プロセッサの再起動時に、前記ダミーデータと同じ所定サイズの領域であって消去状態にある領域を2つ分以上空けた後に続けて当該ダミーデータと同じ所定サイズの次のダミーデータを前記ログデータ格納領域に書き込むことを特徴とする。   According to a third aspect of the present invention, in the electronic information storage medium according to the second aspect, the third writing means is an area of the same predetermined size as the dummy data and is in an erased state when the processor is restarted. It is characterized in that the next dummy data having the same predetermined size as the dummy data is written in the log data storage area after two or more areas are vacated.

請求項4に記載の発明は、請求項2に記載の電子情報記憶媒体において、前記第3書き込み手段は、前記プロセッサの再起動時に前記ログデータ格納領域に最新のデータとして異常な所定サイズのデータが格納され、且つ当該最新のデータの1つ前のデータとして異常な前記所定サイズのデータが格納されている場合において、当該最新のデータの1つ前の所定サイズのデータのさらに1つ前の領域が前記消去状態である場合、当該最初のデータと同じ所定サイズの領域であって消去状態にある領域を少なくとも1つ分空けた後に続けて当該最初のデータと同じ所定サイズのダミーデータを書き込むことを特徴とする。   According to a fourth aspect of the present invention, in the electronic information storage medium according to the second aspect, the third writer is abnormally sized data as the latest data in the log data storage area when the processor is restarted. Is stored, and abnormal data of the predetermined size is stored as data immediately before the latest data, the data of a predetermined size before the latest data is further When the area is in the erased state, dummy data having the same predetermined size as the first data is written after at least one area having the same predetermined size as the first data and in the erased state is left. It is characterized by that.

請求項5に記載の発明は、請求項2に記載の電子情報記憶媒体において、前記プロセッサの再起動時に前記ログデータ格納領域に最新のデータとして正常な前記ログデータが格納されている場合、当該ログデータに基づいて前記バックアップデータを前記データ格納領域に書き戻す書き戻し手段を更に備えることを特徴とする。   According to a fifth aspect of the present invention, in the electronic information storage medium according to the second aspect, when the normal log data is stored as the latest data in the log data storage area when the processor is restarted, It further comprises a write-back means for writing the backup data back to the data storage area based on log data.

請求項6に記載の発明は、請求項2に記載の電子情報記憶媒体において、前記プロセッサの再起動時に前記ログデータ格納領域に最新のデータとして正常でない所定サイズのデータが格納されている場合において、当該最新のデータの1つ前のデータとして正常な前記ログデータが格納されている場合、当該ログデータに基づいて前記バックアップデータを前記データ格納領域に書き戻す書き戻し手段を更に備えることを特徴とする。   According to a sixth aspect of the present invention, in the electronic information storage medium according to the second aspect, when data of a predetermined size that is not normal is stored as the latest data in the log data storage area when the processor is restarted. When the normal log data is stored as data immediately before the latest data, it further comprises write-back means for writing the backup data back to the data storage area based on the log data. And

請求項7に記載の発明は、不揮発性メモリとプロセッサとを備える電子情報記憶媒体において前記プロセッサにより実行される情報処理方法であって、所定のデータを前記不揮発性メモリに書き込む第1書き込みステップと、前記書き込まれた前記所定のデータと同じ所定サイズのダミーデータを当該所定のデータに続けて前記不揮発性メモリに書き込む第2書き込みステップと、当該プロセッサの再起動時に前記不揮発性メモリに、前記ダミーデータと同じ所定サイズの領域であって消去状態にある領域を少なくとも1つ分空けた後に続けて当該ダミーデータと同じ所定サイズの次のダミーデータを前記不揮発性メモリに書き込む第3書き込みステップと、を含むことを特徴とする。   The invention according to claim 7 is an information processing method executed by the processor in an electronic information storage medium including a nonvolatile memory and a processor, wherein the first writing step writes predetermined data into the nonvolatile memory; A second writing step of writing dummy data having the same size as the written predetermined data into the nonvolatile memory following the predetermined data, and the dummy memory is stored in the nonvolatile memory when the processor is restarted. A third writing step of writing next dummy data of the same predetermined size as the dummy data in the nonvolatile memory after at least one area having the same predetermined size as the data and in an erased state is provided; It is characterized by including.

請求項8に記載の発明は、不揮発性メモリとプロセッサとを備える電子情報記憶媒体における前記プロセッサを、所定のデータを前記不揮発性メモリに書き込む第1書き込み手段と、前記書き込まれた前記所定のデータと同じ所定サイズのダミーデータを当該所定のデータに続けて前記不揮発性メモリに書き込む第2書き込み手段と、当該プロセッサの再起動時に、前記ダミーデータと同じ所定サイズの領域であって消去状態にある領域を少なくとも1つ分空けた後に続けて当該ダミーデータと同じ所定サイズの次のダミーデータを前記不揮発性メモリに書き込む第3書き込み手段として機能させることを特徴とする。   According to an eighth aspect of the present invention, there is provided a processor in an electronic information storage medium including a nonvolatile memory and a processor, a first writing means for writing predetermined data into the nonvolatile memory, and the written predetermined data. A second writing means for writing dummy data of the same predetermined size to the non-volatile memory following the predetermined data and an area of the same predetermined size as the dummy data and in an erased state when the processor is restarted It is characterized by functioning as third writing means for writing the next dummy data having the same predetermined size as the dummy data into the nonvolatile memory after at least one area is provided.

本発明によれば、消去または書き込み途中の電源断により、不揮発性メモリの状態が不定状態となった場合でも、そのことによる影響を受けずにデータの内容を保証することができる。   According to the present invention, even if the state of the nonvolatile memory becomes indefinite due to power interruption during erasing or writing, the contents of the data can be guaranteed without being affected by this.

ICカード1の概要構成例を示す図である。1 is a diagram illustrating a schematic configuration example of an IC card 1. FIG. (A)は、ログデータ格納領域の概念図を示す図であり、(B)は、ログデータの構造例を示す図である。(A) is a figure which shows the conceptual diagram of a log data storage area, (B) is a figure which shows the structural example of log data. ログデータ格納領域Rにおける分割領域R1〜R9に、ログデータ、またはダミーデータが書き込まれる様子を示す概念図である。FIG. 5 is a conceptual diagram illustrating a state in which log data or dummy data is written in divided areas R1 to R9 in a log data storage area R. 電源投入時のCPU10の処理の一例を示すフローチャートである。It is a flowchart which shows an example of a process of CPU10 at the time of power activation. コマンド受信時のCPU10の処理の一例を示すフローチャートである。It is a flowchart which shows an example of a process of CPU10 at the time of command reception.

以下、図面を参照して本発明の実施形態について詳細に説明する。以下に説明する実施形態は、ICカードに対して本発明を適用した場合の実施の形態である。   Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings. The embodiment described below is an embodiment when the present invention is applied to an IC card.

先ず、図1を参照して、本実施形態に係るICカード1の構成及び機能概要について説明する。図1は、ICカード1の概要構成例を示す図である。なお、ICカード1は、キャッシュカード、クレジットカード、社員カード等として使用される。或いは、ICカード1は、スマートフォンや携帯電話機等の通信機器に組み込まれる。ICチップ1aは通信機器の回路基板上に直接組み込んで構成するようにしてもよい。   First, with reference to FIG. 1, the configuration and functional overview of the IC card 1 according to the present embodiment will be described. FIG. 1 is a diagram illustrating a schematic configuration example of the IC card 1. The IC card 1 is used as a cash card, credit card, employee card or the like. Alternatively, the IC card 1 is incorporated into a communication device such as a smartphone or a mobile phone. The IC chip 1a may be configured by being directly incorporated on a circuit board of a communication device.

ICカード1には、図1に示すように、ICチップ1aが搭載されている。ICチップ1aは、本発明の電子情報記憶媒体の一例である。ICチップ1aは、CPU(Central Processing Unit)10、RAM(Random Access Memory)11、ROM(Read Only Memory)12、不揮発性メモリ13、及びI/O回路14を備えて構成される。なお、I/O回路14は、外部端末2とのインターフェイスを担う。ICカード1が接触ICカードの場合、I/O回路14には、例えばISO/IEC7816によって定められたC1〜C8の8個の端子が設けられている。例えば、C1端子は電源端子、C2端子はリセット端子、C3端子はクロック端子、C5端子はグランド端子、C7端子は外部端末2とのデータ通信を行う端子である。なお、この例では、接触式のICカードの例を示したが、外部端末2に近づくことにより、磁界をエネルギーとして無結線状態で電源供給され(電圧印加され)、動作する非接触式のICカード(アンテナ及び変復調回路を含む)であってもよい。外部端末2の例としては、ICカード発行機、ATM、改札機、認証用ゲート等が挙げられる。或いは、ICカード1が通信機器に組み込まれる場合、外部端末2には通信機器の機能を担うコントローラが該当する。   An IC chip 1a is mounted on the IC card 1 as shown in FIG. The IC chip 1a is an example of an electronic information storage medium of the present invention. The IC chip 1a includes a CPU (Central Processing Unit) 10, a RAM (Random Access Memory) 11, a ROM (Read Only Memory) 12, a nonvolatile memory 13, and an I / O circuit 14. The I / O circuit 14 serves as an interface with the external terminal 2. When the IC card 1 is a contact IC card, the I / O circuit 14 is provided with, for example, eight terminals C1 to C8 defined by ISO / IEC7816. For example, the C1 terminal is a power supply terminal, the C2 terminal is a reset terminal, the C3 terminal is a clock terminal, the C5 terminal is a ground terminal, and the C7 terminal is a terminal that performs data communication with the external terminal 2. In this example, an example of a contact type IC card is shown. However, by approaching the external terminal 2, a non-contact type IC that operates by being supplied with power (voltage is applied) in a non-connected state using a magnetic field as energy. It may be a card (including an antenna and a modem circuit). Examples of the external terminal 2 include an IC card issuing machine, ATM, ticket gate, and authentication gate. Alternatively, when the IC card 1 is incorporated in a communication device, the external terminal 2 corresponds to a controller responsible for the function of the communication device.

CPU10は、ROM12または不揮発性メモリ13に記憶された各種プログラム(本発明の情報処理プログラムを含む)を実行するプロセッサ(コンピュータ)である。CPU10は、例えば外部端末2からI/O回路14を介して受信されたコマンドに応じて、プログラムに従って後述する処理を実行する。ここで、コマンドは、例えば、APDU(Application Protocol Data Unit)として外部端末2から送信される。APDUとして送られるコマンドは、CLA部、INS部、P1部、P2部、Lc部、Data部、Le部から構成される。CLA部及びINS部は、コマンドの種類を示す情報を格納する。P1部及びP2部は、コマンド処理におけるパラメータを格納する。Lc部は、Data部のデータ長を格納する。Data部は、例えば更新用のデータを格納する。Le部は、コマンドをチェックするための情報を格納する。   The CPU 10 is a processor (computer) that executes various programs (including the information processing program of the present invention) stored in the ROM 12 or the nonvolatile memory 13. The CPU 10 executes processing to be described later according to a program in accordance with a command received from the external terminal 2 via the I / O circuit 14, for example. Here, the command is transmitted from the external terminal 2 as, for example, an APDU (Application Protocol Data Unit). A command sent as an APDU includes a CLA part, an INS part, a P1 part, a P2 part, an Lc part, a Data part, and a Le part. The CLA part and the INS part store information indicating the type of command. The P1 part and the P2 part store parameters in command processing. The Lc part stores the data length of the Data part. The Data section stores update data, for example. The Le part stores information for checking a command.

不揮発性メモリ13には、例えばフラッシュメモリが適用される。なお、不揮発性メモリ13は、「Electrically Erasable Programmable Read-Only Memory」であっても構わない。不揮発性メモリ13には、データ格納領域、バックアップ領域、及びログデータ格納領域等を有する。データ格納領域には、例えばアプリケーションプログラム等で使用される実データが格納される。実データは、データ格納領域への書き込み用のデータ、または書き換え用のデータである。ここで、書き込みとは、消去状態にある領域に対して、データを保存する動作である。書き換えとは、書き込み状態にある領域のデータを、別のデータへと書き換える動作であり、消去と書き込みを組み合わせた動作(消去したあとに、書き込みを実施)である。バックアップ領域及びログデータ格納領域は、書き込み保証用のバッファ領域である。バックアップ領域には、データ格納領域の実データのバックアップデータ(つまり、実データの複製)が格納される。ログデータ格納領域には、バックアップデータのログデータ(所定のデータの一例)が格納される。ログデータは、バックアップデータをデータ格納領域に書き戻す(ロールバック)するために必要な管理情報である。   For example, a flash memory is applied to the nonvolatile memory 13. The nonvolatile memory 13 may be “Electrically Erasable Programmable Read-Only Memory”. The nonvolatile memory 13 has a data storage area, a backup area, a log data storage area, and the like. For example, actual data used in an application program or the like is stored in the data storage area. The actual data is data for writing to the data storage area or data for rewriting. Here, writing is an operation of storing data in an erased area. Rewriting is an operation of rewriting data in an area in a writing state to another data, and is an operation combining erasing and writing (writing is performed after erasing). The backup area and the log data storage area are write guarantee buffer areas. The backup area stores backup data of actual data in the data storage area (that is, a copy of actual data). The log data storage area stores log data of backup data (an example of predetermined data). The log data is management information necessary to write back (roll back) the backup data to the data storage area.

図2(A)は、ログデータ格納領域の概念図を示す図であり、図2(B)は、ログデータの構造例を示す図である。図2(A)に示すように、ログデータ格納領域Rは、同じサイズ(データ長)の8分割された分割領域となっており、例えばリングバッファとして形成される。なお、図2(A)の例では、ログデータ格納領域Rとして、同じサイズ(図2(A)の例では、8バイトであるが、8バイト以外でもよい)の9つの分割領域R1〜R9を示しているがこれに限定されるものではない。また、分割領域R1〜R9は、初期段階では消去状態になっている。そして、分割領域R1〜R9には、図2(B)に示すように、例えば8バイトから構成されるログデータが書き込み可能になっている。図2(B)に示すログデータは、バックアップ元アドレスと(実データの格納元のアドレス)、バックアップ先アドレス(バックアップデータの格納先のアドレス)、バックアップデータのサイズ、各種フラグ、及びCRCとにより構成される。また、図示しないが、分割領域R1〜R9には、ログデータと同じサイズ(例えば、8バイト)のダミーデータが書き込み可能になっている。ダミーデータは、ログデータの区切り(電源投入、または1トランザクション)を表すデータであり、例えば、全てのバイトが16進数で“A(h)”で構成される。また、ダミーデータは、破損してもよいデータ(言い換えれば、破損することを前提とするデータ)であり、不定状態になる可能性がある分割領域に書き込まれる。これにより、不定状態でない分割領域をログデータの書き込み用として確保することができる。なお、ダミーデータは、実データと混同しない(実データと区別しやすい)データであればどのようなデータであってもよい(全てのバイトが“A(h)”でなくてもよい)。   FIG. 2A is a diagram illustrating a conceptual diagram of a log data storage area, and FIG. 2B is a diagram illustrating a structure example of log data. As shown in FIG. 2A, the log data storage area R is divided into eight areas having the same size (data length), and is formed as a ring buffer, for example. In the example of FIG. 2A, as the log data storage area R, nine divided areas R1 to R9 having the same size (8 bytes in the example of FIG. 2A, but may be other than 8 bytes). However, the present invention is not limited to this. Further, the divided regions R1 to R9 are in an erased state at an initial stage. In the divided areas R1 to R9, as shown in FIG. 2B, log data composed of, for example, 8 bytes can be written. The log data shown in FIG. 2B is based on the backup source address (actual data storage source address), backup destination address (backup data storage destination address), backup data size, various flags, and CRC. Composed. Although not shown, dummy data having the same size (for example, 8 bytes) as the log data can be written in the divided areas R1 to R9. The dummy data is data representing a delimiter of log data (power-on or one transaction), and for example, all bytes are composed of hexadecimal numbers “A (h)”. The dummy data is data that may be damaged (in other words, data that is assumed to be damaged), and is written in a divided area that may be indefinite. As a result, it is possible to secure a divided area that is not indefinite for writing log data. The dummy data may be any data as long as the data is not confused with the actual data (is easily distinguished from the actual data) (not all bytes may be “A (h)”).

そして、CPU10は、本発明における第1書き込み手段、第2書き込み手段、第3書き込み手段、及び書き戻し手段として機能する。具体的には、CPU10は、例えば外部端末2からI/O回路14を介して受信されたコマンド(例えば、更新コマンド)により指定された更新用のデータで、データ格納領域の実データ(データ格納領域に格納されている実データ)を書き換える場合、トランザクション処理により、当該実データのバックアップデータをバックアップ領域に書き込み、且つ、当該バックアップデータのログデータをログデータ格納領域(上述した分割領域)に書き込んだ後に、当該実データを書き換える。そして、上記トランザクション処理の完了時に、CPU10は、ログデータ格納領域に書き込まれたログデータと同じ所定サイズのダミーデータを当該ログデータに続けてログデータ格納領域(上述した分割領域)に書き込む。   The CPU 10 functions as a first writing unit, a second writing unit, a third writing unit, and a writing back unit in the present invention. Specifically, the CPU 10 is the update data specified by a command (for example, update command) received from the external terminal 2 via the I / O circuit 14, for example, and the actual data (data storage in the data storage area) When rewriting the actual data stored in the area, the backup data of the actual data is written to the backup area and the log data of the backup data is written to the log data storage area (the above-described divided area) by transaction processing. After that, the actual data is rewritten. When the transaction processing is completed, the CPU 10 writes dummy data having the same predetermined size as the log data written in the log data storage area to the log data storage area (the divided area described above) following the log data.

また、CPU10は、例えば電源投入によるCPU10の再起動時に、ダミーデータと同じ所定サイズの分割領域であって消去状態にある分割領域を少なくとも1つ分空けた(何らかのデータが書き込まれている領域から1つ分空けた)後に続けて当該ダミーデータと同じ所定サイズ(例えば、8バイト)の次のダミーデータをログデータ格納領域に書き込む。これにより、不定状態でない分割領域をログデータの書き込み用として確保することができる。或いは、CPU10は、例えば電源投入によるCPU10の再起動時に、ダミーデータと同じ所定サイズの分割領域であって消去状態にある分割領域を2つ分以上空けた(何らかのデータが書き込まれている領域から2つ分以上空けた)後に続けて当該ダミーデータと同じ所定サイズの次のダミーデータをログデータ格納領域に書き込むように構成するとなおよい。これにより、不定状態でない分割領域をログデータの書き込み用として確保することに加えて、後述するように、電源投入前後を区分するための確実な情報を確保することができる。   In addition, for example, when the CPU 10 is restarted when the power is turned on, the CPU 10 leaves at least one divided area that is the same size as the dummy data and is in an erased state (from an area where some data is written). Subsequently, the next dummy data having the same predetermined size (for example, 8 bytes) as the dummy data is written in the log data storage area. As a result, it is possible to secure a divided area that is not indefinite for writing log data. Alternatively, for example, when the CPU 10 is restarted when the power is turned on, the CPU 10 vacates two or more divided areas that are the same size as the dummy data and are in an erased state (from an area where some data is written). It is more preferable that the next dummy data having the same predetermined size as the dummy data is written in the log data storage area after two or more spaces are left. As a result, in addition to securing a divided region that is not indefinite for writing log data, it is possible to secure certain information for distinguishing before and after power-on, as will be described later.

図3は、ログデータ格納領域Rにおける分割領域R1〜R9に、ログデータ、またはダミーデータが書き込まれる様子を示す概念図である。先ず、図3(A)に示すように、最新のデータとしてダミーデータが分割領域R2に書き込まれている。図3(A)の例において、分割領域R2のダミーデータは、トランザクション処理が完了したことを示す。仮に、分割領域R2へのダミーデータの書き込み中に電源断になった場合、分割領域R2は不定状態になる可能性があり、また、ダミーデータも破損している可能性がある。分割領域にデータの書き足しをしていく場合、電源断により正常データ(正常なログデータ、または正常なダミーデータ)以外となるのは、必ず最後の分割領域である。そのため、正常データの間に、それ以外のデータが含まれていた場合は、ICチップ1aが異常(例えば、故障)であると判断することができる。   FIG. 3 is a conceptual diagram showing a state in which log data or dummy data is written in the divided areas R1 to R9 in the log data storage area R. First, as shown in FIG. 3A, dummy data is written in the divided region R2 as the latest data. In the example of FIG. 3A, the dummy data in the divided area R2 indicates that the transaction process has been completed. If the power is cut off during the writing of dummy data to the divided area R2, the divided area R2 may be in an indefinite state, and the dummy data may also be damaged. When data is added to a divided area, it is always the last divided area that is not normal data (normal log data or normal dummy data) due to power-off. Therefore, when other data is included in the normal data, it can be determined that the IC chip 1a is abnormal (for example, a failure).

次に、図3(A)に示す状態において電源断し、その後、電源投入によりCPU10が再起動すると、図3(B)に示すように、分割領域R2に最新のデータとしてダミーデータが格納されているので、消去状態にある2つの分割領域R3,R4を空けた次の分割領域R5に次のダミーデータが書き込まれている。ここで、1つ目の分割領域R3は、図3(A)に示す状態での書き込みの途中で電源断(例えばICカード1が引き抜かれることで電源断)により、不定状態となっている場合がある。しかし、2つ目の分割領域R4は、この領域R4に書き込みをしようとする機会がないため、必ず安定した消去状態になっている。そのため、このような分割領域R4を、常に、電源投入前後を区分するための確実な情報とすることができる。なぜなら、電源投入時に分割領域R5へのダミーデータの書き込みの途中で電源断により分割領域R5が不定状態となる場合がある。そのため、書き込み前に消去状態に見えていたとしても、書き込み直後、または書き込み後の時間経過により正常なダミーデータではなくなる可能性がある。しかしその場合であっても、2つ目の分割領域R4は安定した状態であるため、破損したデータが電源投入時に書き込んだダミーデータであると判断することが可能である。そして、このように不定状態にある分割領域R3と分割領域R5との間に、安定した消去状態である分割領域4を挟むことができるので、ICチップ1aが異常(例えば故障)とするか否かの判定を容易に行うことが可能となる。なお、ダミーデータ自身は、トランザクションに関する可変情報を持たないため、破損したことにより正常なデータが読み取れなかったとしても、データの欠損は発生しない。   Next, when the power is turned off in the state shown in FIG. 3A and then the CPU 10 is restarted by turning on the power, dummy data is stored as the latest data in the divided region R2, as shown in FIG. 3B. Therefore, the next dummy data is written in the next divided region R5 after the two divided regions R3 and R4 in the erased state are vacated. Here, the first divided region R3 is in an indefinite state due to a power cut (for example, a power cut when the IC card 1 is pulled out) during writing in the state shown in FIG. There is. However, the second divided region R4 is always in a stable erased state because there is no opportunity to write to this region R4. Therefore, such a divided region R4 can always be reliable information for distinguishing before and after power-on. This is because when the power is turned on, the divided region R5 may be in an indefinite state due to power interruption during the writing of the dummy data to the divided region R5. For this reason, even if it appears to be in an erased state before writing, there is a possibility that normal dummy data may not be obtained immediately after writing or as time elapses after writing. However, even in that case, since the second divided region R4 is in a stable state, it is possible to determine that the damaged data is dummy data written when the power is turned on. In addition, since the divided region 4 in a stable erased state can be sandwiched between the divided region R3 and the divided region R5 that are in an indefinite state in this way, whether or not the IC chip 1a is abnormal (for example, a failure). Such a determination can be easily performed. Since the dummy data itself does not have variable information regarding the transaction, no data loss occurs even if normal data cannot be read due to corruption.

次に、図3(B)に示す状態において、データ格納領域の実データが書き換えられる場合、トランザクション処理により、実データのバックアップデータがバックアップ領域に書き込まれると、図3(C)に示すように、当該バックアップデータのログデータが分割領域R6に書き込まれ、その後、次の実データのバックアップデータがバックアップ領域に書き込まれると、図3(D)に示すように、当該バックアップデータのログデータが分割領域R7に書き込まれ、トランザクション処理が終了すると、図3(E)に示すように、ダミーデータが分割領域R8に書き込まれることになる。   Next, when the actual data in the data storage area is rewritten in the state shown in FIG. 3B, when the backup data of the actual data is written in the backup area by transaction processing, as shown in FIG. When the log data of the backup data is written in the divided area R6 and then the next actual data backup data is written in the backup area, the log data of the backup data is divided as shown in FIG. When the transaction processing is completed after being written in the area R7, dummy data is written in the divided area R8 as shown in FIG.

次に、図4及び図5等を参照して、ICカード1aにおけるCPU10の処理の一例について説明する。図4は、電源投入時のCPU10の処理の一例を示すフローチャートである。図5は、コマンド受信時のCPU10の処理の一例を示すフローチャートである。   Next, an example of processing of the CPU 10 in the IC card 1a will be described with reference to FIGS. FIG. 4 is a flowchart illustrating an example of processing of the CPU 10 when the power is turned on. FIG. 5 is a flowchart showing an example of processing of the CPU 10 when receiving a command.

図4に示す処理は、ICチップ1aに電源が投入され、CPU10が起動することにより開始される。図4に示す処理が開始されると、CPU10は、不揮発性メモリ13におけるログデータ格納領域から最新のデータを検索する(ステップS1)。一方、CPU10は、最新のデータを検索できたか否かを判定する(ステップS2)。CPU10は、最新のデータを検索できた場合(ステップS2:YES)、ステップS3へ進む。一方、CPU10は、最新のデータを検索できなかった場合(ステップS2:NO)、ステップS9へ進む。   The process shown in FIG. 4 is started when the power is turned on to the IC chip 1a and the CPU 10 is activated. When the process shown in FIG. 4 is started, the CPU 10 retrieves the latest data from the log data storage area in the nonvolatile memory 13 (step S1). On the other hand, the CPU 10 determines whether or not the latest data has been retrieved (step S2). If the CPU 10 can retrieve the latest data (step S2: YES), the CPU 10 proceeds to step S3. On the other hand, if the latest data cannot be retrieved (step S2: NO), the CPU 10 proceeds to step S9.

ステップS3では、CPU10は、検索されたデータを確認対象データとし、当該確認対象データがダミーデータであるか否かを判定する。確認対象データがダミーデータであると判定された場合(ステップS3:YES)、ステップS9へ進む。この場合、書き込みの途中で電源断されることなく正常に電源オフされたものと見做すことができる。一方、確認対象データがダミーデータでないと判定された場合(ステップS3:NO)、ステップS4へ進む。この場合、確認対象データは、正常なログデータ、破損したログデータ、または破損したダミーデータである。   In step S3, the CPU 10 uses the retrieved data as confirmation target data, and determines whether the confirmation target data is dummy data. When it is determined that the confirmation target data is dummy data (step S3: YES), the process proceeds to step S9. In this case, it can be considered that the power is normally turned off without being turned off during writing. On the other hand, when it is determined that the confirmation target data is not dummy data (step S3: NO), the process proceeds to step S4. In this case, the confirmation target data is normal log data, damaged log data, or damaged dummy data.

ステップS4では、CPU10は、確認対象データのCRCが正常であるか否かを判定する。確認対象データが破損したダミーデータである場合、ログデータとダミーデータとは同一構造であるため、ログデータにおいてCRCがあるバイト位置と同じダミーデータの位置を参照すれば、正常でないことが判定できる。確認対象データのCRCが正常であると判定された場合(ステップS4:YES)、つまり、正常なログデータである場合、ステップS5へ進む。一方、確認対象データのCRCが正常でないと判定された場合(ステップS4:NO)、つまり、破損したログデータ、または破損したダミーデータである場合、ステップS7へ進む。   In step S4, the CPU 10 determines whether or not the CRC of the confirmation target data is normal. When the check target data is damaged dummy data, the log data and the dummy data have the same structure, and therefore it can be determined that the log data is not normal by referring to the same dummy data position as the byte position where the CRC exists. . When it is determined that the CRC of the confirmation target data is normal (step S4: YES), that is, when the log data is normal, the process proceeds to step S5. On the other hand, if it is determined that the CRC of the confirmation target data is not normal (step S4: NO), that is, if it is damaged log data or damaged dummy data, the process proceeds to step S7.

ステップS5では、CPU10は、正常であると判定されたログデータに基づいて、バックアップ領域のバックアップデータをデータ格納領域に書き戻す。次いで、CPU10は、確認対象データの1つ前のデータに変更して(遡り)(ステップS6)、1つ前のデータを確認対象データとし、ステップS3に戻り、上記と同様の処理を行う。   In step S5, the CPU 10 writes back the backup data in the backup area to the data storage area based on the log data determined to be normal. Next, the CPU 10 changes to the previous data of the confirmation target data (back) (step S6), sets the previous data as the confirmation target data, returns to step S3, and performs the same processing as described above.

ステップS7では、CPU10は、確認対象データが最新のデータであるか否かを判定する。確認対象データが最新のデータでないと判定された場合(ステップS7:NO)、ステップS8へ進む。一方、確認対象データが最新のデータであると判定された場合(ステップS7:YES)、ステップS6へ移行する。つまり、最新のデータは、電源断を考慮し破損しても構わないという趣旨である。この場合、ステップS6で、破損されたデータの1つ前のデータに変更され、ステップS4で正常なログデータであると判定された場合(つまり、最新のデータとして正常でないデータが格納されている場合において、当該最新のデータの1つ前のデータとして正常なログデータが格納されている場合)、当該ログデータに基づいて、バックアップ領域のバックアップデータがデータ格納領域に書き戻されることになる。   In step S7, the CPU 10 determines whether the confirmation target data is the latest data. When it is determined that the confirmation target data is not the latest data (step S7: NO), the process proceeds to step S8. On the other hand, when it is determined that the confirmation target data is the latest data (step S7: YES), the process proceeds to step S6. In other words, the latest data may be damaged in consideration of power interruption. In this case, when the data is changed to the data immediately before the damaged data in step S6 and is determined to be normal log data in step S4 (that is, the abnormal data is stored as the latest data). In the case where normal log data is stored as data immediately before the latest data), the backup data in the backup area is written back to the data storage area based on the log data.

ステップS8では、CPU10は、確認対象データが格納されている分割領域の1つ前の分割領域は消去状態(確認対象データの1つ前は消去状態)であるか否かを判定する。確認対象データの1つ前は消去状態であると判定された場合(ステップS8:YES)、ステップS9に進む。つまり、CPU10は、最新のデータとして異常なデータが格納され、且つ当該最新のデータの1つ前のデータとして異常なデータが格納されている場合において、当該最新のデータを格納する分割領域の2つ前の分割領域が消去状態である場合、ステップS9へ進む。ここで、最新のデータを格納する分割領域の2つ前の分割領域とは、最新のデータ(例えば、図3(C)に示す分割領域R6のデータ)の1つ前のデータ(例えば、図3(C)に示す分割領域R5のデータ)のさらに1つ前の分割領域(例えば、図3(C)に示す分割領域R4)である。一方、確認対象データの1つ前は消去状態でないと判定された場合(ステップS8:NO)、異常終了する。この場合、ICチップ1aが攻撃等の外的要因により故障しているとして、ICチップ1aを機能停止させることができる。つまり、破損したデータが2つ連続して続いた後、更に1つ前のデータが消去状態でなければ異常終了となる。   In step S8, the CPU 10 determines whether or not the divided area immediately before the divided area in which the confirmation target data is stored is in the erased state (the erased state is immediately before the confirmation target data). If it is determined that the previous data to be confirmed is in the erased state (step S8: YES), the process proceeds to step S9. That is, when abnormal data is stored as the latest data and abnormal data is stored as data immediately before the latest data, the CPU 10 stores the latest data in the divided area 2. If the previous divided area is in the erased state, the process proceeds to step S9. Here, the divided area two previous to the divided area for storing the latest data is the data immediately before the latest data (for example, the data of the divided area R6 shown in FIG. 3C) (for example, FIG. 3 (C), which is the immediately preceding divided area (for example, the divided area R4 shown in FIG. 3C). On the other hand, if it is determined that the previous data to be checked is not in the erased state (step S8: NO), the process ends abnormally. In this case, assuming that the IC chip 1a has failed due to an external factor such as an attack, the function of the IC chip 1a can be stopped. That is, after two consecutive pieces of damaged data, if the previous data is not in the erased state, the process ends abnormally.

ステップS9では、CPU10は、上記検索されたデータまたは先頭から、消去状態にある分割領域を2つ分空ける。なお、CPU10は、上記検索されたデータから、消去状態にある分割領域を1つ分空けてもよい。次いで、CPU10は、2つ分空けた分割領域の後に続けてダミーデータを書き込み(ステップS10)、バックアップ領域に格納された対象のバックアップデータを消去し(ステップS11)し、処理を終了する。   In step S9, the CPU 10 vacates two divided areas in the erased state from the searched data or the head. Note that the CPU 10 may vacate one divided area in the erased state from the retrieved data. Next, the CPU 10 writes dummy data following the two divided areas (step S10), erases the target backup data stored in the backup area (step S11), and ends the process.

一方、図5に示す処理は、例えば、トランザクション処理の開始により開始される。図5に示す処理が開始されると、CPU10は、書き換え対象である実データのバックアップデータをバックアップ領域に書き込む(ステップS21)。次いで、CPU10は、当該バックアップデータのログデータをログデータ格納領域の分割領域に書き込む(ステップS22)。次いで、CPU10は、書き換え対象である実データをページ単位で消去し、更新用のデータを実データとしてデータ格納領域(書き換え対象の実データと同一アドレスの領域)に書き込む(ステップS23)。次いで、CPU10は、ダミーデータを、ステップS22で書き込んだログデータに続けてログデータ格納領域の分割領域に書き込む(ステップS24)。次いで、CPU10は、ステップS21で書き込んだバックアップデータをバックアップ領域から消去する(ステップS25)。   On the other hand, the process shown in FIG. 5 is started, for example, by starting transaction processing. When the process shown in FIG. 5 is started, the CPU 10 writes the backup data of the actual data to be rewritten in the backup area (step S21). Next, the CPU 10 writes the log data of the backup data in the divided area of the log data storage area (step S22). Next, the CPU 10 erases the actual data to be rewritten in units of pages, and writes the update data as actual data in the data storage area (area having the same address as the actual data to be rewritten) (step S23). Next, the CPU 10 writes the dummy data in the divided area of the log data storage area following the log data written in step S22 (step S24). Next, the CPU 10 erases the backup data written in step S21 from the backup area (step S25).

以上説明したように、上記実施形態によれば、CPU10は、不揮発性メモリ13に書き込まれたログデータと同じサイズのダミーデータを当該ログデータに続けて不揮発性メモリ13に書き込み、当該CPU10の再起動時に、当該ダミーデータと同じサイズの分割領域であって消去状態にある分割領域を少なくとも1つ分空けた後に続けて当該ダミーデータと同じ所定サイズの次のダミーデータを不揮発性メモリ13に書き込むように構成したので、消去または書き込み途中の電源断により、不揮発性メモリ13の状態が不定状態となった場合でも、そのことによる影響を受けずにデータの内容を保証(巡回型のデータ内容を単領域で保証)することができる。また、消去状態にある分割領域を2つ分以上空けた後に続けて当該ダミーデータと同じサイズの次のダミーデータを書き込む構成によれば、電源投入前後を区分するための確実な情報を確保することができ、ICチップ1aが異常(例えば故障)とするか否かの判定を容易に行うことができる。   As described above, according to the embodiment described above, the CPU 10 writes dummy data having the same size as the log data written in the nonvolatile memory 13 to the nonvolatile memory 13 following the log data. At the time of start-up, after at least one divided area having the same size as the dummy data and in the erased state is vacated, the next dummy data having the same predetermined size as the dummy data is written to the nonvolatile memory 13. Therefore, even when the state of the non-volatile memory 13 becomes indefinite due to power interruption during erasing or writing, the data content is guaranteed without being affected by that (the cyclic data content is Guaranteed in a single area). Moreover, according to the configuration in which the next dummy data having the same size as the dummy data is written after two or more divided areas in the erased state are provided, reliable information for distinguishing before and after power-on is secured. It is possible to easily determine whether or not the IC chip 1a is abnormal (for example, a failure).

なお、上述したトランザクション内でのデータ保証に限らず、動作ログ等、一定量のデータを記録しておく際に本発明を適用することにより、トランザクションの仕組みを利用するよりも高速に、かつデータを失わずに書き込むことができる。   It should be noted that the present invention is not limited to the above-described data guarantee within a transaction, and when a certain amount of data, such as an operation log, is recorded, the data is faster than using a transaction mechanism. Can be written without losing.

1 ICカード
1a ICチップ
2 外部端末
10 CPU
11 RAM
12 ROM
13 不揮発性メモリ
14 I/O回路
1 IC card 1a IC chip 2 external terminal 10 CPU
11 RAM
12 ROM
13 Non-volatile memory 14 I / O circuit

Claims (8)

不揮発性メモリとプロセッサとを備える電子情報記憶媒体において、
前記プロセッサは、
所定のデータを前記不揮発性メモリに書き込む第1書き込み手段と、
前記書き込まれた前記所定のデータと同じ所定サイズのダミーデータを当該所定のデータに続けて前記不揮発性メモリに書き込む第2書き込み手段と、
当該プロセッサの再起動時に、前記ダミーデータと同じ所定サイズの領域であって消去状態にある領域を少なくとも1つ分空けた後に続けて当該ダミーデータと同じ所定サイズの次のダミーデータを前記不揮発性メモリに書き込む第3書き込み手段と、
を備えることを特徴とする電子情報記憶媒体。
In an electronic information storage medium comprising a nonvolatile memory and a processor,
The processor is
First writing means for writing predetermined data into the nonvolatile memory;
Second writing means for writing dummy data of the same predetermined size as the written predetermined data to the nonvolatile memory following the predetermined data;
When the processor is restarted, at least one area having the same predetermined size as the dummy data and in an erased state is provided, and then the next dummy data having the same predetermined size as the dummy data is stored in the nonvolatile memory. A third writing means for writing to the memory;
An electronic information storage medium comprising:
前記不揮発性メモリは、実データを格納するデータ格納領域と、前記実データのバックアップデータを格納するバックアップ領域と、前記バックアップデータのログデータであって少なくとも前記バックアップデータの格納先を示すログデータを前記所定のデータとして格納するログデータ格納領域と、を有し、
前記第1書き込み手段は、前記データ格納領域の前記実データを書き換える場合、当該実データのバックアップデータを前記バックアップ領域に書き込み、且つ、前記バックアップデータの前記ログデータをログデータ格納領域に書き込んだ後に、当該実データを書き換え、
前記第2書き込み手段は、前記ログデータ格納領域に書き込まれた前記ログデータと同じ所定サイズのダミーデータを当該ログデータに続けて前記ログデータ格納領域に書き込み、
前記第3書き込み手段は、当該プロセッサの再起動時に、前記ダミーデータと同じ所定サイズの領域であって消去状態にある領域を少なくとも1つ分空けた後に続けて当該ダミーデータと同じ所定サイズの次のダミーデータを前記ログデータ格納領域に書き込むことを特徴とする請求項1に記載の電子情報記憶媒体。
The nonvolatile memory includes a data storage area that stores actual data, a backup area that stores backup data of the actual data, and log data of the backup data that indicates at least a storage destination of the backup data A log data storage area for storing the predetermined data,
When rewriting the actual data in the data storage area, the first writing means writes backup data of the actual data to the backup area, and writes the log data of the backup data to the log data storage area. Rewrite the actual data,
The second writing means writes dummy data having the same predetermined size as the log data written in the log data storage area to the log data storage area following the log data,
The third writing means, after restarting the processor, vacates at least one area having the same predetermined size as the dummy data and being in the erased state, and then continues to the next of the same predetermined size as the dummy data. The electronic information storage medium according to claim 1, wherein the dummy data is written in the log data storage area.
前記第3書き込み手段は、当該プロセッサの再起動時に、前記ダミーデータと同じ所定サイズの領域であって消去状態にある領域を2つ分以上空けた後に続けて当該ダミーデータと同じ所定サイズの次のダミーデータを前記ログデータ格納領域に書き込むことを特徴とする請求項2に記載の電子情報記憶媒体。   When the processor is restarted, the third writing means vacates two or more areas of the same predetermined size as the dummy data and in the erased state, and then continues to the next of the same predetermined size as the dummy data. 3. The electronic information storage medium according to claim 2, wherein the dummy data is written in the log data storage area. 前記第3書き込み手段は、前記プロセッサの再起動時に前記ログデータ格納領域に最新のデータとして異常な所定サイズのデータが格納され、且つ当該最新のデータの1つ前のデータとして異常な前記所定サイズのデータが格納されている場合において、当該最新のデータの1つ前の所定サイズのデータのさらに1つ前の領域が前記消去状態である場合、当該最初のデータと同じ所定サイズの領域であって消去状態にある領域を少なくとも1つ分空けた後に続けて当該最初のデータと同じ所定サイズのダミーデータを書き込むことを特徴とする請求項2に記載の電子情報記憶媒体。   The third writing means stores the abnormal predetermined size data as the latest data in the log data storage area when the processor is restarted, and the abnormal predetermined size as the data immediately before the latest data. Is stored in the erased state, and the area immediately before the latest data of the predetermined size is in the erased state, the area is of the same predetermined size as the first data. 3. The electronic information storage medium according to claim 2, wherein dummy data having a predetermined size that is the same as the first data is written after at least one area in the erased state is left. 前記プロセッサの再起動時に前記ログデータ格納領域に最新のデータとして正常な前記ログデータが格納されている場合、当該ログデータに基づいて前記バックアップデータを前記データ格納領域に書き戻す書き戻し手段を更に備えることを特徴とする請求項2に記載の電子情報記憶媒体。   Write-back means for writing back the backup data back to the data storage area based on the log data when the normal log data is stored as the latest data in the log data storage area when the processor is restarted The electronic information storage medium according to claim 2, further comprising: 前記プロセッサの再起動時に前記ログデータ格納領域に最新のデータとして正常でない所定サイズのデータが格納されている場合において、当該最新のデータの1つ前のデータとして正常な前記ログデータが格納されている場合、当該ログデータに基づいて前記バックアップデータを前記データ格納領域に書き戻す書き戻し手段を更に備えることを特徴とする請求項2に記載の電子情報記憶媒体。   When data of a predetermined size that is not normal is stored as the latest data in the log data storage area when the processor is restarted, the normal log data is stored as data immediately before the latest data. 3. The electronic information storage medium according to claim 2, further comprising a write-back means for writing the backup data back to the data storage area based on the log data. 不揮発性メモリとプロセッサとを備える電子情報記憶媒体において前記プロセッサにより実行される情報処理方法であって、
所定のデータを前記不揮発性メモリに書き込む第1書き込みステップと、
前記書き込まれた前記所定のデータと同じ所定サイズのダミーデータを当該所定のデータに続けて前記不揮発性メモリに書き込む第2書き込みステップと、
当該プロセッサの再起動時に、前記ダミーデータと同じ所定サイズの領域であって消去状態にある領域を少なくとも1つ分空けた後に続けて当該ダミーデータと同じ所定サイズの次のダミーデータを前記不揮発性メモリに書き込む第3書き込みステップと、
を含むことを特徴とする情報処理方法。
An information processing method executed by the processor in an electronic information storage medium comprising a nonvolatile memory and a processor,
A first writing step of writing predetermined data into the nonvolatile memory;
A second writing step of writing dummy data having the same predetermined size as the written predetermined data to the nonvolatile memory following the predetermined data;
When the processor is restarted, at least one area having the same predetermined size as the dummy data and in an erased state is provided, and then the next dummy data having the same predetermined size as the dummy data is stored in the nonvolatile memory. A third writing step for writing to the memory;
An information processing method comprising:
不揮発性メモリとプロセッサとを備える電子情報記憶媒体における前記プロセッサを、
所定のデータを前記不揮発性メモリに書き込む第1書き込み手段と、
前記書き込まれた前記所定のデータと同じ所定サイズのダミーデータを当該所定のデータに続けて前記不揮発性メモリに書き込む第2書き込み手段と、
当該プロセッサの再起動時に、前記ダミーデータと同じ所定サイズの領域であって消去状態にある領域を少なくとも1つ分空けた後に続けて当該ダミーデータと同じ所定サイズの次のダミーデータを前記不揮発性メモリに書き込む第3書き込み手段として機能させることを特徴とする情報処理プログラム。
The processor in an electronic information storage medium comprising a non-volatile memory and a processor;
First writing means for writing predetermined data into the nonvolatile memory;
Second writing means for writing dummy data of the same predetermined size as the written predetermined data to the nonvolatile memory following the predetermined data;
When the processor is restarted, at least one area having the same predetermined size as the dummy data and in an erased state is provided, and then the next dummy data having the same predetermined size as the dummy data is stored in the nonvolatile memory. An information processing program that functions as third writing means for writing to a memory.
JP2014067506A 2014-03-28 2014-03-28 Electronic information storage medium, information processing method, and information processing program Active JP6233134B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2014067506A JP6233134B2 (en) 2014-03-28 2014-03-28 Electronic information storage medium, information processing method, and information processing program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2014067506A JP6233134B2 (en) 2014-03-28 2014-03-28 Electronic information storage medium, information processing method, and information processing program

Publications (2)

Publication Number Publication Date
JP2015191395A JP2015191395A (en) 2015-11-02
JP6233134B2 true JP6233134B2 (en) 2017-11-22

Family

ID=54425839

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2014067506A Active JP6233134B2 (en) 2014-03-28 2014-03-28 Electronic information storage medium, information processing method, and information processing program

Country Status (1)

Country Link
JP (1) JP6233134B2 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP7089423B2 (en) * 2018-07-12 2022-06-22 ルネサスエレクトロニクス株式会社 Information processing device and control method
JP2022052089A (en) 2020-09-23 2022-04-04 キオクシア株式会社 Memory system and memory system control method

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012169038A1 (en) * 2011-06-09 2012-12-13 Necディスプレイソリューションズ株式会社 Electronic apparatus, power supply operation log recording method, and recording medium
JP5754287B2 (en) * 2011-08-04 2015-07-29 大日本印刷株式会社 IC chip, processing method in IC chip, UIM, portable terminal, and processing program for IC chip
JP5983512B2 (en) * 2013-04-15 2016-08-31 株式会社デンソー Writing device

Also Published As

Publication number Publication date
JP2015191395A (en) 2015-11-02

Similar Documents

Publication Publication Date Title
JP4768237B2 (en) Portable electronic device and method for controlling portable electronic device
JP6233134B2 (en) Electronic information storage medium, information processing method, and information processing program
KR101783526B1 (en) Ic card, electronic device and portable electronic device
JP2003216511A (en) Non-volatile memory device, data updating method, data updating program and computer readable recording medium with recorded program
JP2008310596A (en) Portable electronic equipment and control method for potable electronic equipment
JP2009176147A (en) Electronic equipment and method for determining permission of access to memory of electronic equipment
JP6040895B2 (en) Microcomputer and non-volatile memory block management method
JP2019049876A (en) Electronic information storage medium, ic card, table management method with electronic information storage medium, and table management program
JP3607658B2 (en) Portable electronic device
JP2000357216A (en) Ic card
JP7322923B2 (en) Secure element, transaction control method and device
JP2001312891A (en) Semiconductor storage device
JP2008305263A (en) Nonvolatile semiconductor storage device and memory management method
JP2006293706A (en) Multi-application ic card with application updating function
US20170010827A1 (en) File system of controller
JP5983349B2 (en) IC card, data read / write method, and data read / write program
JP6252341B2 (en) Electronic information storage medium, information processing method, and information processing program
JP5050508B2 (en) Storage device, storage device program, and storage processing method
JP5341947B2 (en) IC card, control method of IC card, and control method of portable electronic device
JP3835753B2 (en) IC card
JP6015461B2 (en) Information recording medium, data read / write method, and data read / write program
JPH10161942A (en) Method, device for storing information, and information processor
JP2005056144A (en) Electronic apparatus loaded with flash memory, its memory data managing method, and program
JP6281302B2 (en) Information processing apparatus, IC card, and data processing method
JP4645883B2 (en) Semiconductor integrated circuit, data storage method, and data communication apparatus

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20170130

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20170913

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: 20170926

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20171009

R150 Certificate of patent or registration of utility model

Ref document number: 6233134

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150