Subject: Re: Do LKMs work *at*all* on powerpc platforms?
To: None <port-macppc@netbsd.org, gr@eclipsed.net>
From: Wolfgang Solfrank <ws@tools.de>
List: port-powerpc
Date: 08/02/2000 16:57:57
Hi,
sorry for the delay.
No, LKMs probably don't work on any powerpc platform.
The reason is that the C compiler uses the "bl" instruction to do
(ordinary, i.e. not through a function pointer) subroutine calls. Those
instructions have limitations in that they can only reach destinations
less than 32MB apart from the current location. Due to the way the kernel
lays out its memory, any LKM is too far away from the kernel text to be
reachable by this instruction :-(.
> ld -R /netbsd -e miscmod -o miscmod -Ttext 0x0 combined.o
This works, because the kernel is loaded somewhare low in memory. Therefor
the distance between the kernel and your module (which is linked as though
it would be loaded at address 0 by this ld-run) is small enough to be
in reach.
For the record, this first ld-run is used to determine the size of the
module. Having this size, modload will allocate this amount of kernel
memory and then rerun ld to link the module for the allocated region:
> ld -R /netbsd -e miscmod -o miscmod -Ttext 0xe9240000 -Tdata 0xe92404ac combined.o
For this second run, the allocated region of memory is too far away to be
reachable by the kernel (and vice versa).
> PS, side question... why do we always statically link? Do we not
> support elf shared libs yet on ppc?
We cannot use the dynamic linker in the kernel. That one only supports
userlevel programs.
Hope this explains things (albeit it probably doesn't help :-().
Ciao,
Wolfgang
--
ws@TooLs.DE Wolfgang Solfrank, TooLs GmbH +49-228-985800