Page 1 of 1

Retrieve kernel adress and size

Posted: Sat Dec 14, 2013 8:54 pm
by kutkloon7
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?

Re: Retrieve kernel adress and size

Posted: Sat Dec 14, 2013 9:12 pm
by FallenAvatar
Linker Variables should work correctly.

- Monk

Re: Retrieve kernel adress and size

Posted: Sun Dec 15, 2013 6:02 pm
by kutkloon7
Great, thanks! Never heard of em before.