Patent ID: 7441085

Claim:
A memory control method for restoring data in a cache memory, using a battery for supplying spare power to store cached data into a cache memory unit when a computer device is suddenly powered off, so as to synchronously write back the cached data in the memory unit to a disk when a system is restarted next time, the method comprising: (1) enabling a nonvolatile memory unit in the computer device to record a buffer head address distributed by a memory management core in an operating system; (2) enabling the computer device to employ a hardware status register to judge whether the computer device was powered off abnormally, and if yes, triggering a program to write the cached data back to the disk; (3) enabling the computer device to read list addresses of various cached temporary datum distributed in the memory unit that are recorded by the buffer head address in the nonvolatile memory unit; (4) after triggering a program to write the cached data back to the disk, searching data status elements from a list address of the cached temporary data after the buffer head address, and judging whether the data status element indicate that the data was written back to the disk, if yes, stopping writing data back to the disk, and going on to read and judge the next list of data status element, and if not, immediately and synchronously writing back the cached data pointed to by the status elements in the list address to disk, until finishing searching all of the status elements recording list addresses of the various cached temporary datum distributed in the memory unit; and (5) after synchronously finishing storing the cached data, beginning to perform normal initialization and the cached distribution mechanism for the memory unit, and recording the buffer head address into the nonvolatile memory unit after finishing distribution, so that temporary datum in the memory can be restored when the computer device is restarted after powering off abnormally.