CN110427285A - A kind of high performance smart card mirror image guard method and data structure - Google Patents
A kind of high performance smart card mirror image guard method and data structure Download PDFInfo
- Publication number
- CN110427285A CN110427285A CN201910720079.8A CN201910720079A CN110427285A CN 110427285 A CN110427285 A CN 110427285A CN 201910720079 A CN201910720079 A CN 201910720079A CN 110427285 A CN110427285 A CN 110427285A
- Authority
- CN
- China
- Prior art keywords
- page
- data
- counter
- erasable
- pages
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/14—Error detection or correction of the data by redundancy in operation
- G06F11/1402—Saving, restoring, recovering or retrying
- G06F11/1446—Point-in-time backing up or restoration of persistent data
- G06F11/1458—Management of the backup or restore process
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Abstract
The present invention discloses a kind of high performance smart card mirror image guard method and data structure; by rotating backup mode; each more new data is written in old invalid data page, can reach the purpose of mirror image protection without writing individual backup area i.e., to promote the speed of mirror image protection.Data structure provided by the invention are as follows: simultaneously containing data and page management information in NVM one page (label, updates number of pages, logical page number (LPN), check value at counter).Method provided by the invention are as follows: NVM pages it is erasable when, while data and page management information are written;When this page of subsequent read-write, the validity of the page data is determined according to every page of page management information, and determine whether first to carry out image recovery, unstable state is eliminated by image recovery, then carries out reading and writing data.
Description
Technical field
The present invention relates to technical field of intelligent card more particularly to a kind of high performance smart card mirror image guard method and data
Structure.
Background technique
According to the erasable characteristic of intelligent card chip NVM, after NVM pages of erasable power down, power down page will appear reading instability problem.I.e.
After NVM pages of erasable power down, Primary Stage Data is read correctly, because of unstable state caused by can not identifying power down, is counted in page in subsequent use
According to be likely to occur jump or read it is unstable, will cause the unknown exception or even the variation of transactions balances of smart card, there is very big peace
Full blast danger.
It will use mirror image guard method to cope with the erasable power-off problems of NVM in smart card at present to avoid the occurrence of power down
Data exception afterwards, usually based on conventional backup.When general conventional backup carries out mirror image protection, first erasable backup area number is needed
According to then erasable backup area significant notation is effective, then writes target data again, and last erasable backup area significant notation is nothing
Effect.According to the process flow of conventional backup, 1 NVM data update at least needs 4 erasable operations of NVM, and wiping/writing performance is poor.
The erasable number of NVM is more in the guard method of smart card mirror image at present, influences the overall performance of smart card, especially shadow
Transaction performance are rung, the erasable mirror image protection of NVM can not be carried out in the more demanding product of some pairs of transaction performance;And some
Instability problem is read after NVM pages of erasable power down can not be eliminated in method, there is very big security risk, it can not be into security fields
The practical popularization of row.
Summary of the invention
For many disadvantages in current smart card mirror image guard method, the present invention provides a kind of high performance smart card mirror
As guard method and data structure, the erasable number of NVM in mirror image protection can be substantially reduced, promotes the transaction speed of smart card product
Degree.
The invention is by rotation backup mode, and more new data is written in old invalid data page every time, without writing individually
Backup area be can reach mirror image protection purpose, by Physical Page increase label and counter identification Physical Page it is effective
Property, by increasing the total page number for updating number of pages mark and once updating in Physical Page, to realize the primary original for updating multipage data
Sub- property protection.The invention can data be unstable to avoid occurring after erasable NVM power down, and will have the 1 of mirror image defencive function
Secondary data update, and are reduced to the erasable time for only needing 1 NVM, can be obviously improved mirror image protective value, especially promotion smart card
Transaction performance.Processing mode provided by the invention is pioneering, it is not yet found that similar technique exists.
For achieving the above object, steps are as follows for the technical method that the present invention uses:
Step 1: starting read-write.
Step 2: scanning whole Physical Page management informations, counter is greatly effective in the Physical Page of identity logic page number
Page counter is small for invalid page, and active page first address is stored in effective page table, and invalid page address is stored in invalid page table, simultaneously
The page of maximum counter is put into maximum counter page table and record is all the number of pages of maximum counter.
Step 3: according to the update number of pages stored in the page of the number of pages of the maximum counter scanned and maximum counter,
Judge last time it is erasable whether power down occurs, in case of power down, then carry out image recovery.
Step 4: being found in effective page table corresponding one or more effective according to the logical address and length of read-write
Page, source data and the return in active page are then read if it is read operation, the source number in active page is read if if it is write operation
According to be cached to RAM and by updating target data to RAM cache.
Step 5: the invalid page in invalid page table is written in the data organized and management information if it is erasable operation
In, wherein this erasable one page or multipage Physical Page are all the same Counter Value, and Counter Value is more maximum than in effective page table
Counter Value add 1, the update number of pages of all Physical Page is all the total page number that this is updated, and every page updated its label is all
It is set to virtual value.
Step 6: terminating read-write.
After image recovery, all mirror image pages become active page, if it is read operation, the maximum page of gated counter
(latest page) is read out;If it is erasable operation, the smallest page of gated counter (oldest page) progress is erasable, will before erasable
Page object counter is changed to maximum counter in current all pages and adds 1.
Image recovery process:
1) when the update number of pages stored in the page that the number of pages of maximum counter is equal to maximum counter, maximum count is verified
Every page of check value in device page table, if check value is correct, illustrate last time it is erasable be updated successfully, then by maximum counter page table
It is put into effective page table.
2) when the update number of pages or maximum counter stored in the page that the number of pages of maximum counter is less than maximum counter
Certain page of check value mistake in page table then illustrates that last time erasable page does not update all, it is erasable in power down has occurred, then reinforce wiping
Write all pages in maximum counter page table of page management information and data be it is invalid, to eliminate its unstable state, and be put into nothing
Imitate page table.
3) after image recovery, the page in effective page table is all effective, and corresponds with logical page address, remaining page of whole
For stable invalid page, invalid page is for subsequent erasable.
Detailed description of the invention
Fig. 1 is single page NVM data structure chart of the present invention;
Fig. 2 is present invention read-write flow chart;
Fig. 3 is the corresponding relationship of the physical areas NVM and logic area of the present invention;
Fig. 4 is the mapping relations figure of NVM logical page (LPAGE) and Physical Page of the present invention;
Fig. 5 is that the present invention establishes MAP flow chart;
Fig. 6 is read operation flow chart of the present invention;
Fig. 7 is the erasable operational flowchart of the present invention;
Fig. 8 is image recovery flow chart of the present invention;
Specific embodiment
Below in conjunction with attached drawing and example to a kind of high performance smart card mirror image guard method sum number provided by the present invention
It is described further according to structure.Based on the embodiments of the present invention, those of ordinary skill in the art are not making creative labor
Every other embodiment obtained under the premise of dynamic, shall fall within the protection scope of the present invention.
One, a kind of high performance smart card mirror image protects single page NVM data structure chart, as shown in Fig. 1, includes label
(Flag), counter (Counter), update number of pages (Num), logical page number (LPN) (ObjID (LogicAddr)), check value (CRC),
Check value is this page data (Date), label, counter, updates number of pages, logical page number (LPN) calculated check value together.
Two, a kind of high performance erasable process of smart card mirror image guard method, as shown in Fig. 2, this method step includes:
S2001, starting read-write.
S2002, whole Physical Page management informations are scanned, counter is greatly active page in the Physical Page of identity logic page number
Counter is small for invalid page, and active page first address is stored in effective page table, and invalid page address is stored in invalid page table, simultaneously will
The page of maximum counter is put into maximum counter page table and record is all the number of pages of maximum counter.
The update number of pages stored in the number of pages of maximum counter and the page of maximum counter that S2003, basis scan, sentences
Whether disconnected last time is erasable occurs power down, in case of power down, then carries out image recovery.
S2004, logical address and length according to read-write are found corresponding one or more effective in effective page table
Page, source data and the return in active page are then read if it is read operation, the source number in active page is read if if it is write operation
According to be cached to RAM and by updating target data to RAM cache.
S2005, if it is erasable operation, the invalid page in invalid page table is written into the data organized and management information
In, wherein this erasable one page or multipage Physical Page are all the same Counter Value, and Counter Value is more maximum than in effective page table
Counter Value add 1, the update number of pages of all Physical Page is all the total page number that this is updated, and every page updated its label is all
It is set to virtual value.
S2006, terminate read-write.
Three, embodiment data structure, as shown in Fig. 3, a part of the corresponding physical areas of this method logic area, wherein object
It is redundant area that area, which is managed, than the physical areas that logic area has more, and the page in logic area is logical page (LPAGE), and the page in physical areas is Physical Page;
Page is redundancy page in redundant area, is rotated together with the Physical Page in physical areas.
Four, embodiment data structure, as shown in Fig. 4, the mapping relations of this method logical page (LPAGE) and Physical Page, logical page (LPAGE) is extremely
One page can be found in Physical Page less and correspond to page, such as Page1` and Page2`;Some logical page (LPAGE)s can find two in Physical Page again
A correspondence page, such as Page3`, wherein the Counter0 in Counter3 ratio Page4 in corresponding Physical Page Page1 is big, then
The corresponding active page of Page3` is Page1, and Page4 is then invalid page.And Page4 is the legacy data page of Page3`, is to take turns
Backup during turning as Page1, becomes invalid page after Page1 is updated successfully, can be used as next time in rotation
The page object of update.
Five, embodiment establishes MAP process, as shown in Fig. 5 comprising the steps of:
MAP process is established in S5001, starting.
S5002, the management information for reading each Physical Page, carry out according to flag F lag, Counter, Num, LogicAddr
The screening of active page and invalid page.
S5003, FTL mapping table is generated according to LogicAddr in active page, mapping logic page and the corresponding of Physical Page are closed
System.
S5004, invalid page MAP is generated according to the invalid page filtered out, as the erasable page object that can be updated next time.
S5005, the foundation for completing MAP.
Six, embodiment reads process, as shown in Fig. 6 comprising the steps of:
Process is read in S6001, starting, reads some logical address.
S6002, MAP is established.
S6003, the physical page address that page object is found by FTL mapping table.
S6004, the validity for checking page object CRC, if in vain, the processing of income exception process.
If S6005, front process are normal, target data is read according to page object physical address.
S6006, it completes to read process.
Seven, the erasable process of embodiment, as shown in Fig. 7 comprising the steps of:
Process, some erasable logical address are write in S7001, starting.
S7002, MAP is established.
S7003, the differentiation according to power loss recovery mechanism, it is determined whether carry out power loss recovery, restore the unstable of power down page
State.
Whether S7004, the invalid number of pages for judging in invalid page MAP, which break even, time updates, and is judged as YES, then executes S7005 step
Suddenly;It is judged as NO, then executes S7006 step.
S7005, first pass through FTL mapping table read active page in data buffer storage into RAM, then by target to be modified
Data are updated into caching, and the new data in caching is more written in invalid page.
S7006, it has been more than default redundant area size, has had exceeded backup capabilities, insufficient space exception of dishing out.
S7007, end data are erasable.
Eight, embodiment image recovery process, as shown in Fig. 8.
As Fig. 8 scans the validity of all Physical Page by establishing MAP, and the FTL for establishing active page reflects before erasable
Firing table and invalid page MAP.
S8001, starting image recovery
S8002, each Physical Page of scanning (being same wheel with the scanning for establishing MAP), and maximum Counter is scanned, and
Generate maximum Couter page table.
S8003, judge whether the maximum number of pages of Counter is less than Num number, be judged as YES, execute S8004 step;Judgement
It is no, execution S8006 step.
S8004, illustrate that last time updates operation, power down has occurred, last time was caused not complete the update of whole pages, then carries out
Image recovery, by maximum Counter pages whole clear 0, and the old physical page of same logical address corresponding with maximum Counter pages
Then remain as active page.
S8005, maximum Counter pages after clear 0 is all put into invalid page MAP.
S8006, check whether every page of CRC of maximum Counter is correct, is judged as YES, then executes S8007 step;Judgement
Be it is no, then execute S8004 step.
S8007, image recovery is completed.
Claims (4)
1. a kind of high performance smart card mirror image protects data structure, which is characterized in that include data and page in page in every page of NVM
Management information, wherein page management information includes label, counter, updates number of pages, logical page number (LPN), check value;Check value is this page
Data, counter, update number of pages, logical page number (LPN) calculated check value together at label;By in Physical Page increase label and
The validity of counter identification Physical Page;The total page number once updated is recorded by increasing refresh page number scale in Physical Page, is come real
Now once update the atomicity protection of multipage data.
2. a kind of high performance smart card mirror image guard method protects data knot based on smart card mirror image described in claim 1
Structure when NVM is erasable, writes new data into old invalid data page, while data and management information are written;Subsequent read-write page
When, according to every page of label, counter, number of pages, check value are updated, to determine the validity of the page data, which is characterized in that main
Want comprising steps of
Step 1: starting read-write;
Step 2: scanning whole Physical Page management informations, counter is greatly that active page is small in the Physical Page of identity logic page number
It is invalid page, and active page first address is stored in effective page table, invalid page address is stored in invalid page table, while by maximum count
The page of device is put into maximum counter page table and record is all the total page number of maximum counter;
Step 3: according to the update number of pages stored in the Physical Page of the number of pages of the maximum counter scanned and maximum counter,
Judge last time it is erasable whether power down occurs, in case of power down, then carry out image recovery;
Step 4: finding corresponding one page or multipage active page in effective page table, such as according to the logical address and length of read-write
Fruit is that source data and return in active page are then read in read operation, and the source data caching in active page is then read if it is write operation
It updates to RAM and by new data to RAM caching;
Step 5: the data organized and management information are written in the invalid page in invalid page table if it is erasable operation,
In this erasable one page or multipage Physical Page be all the same Counter Value, the Counter Value is than maximum meter in effective page table
Number device value adds 1, and it is all the total page number that this is updated that number of pages is updated in this erasable one page or multipage Physical Page, and update
Every page of its label is all set to virtual value;
Step 6: terminating read-write.
3. according to the method described in claim 2, it is characterized in that, the step 2, scans whole Physical Page management informations, such as
Marked invalid in fruit Physical Page then reinforces the erasable page marker and data invalid, to eliminate its unstable state, and is put into vain
Page table.
4. according to the method described in claim 2, it is characterized in that, the step 3, decides whether to carry out image recovery, spy
Sign is:
1) when the update number of pages stored in the page that the number of pages of maximum counter is equal to maximum counter, maximum counter page is verified
Every page of check value in table, if check value is correct, illustrate last time it is erasable be updated successfully, then maximum counter page table is put into
Effective page table;
2) when the update number of pages or maximum counter page table stored in the page that the number of pages of maximum counter is less than maximum counter
In certain page of check value mistake, then illustrate that last time erasable page does not update all, it is erasable in power down has occurred, then reinforce it is erasable most
All pages of page management information and data are invalid in big counter page table, to eliminate its unstable state, and are put into invalid page
Table;
3) after image recovery, the page in effective page table is all effective, and corresponds with logical page address, remaining page all steady
Fixed invalid page, invalid page is for subsequent erasable.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910720079.8A CN110427285B (en) | 2019-08-06 | 2019-08-06 | High-performance smart card mirror image protection method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910720079.8A CN110427285B (en) | 2019-08-06 | 2019-08-06 | High-performance smart card mirror image protection method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110427285A true CN110427285A (en) | 2019-11-08 |
CN110427285B CN110427285B (en) | 2023-05-09 |
Family
ID=68414304
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910720079.8A Active CN110427285B (en) | 2019-08-06 | 2019-08-06 | High-performance smart card mirror image protection method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110427285B (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112181728A (en) * | 2020-09-29 | 2021-01-05 | 山东华翼微电子技术股份有限公司 | High-security CPU smart card chip data power-down prevention processing method |
CN112948172A (en) * | 2021-02-01 | 2021-06-11 | 北京中电华大电子设计有限责任公司 | Mirror image protection method and data structure based on FLASH chip with page atomicity |
CN113094294A (en) * | 2021-04-12 | 2021-07-09 | 深圳忆联信息系统有限公司 | SSD abnormal power failure processing method and device, computer equipment and storage medium |
CN114510198A (en) * | 2022-02-16 | 2022-05-17 | 北京中电华大电子设计有限责任公司 | Method for improving erasing and writing efficiency of NVM |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20100180145A1 (en) * | 2009-01-15 | 2010-07-15 | Phison Electronics Corp. | Data accessing method for flash memory, and storage system and controller system thereof |
CN103456360A (en) * | 2013-09-13 | 2013-12-18 | 北京昆腾微电子有限公司 | Management method and device for nonvolatile memory (NVM) |
CN103955432A (en) * | 2014-04-22 | 2014-07-30 | 深圳市硅格半导体有限公司 | Data storage method and device |
CN103996412A (en) * | 2013-02-19 | 2014-08-20 | 北京同方微电子有限公司 | Power-fail protection method applied to intelligent-card nonvolatile memories |
CN104090732A (en) * | 2014-07-21 | 2014-10-08 | 昆腾微电子股份有限公司 | Nonvolatile memory management method and device |
CN105095101A (en) * | 2015-08-03 | 2015-11-25 | 昆腾微电子股份有限公司 | Method and device for writing data in memorizer and intelligent card |
CN109254878A (en) * | 2018-09-27 | 2019-01-22 | 北京中电华大电子设计有限责任公司 | A kind of intelligent card power failure backup method write based on word and data structure |
-
2019
- 2019-08-06 CN CN201910720079.8A patent/CN110427285B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20100180145A1 (en) * | 2009-01-15 | 2010-07-15 | Phison Electronics Corp. | Data accessing method for flash memory, and storage system and controller system thereof |
CN103996412A (en) * | 2013-02-19 | 2014-08-20 | 北京同方微电子有限公司 | Power-fail protection method applied to intelligent-card nonvolatile memories |
CN103456360A (en) * | 2013-09-13 | 2013-12-18 | 北京昆腾微电子有限公司 | Management method and device for nonvolatile memory (NVM) |
CN103955432A (en) * | 2014-04-22 | 2014-07-30 | 深圳市硅格半导体有限公司 | Data storage method and device |
CN104090732A (en) * | 2014-07-21 | 2014-10-08 | 昆腾微电子股份有限公司 | Nonvolatile memory management method and device |
CN105095101A (en) * | 2015-08-03 | 2015-11-25 | 昆腾微电子股份有限公司 | Method and device for writing data in memorizer and intelligent card |
CN109254878A (en) * | 2018-09-27 | 2019-01-22 | 北京中电华大电子设计有限责任公司 | A kind of intelligent card power failure backup method write based on word and data structure |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112181728A (en) * | 2020-09-29 | 2021-01-05 | 山东华翼微电子技术股份有限公司 | High-security CPU smart card chip data power-down prevention processing method |
CN112181728B (en) * | 2020-09-29 | 2022-07-22 | 山东华翼微电子技术股份有限公司 | High-security CPU smart card chip data power-down prevention processing method |
CN112948172A (en) * | 2021-02-01 | 2021-06-11 | 北京中电华大电子设计有限责任公司 | Mirror image protection method and data structure based on FLASH chip with page atomicity |
CN113094294A (en) * | 2021-04-12 | 2021-07-09 | 深圳忆联信息系统有限公司 | SSD abnormal power failure processing method and device, computer equipment and storage medium |
CN113094294B (en) * | 2021-04-12 | 2024-02-13 | 深圳忆联信息系统有限公司 | SSD abnormal power failure processing method, SSD abnormal power failure processing device, computer equipment and storage medium |
CN114510198A (en) * | 2022-02-16 | 2022-05-17 | 北京中电华大电子设计有限责任公司 | Method for improving erasing and writing efficiency of NVM |
CN114510198B (en) * | 2022-02-16 | 2023-06-30 | 北京中电华大电子设计有限责任公司 | Method for improving erasing and writing efficiency of NVM (non-volatile memory) |
Also Published As
Publication number | Publication date |
---|---|
CN110427285B (en) | 2023-05-09 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110427285A (en) | A kind of high performance smart card mirror image guard method and data structure | |
US8134720B2 (en) | Multiple font management system and method | |
US7178723B2 (en) | Method and system for online communication between a check sorter and a check processing system | |
CN109254878B (en) | Smart card power-down backup method and data structure based on character writing | |
US7167580B2 (en) | Image quality assurance systems and methodologies for improving the identification of and access speed to image quality suspects in documents | |
US7092561B2 (en) | Character recognition, including method and system for processing checks with invalidated MICR lines | |
CN1658171B (en) | Faster write operations to nonvolatile memory by manipulation of frequently accessed sectors | |
CN108319433B (en) | Storage management method for NOR Flash of small-memory single chip microcomputer | |
US20050244035A1 (en) | Image quality assurance system and methodologies in a post-image capture document processing environment | |
KR20040060732A (en) | A log-structured write cache for data storage devices and systems | |
CN101606134A (en) | Address conversion method and equipment | |
US6457014B1 (en) | System and method for extracting index key data fields | |
JPH08235028A (en) | Data management method for flash memory and data processor using the data management method | |
US7177456B2 (en) | Method and system for emulating a check sorter | |
US5924127A (en) | Address translation buffer system and method for invalidating address translation buffer, the address translation buffer partitioned into zones according to a computer attribute | |
US6286757B1 (en) | Portable electronic apparatus | |
CN107957921B (en) | Wear-balanced intelligent card power-down data protection method | |
CN103824101B (en) | Logic card reading/writing method and system | |
CN110471626B (en) | Nor Flash management layer and method applied to Java Card | |
AU2001255517A1 (en) | Method and system for emulating a check sorter | |
JP2001084180A (en) | File managing device | |
RU2235356C2 (en) | Device for storing different versions of data sets in separate memory areas and method for refreshing data sets in memory | |
CN114518834B (en) | Information storage method and device and electronic equipment | |
JP2977317B2 (en) | Input control method of window terminal of financial institution | |
JP2922956B2 (en) | File area allocation method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |