Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Hey, I was having an odd error when trying to clone a page directory. It was saying that my frame allocator was returning zero. This made no sense, because I explicitly tell the allocator to reserve the first frame as it holds important system stuff. So, I opened up GDB, connected, and began examining variables. I noticed that the pointer to my frame bitmap was NULL. As I stepped through the program (from the beginning) I realized it had always been NULL from the beginning, but for some reason it hadn't caused errors (it should have though... that is the IDT...). I set this pointer to the value of "end" which is exported from my linker script, and should point directly after my kernel, and upon examining "end" in gdb, I realized end was null also! Can you guys think of any reason that the linker would report "end" to be zero? Here is my linker script:
Wow... You guys are fast... You nailed it... I had read online that the symbols in a linker script were accessable in C, but not that an address had to be referenced like that! I thought it was a little weird that when I ran:
gdb>whatis end
out of curiosity, I got "int" which, if it was an address, should have been an "unsigned int". Thanks!
because I wasn't sure what type that the linker gave it.
Although, it seems I can't rely on this value now... sigh... Apperantly grub places important things like boot modules right after the kernel so... I have to account for that lol
EDIT:
Oh... wow... I wasn't thinking. In C, when there is no type, "int" is assumed. Bahahahaha I forgot. xD