Retrieve kernel adress and size
Posted: Sat Dec 14, 2013 8:54 pm
I'm currently working on a physical memory manager for my kernel. I'd like to know at which adress my kernel image is loaded, and how big it is. I use an ELF-executable, so one way would just be to check for the lowest adress for a loadable section, mark that as the base adress, and do something similar for the biggest adress. However, it would be nice to actually use a multiboot structure (following the specification) to pass the information (since I already use the same structure for the memory map).
However, it seems like the multiboot structure doesn't have a field for this, so the kernel 'know' how big it is (it is always loaded at 1MB, so that isn't a big problem). What is an elegant way to do this?
However, it seems like the multiboot structure doesn't have a field for this, so the kernel 'know' how big it is (it is always loaded at 1MB, so that isn't a big problem). What is an elegant way to do this?