Patent ID: 8516298

Claim:
A data protection method for damaged memory cells, adaptable to an electronic device having a memory, wherein the memory comprises a memory controller and a memory unit, the memory unit comprises a plurality of memory cells, and the memory cells are grouped into a plurality of pages, the data protection method comprising: executing a power-on self-test (POST); reserving a memory segment within a system data area of the memory for data exchange between the interrupt processing module of the electronic device and an application module of the OS; reserving an initial backup memory in the memory to be used by the interrupt processing module of the electronic device, wherein the initial backup memory comprises a plurality of backup pages; activating the interrupt processing module; enabling a system interrupt function when an uncorrectable error (UE) occurs; executing the operating system (OS), and loading data from a kernel region of the OS in the memory into a mirror region of the memory; obtaining a base address and a capacity of the memory segment and the initial backup memory reserved in the memory from a basic input/output system (BIOS), and prohibiting the OS from using the memory segment and the initial backup memory of the memory; detecting the UE occurred in the memory cells of each of the pages through the memory controller when the OS reads the memory; determining the page having the UE to be a damaged page, and selecting one of the backup pages in the initial backup memory to back up data in the damaged page to the backup page when the UE is detected in one of the pages; recording a mapping address of the damaged page and the backup page into a page mapping table in the memory controller; and accessing data in the backup page instead through the memory controller according to the mapping address in the page mapping table when the OS accesses the damaged page.