Subject: Re: Loading DSP code from an LKM
To: None <tech-kern@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-kern
Date: 09/30/2001 05:35:54
> 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....

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B