module questions

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
Poseidon

module questions

Post by Poseidon »

The module support for my kernel is nearly finished :D. I only can't figure out when the ELF-file tells me that the call is relative, how I can link that address to a function in my kernel. When I use an absolute address in my module (by using a function pointer), it works all fine - except printing strings. Direct values (using putchar) works fine - a whole string with puts prints a whole bunch of weird characters on the screen.

Anyone? :)

Thanks :).
Poseidon

Re:module questions

Post by Poseidon »

i have figured out this code to link external relatives (and it works :o):

Code: Select all

*((uint*)(section.bits + rel.r_offset)) = 0xfffffffc - ((target - exports[i].addr) + rel.r_offset + section.base);

/* section.bits = programbits
 * 0xfffffffc = start at 0 at function (not sure about this, but it works)
 * target = where the program is in the memory
 * exports[i].addr = the address of the function in the kernel
 * rel.r_offset = where in the kernel the function is called
*/
so this code works... but i'm not sure this'll work in all cases?

thanks :)

btw, strings do work now as well :D:D
Post Reply