Relocatable code and GRUB

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.
Post Reply
DarylD

Relocatable code and GRUB

Post 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.
User avatar
df
Member
Member
Posts: 1076
Joined: Fri Oct 22, 2004 11:00 pm
Contact:

Re:Relocatable code and GRUB

Post 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.
-- Stu --
DarylD

Re:Relocatable code and GRUB

Post 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?
DarylD

Re:Relocatable code and GRUB

Post by DarylD »

Incidentally, does anybody know of any well documented elf loader code anywhere?

Thanks.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Relocatable code and GRUB

Post 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 ...
Post Reply