Results 1 to 2 of 2
Hello all, I am trying to teach my kernel (22.214.171.124) to read/write from/to a certain spot in physical memory. Each time I boot a new kernel image, the system core ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 08-11-2008 #1
- Join Date
- Aug 2008
- Warwick, Ri
Physical memory access during kernel image boot
I am trying to teach my kernel (126.96.36.199) to read/write from/to a certain spot in physical memory. Each time I boot a new kernel image, the system core dumps.
Abstracting away from the my implementation, how can I access the CPU's internal memory from the Linux context?
I can see/tweak the memory during the first stage bootloader and in U-Boot, but once Linux takes over I cannot access the physical memory without having the system crash, saying it cannot handle the paging request.
What is the right way, using C and in the Linux kernel context, to directly read/write to physical memory?
I purposely haven't included my code because it is obviously wrong. I'd prefer to learn the right way, and then change my code to reflect the accepted coding practices.
Thank you to all.
- 08-15-2008 #2
- Join Date
- May 2008
I think only way you can directly access the physical memory during the boot time when paging is not enabled.
once paging is enabled you can to give only kernel/user virtual address.
pg0 and pg1 holds the ptes and which spawns the entry and set up the page tables.
entry in 0 and 1 will map the addresses linearly so I suppose, physical addresses.
0x00000000 to 0x007fffff can be accessed through direct physical maping, provided that some portion of that memory is writable : )
let me know whether this input helps !