Dumping physical memory
Posted: Mon Jan 26, 2009 5:03 pm
I've got as far as integrating a malloc() into my C code, integrating the keyboard, detecting hardware, and I'm working on a command line interface (slowly but surely, because I'd like to get every little detail down).
Anyway, onto the subject of the topic: My panic() sucks.
The reality is, all it can do is tell the user that a kernel panic has occurred for whatever reason, and halting the system. While some may say that would suffice, what happens when I get a page fault and I don't know where the error came from?
I'd like to do a memory dump function. dump() or simply integrate it into panic() (although a separate dump() function would probably be better).
What I've tried (some of these, if not all of these, are probably stupid of me )...
-looping through memory addresses from 0x000000 to 0xffffff using a for() loop, and then puts(&address); This dumped random characters on-screen (although they were in alphabetical order, which is probably something worth noting).
-early on when I didn't know sh** about kernel development (trust me on this one, I didn't), I attempted to simply test whether or not I could memset without a crash. If it did, it would not panic, but instead attempt dump the results on screen. That probably didn't even come close to what I was looking for.
In general, I'm not exactly sure what I need to do to dump physical memory. That's physical memory.
I know the logic behind the code, but I don't know the code. Can someone fill me in on this or show me what needs to be going on?
Anyway, onto the subject of the topic: My panic() sucks.
The reality is, all it can do is tell the user that a kernel panic has occurred for whatever reason, and halting the system. While some may say that would suffice, what happens when I get a page fault and I don't know where the error came from?
I'd like to do a memory dump function. dump() or simply integrate it into panic() (although a separate dump() function would probably be better).
What I've tried (some of these, if not all of these, are probably stupid of me )...
-looping through memory addresses from 0x000000 to 0xffffff using a for() loop, and then puts(&address); This dumped random characters on-screen (although they were in alphabetical order, which is probably something worth noting).
-early on when I didn't know sh** about kernel development (trust me on this one, I didn't), I attempted to simply test whether or not I could memset without a crash. If it did, it would not panic, but instead attempt dump the results on screen. That probably didn't even come close to what I was looking for.
In general, I'm not exactly sure what I need to do to dump physical memory. That's physical memory.
I know the logic behind the code, but I don't know the code. Can someone fill me in on this or show me what needs to be going on?