Subject: RE: Do LKMs work *at*all* on powerpc platforms?
To: 'David Edelsohn' <dje@watson.ibm.com>
From: Greg Kritsch <greg@evertz.com>
List: port-macppc
Date: 08/02/2000 11:16:45
There is something in GCC, far call or long call attribute, that will cause
it to generate a branch through LR or CTR.  I had to use this for some
embedded work I was doing.  It's specified on the function prototype.

Is there a way to attach that attribute only when compling an LKM, and only
to functions not implemented by the LKM itself?  It would be wasteful to use
such branches for everything.

Of course, there's also the bit about it being non-portable to consider.

Gregory

> >>>>> Wolfgang Solfrank writes:
> 
> Wolfgang> No, LKMs probably don't work on any powerpc platform.
> 
> Wolfgang> The reason is that the C compiler uses the "bl" 
> instruction to do
> Wolfgang> (ordinary, i.e. not through a function pointer) 
> subroutine calls.  Those
> Wolfgang> instructions have limitations in that they can only 
> reach destinations
> Wolfgang> less than 32MB apart from the current location.  
> Due to the way the kernel
> Wolfgang> lays out its memory, any LKM is too far away from 
> the kernel text to be
> Wolfgang> reachable by this instruction :-(.
> 
> 	This cannot be arranged to pass in a function pointer or a
> transfer vector of function pointers?  Branches to constant 
> displacements
> are limited in distance to within a segment, but branches via 
> a pointer
> through the CTR or LR registers have unlimited range.
> 
> David
>