Subject: Syscall interface (was: Re: Shared library support for ARM ELF )
To: None <Richard.Earnshaw@arm.com>
From: Ben Harris <bjh21@netbsd.org>
List: port-arm
Date: 07/23/2001 11:27:19
On Mon, 23 Jul 2001, Richard Earnshaw wrote:

> libarm32 could be made into a symlink to libarm.

Oh yeah, I hadn't thought of that.  Feel free to rename it, then.

> A good suggestion, however, that brings up another issue if we ever want
> to support Thumb (which I'd like to see sometime).
>
> The SWI space in the thumb instruction only allows for 256 SWI calls, but
> we already have more than that number of syscall entries.  That means that
> either
> 1) We have to switch into ARM mode before making a syscall (well, if
> making a syscall to a swi higher than 255); then we have to switch back
> again afterwards.

Is this actually much of a pain?  ISTR that thumb interworking was
reasonably lightweight, and mostly happened automatically in the
procedure-call interface?

> 2) We need to have a new mechanism for passing the syscall number.
>
> One solution for 2 would be to pass the syscall number in r0 (or some
> other register -- ip might be a good choice[1]); this might even be more
> efficient, since then the kernel doesn't have to grub around decoding the
> instruction to see which SWI is being executed.

We already have that, in the form of syscall() (which is conveniently SWI
0, and hence usable on Thumb).  The only thing you can't do with it is
invoke syscall() recursively, and that can probably be fixed fairly
easily.

-- 
Ben Harris                                                   <bjh21@netbsd.org>
Portmaster, NetBSD/arm26               <URL:http://www.netbsd.org/Ports/arm26/>