Subject: Re: Loading DSP code from an LKM
To: None <tech-kern@netbsd.org>
From: Simon Burge <simonb@wasabisystems.com>
List: tech-kern
Date: 09/30/2001 20:22:15
der Mouse wrote:

> > The workarounds for PowerPC aren't hard (it's just necessary to force
> > a long jump), but it requires that all writers of LKMs either specify
> > this (obviously, not everybody knows about the problem), that it
> > become a default for -DLKM or something (which will make function
> > calls three instructions instead of one when it is, perhaps,
> > unnecessary to do so--like for internal functions).
> 
> As I recall, when I heard about this some time ago and looked at it, I
> determined there was a relatively simple and elegant way to fix it:
> have the linker, perhaps under control of a suitable option, generate
> stub long jumps as necessary.  The fixup would occur when the LKM .o
> file is linked against the kernel; when jumps are too long, ld would
> then generate a small blob of three or four instructions and point the
> short jump reloc at that blob; the blob would be the long jump.
> 
> I don't see anything obviously wrong with this, but since I've never
> actually tried implementing it, there may prove to be problems I
> haven't thought of.  I don't recall anyone pointing any out when it was
> discussed before....

Wouldn't this have problems with local branches within functions,
like those generated for if/then/else and switch?  All the offsets
are generated at assembly time, not link time.

Simon.
--
Simon Burge                            <simonb@wasabisystems.com>
NetBSD CDs, Support and Service:    http://www.wasabisystems.com/