Page 1 of 1

Relocatable code and GRUB

Posted: Sat Jan 04, 2003 1:44 pm
by DarylD
I have moved some code for keyboard handling/console out of my kernel and into GRUB boot modules. I have them loaded and also moved to 0xb0000000 onwards which is my module area. They are compiled to be relocatable code and looking at the ld disassembly dump this seems to be true.

*But* I am getting inexplicable page faults at 0x80000000 onwards which is my kernel area.

Anybody who has done this before, any ideas?

PS. They worked fine when simply linked into the kernel direct. And also they are self-contained and using interrupts to communicate with the kernel interfaces, so no problems there.

Re:Relocatable code and GRUB

Posted: Sat Jan 04, 2003 2:17 pm
by df
grub modules are not loaded, they are just put in memory. so your modules will sit with ELF headers, etc. unless you have runtime linked them.

Re:Relocatable code and GRUB

Posted: Sat Jan 04, 2003 3:29 pm
by DarylD
Ah, that might certainly explain things a little.

So is there an easy way of runtime linking them or do I need to write an elf loader?

Re:Relocatable code and GRUB

Posted: Sat Jan 04, 2003 3:30 pm
by DarylD
Incidentally, does anybody know of any well documented elf loader code anywhere?

Thanks.

Re:Relocatable code and GRUB

Posted: Sat Jan 04, 2003 6:14 pm
by Pype.Clicker
i do have a small ELF loader (for conversion purpose mainly, but it could help though ...)

check elfopen.c if you need some inspiration ...