[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Preserving Memory Across Reboot



Since some of you asked me how I did it.

- This is extremely simple
- My changes work on PPC
- May also work on some of i386, on which BIOS does not zero out memory at reboot time
- I used boot time allocation api, there are four of them, pick up any one which fits you need
- I added one line to init/main.c, in the strat_kernel function, after setup_arch call, this call
  allocates memory and pass me pointer. I save this pointer in the global variable, which my
  module latter picks up (& provide memory mapping to apps). This pointer variable name is
exported
  so module can see/link to it.
- This call can be made from staticly linked driver (what I have read, but not tried)
- I used alloc_bootmem api, only problem is that alloc_bootmem before returning zero out allocated
  memory. I changed to not to zero out in case of my call, but otherwise do it.

Hopefully I explained it clearly.

Usman

=====
Usman S. Ansari
Linux OS & Device Drivers

__________________________________________________
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/