Find the answer to your Linux question:
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, ...
  1. #1
    Just Joined!
    Join Date
    Apr 2009
    Posts
    2

    Question about checksum memory

    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, 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;

    local_irq_save(flags);
    sum=0;
    for(i=0;i<0x8000000;i=i+4) {
    result=readl(0xc0000000+i);
    sum+=(((result >> 24) & 0xff) + ((result >> 16) & 0xff) + ((result>> & 0xff) + (result & 0xff));
    }
    local_irq_restore(flags);

    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?

    Thanks!

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,970
    You are trying to checksum the operating system memory, or the memory used by a specific process?
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...