Results 1 to 2 of 2
Hi all, I am working on memory dump feature. Now I can dump all memory out to a file by using a tool (0xc0000000 to 0xcfffffff, 256M bytes data),. However, ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 04-23-2009 #1
- Join Date
- Apr 2009
a question about memory dump of kernel code
I am working on memory dump feature. Now I can dump all memory out to a file by using a tool (0xc0000000 to 0xcfffffff, 256M bytes data),. However, I need to verify what I dump is exactly the same in flash memory.
One solution is to disable interrupt and do checkum when system is on, i.e. capture a snapshot. And printk it. Then reboot the system directly to make it go into hardware boot processing part, then use my tool to dump data to a file. And do the same checksum operation to the file, to compare whether they are bitmatch.
However, I encountered a problem here.
Since my checkum function also need to declare several parameters to implement functionality, it means the value will be changed definitely. But these parameters will also be part of checkum... So when I read it, it maybe 1, however, after checksum finished, the vlaue will be changed to xxx. It will be different with the one in file for sure!
unsigned int flags,result,i;
unsigned char sum;
sum+=(((result >> 24) & 0xff) + ((result >> 16) & 0xff) + ((result>> & 0xff) + (result & 0xff));
My question is how can I do checksum? i.e. do whole memory checkum, and everything is frozen there? Maybe I should put my code in memory directly somehow?
- 04-24-2009 #2
- Join Date
- Apr 2009
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
This is not easy. As soon as you run a program, the system's memory image is changing. You would have to write some code that can run entirely out of CPU cache to do this, and not interact with the OS at all. Such a theoretical process could somehow snapshot the memory imsage, but it would have to be to a device that the OS is not in control of.
So, all I can say is, Good Luck!
P.S. I think this is the "rocket science" part of programming!Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!