Subject: Re: RFC: Change SWI number base?
To: David Laight <David.Laight@btinternet.com>
From: Ben Harris <bjh21@netbsd.org>
List: port-arm
Date: 01/08/2002 09:20:36
On Fri, 4 Jan 2002, David Laight wrote:

> > stackargs = (caddr_t) &frame->tf_r1;
> > regparms = 3 * sizeof(int);
> > callp = p->p_emul->e_sysent;
>
> Yes... I don't have the source available....
> Does lose a register arg though.
>
> Could the syscall number be passed in the user r12?
> It is available - unless the SWI entry code already trashes it.

This seems a far better idea that using R0.  It only adds one instruction
to the current ARM-state veneer, and produces a shorter Thumb-state veneer
than using R0 despite the pain of getting at high registers from Thumb
state.

> Ok - make the thumb code:
>     .balign  4
>     .short   syscall & 0xffff
> entry:
>     swi      syscall >> 16
>     bcs      __cerror
>     ret
>
> And do a 32 bit load from pc-4 (as in the current ARM version).
> The linker should honour the alignment rule.

That is a truly evil hack.  Well done.  Unfortunately, it won't work on
big-endian systems (which we might well end up supporting some day).

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