Subject: Re: Do LKMs work *at*all* on powerpc platforms?
To: None <dje@watson.ibm.com, root@ihack.net, greg@evertz.com>
From: Wolfgang Solfrank <ws@tools.de>
List: port-macppc
Date: 08/02/2000 18:31:34
Hi,

> There are a couple of different solutions to this problem...
> 
> 1) Compile all LKM code as quasi-PIC on platforms with limited
>    jmp/call range -- meaning that references are always stored in and
>    loaded from the data segment.  This would cause a slight
>    performance hit, but it would be no worse than regular PIC code.
> 
> 2) Reserve VA space around the loaded kernel image to store LKM code.
> 
> The latter is probably easier and more expedient to implement, though
> the former isn't really hard for a GCC g00r00.  Perhaps you'd like to
> work on it, David?  B-)

Actually, doing 2) wouldn't be _that_ easy due to the way the kernel
vm is layed out.  (For the record, the kernel is loaded into a 256 MB
segment that is mapped 1:1 to physical memory.  Therefore reserving
VA space near the kernel image would require reserving physical memory
as well).

The easiest would probably be do 1), using a path Greg Kritsch pointed
out in his other mail, i.e. to make use of gcc's ability to compile all
calls to a function via a function pointer.  Unfortunately, it seems as
though currently there is no command line option to enable this for all
functions, so you have to specify the "longcall" attribute for every
function prototype :-(.

Anyone interested in adding a command line option to gcc for this?

Ciao,
Wolfgang
-- 
ws@TooLs.DE     Wolfgang Solfrank, TooLs GmbH 	+49-228-985800