Port-arm archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: converting SWIs to pass swi number in a register.



On Wed, 2008-07-02 at 22:41 -0700, Matt Thomas wrote:
> On Jul 2, 2008, at 2:43 PM, Chris Gilbert wrote:
> 
> > Hi,
> >
> > I was wondering if anyone had an opinion on switching to passing  
> > the SWI  number into syscall.  I know Linux did this a while back.
> >
> > I think it particularly makes sense for processors with seperate  
> > instruction and data caches, as it save taking a data cache miss  
> > for every SWI call.
> >
> > Looking at the current code and our current ABI, I'm thinking we  
> > could use ip (r12) to pass the SWI to the kernel, eg SYSTRAP  
> > becomes similar to this:
> > #define SYSTRAP(x)      \
> >                         mov r12, # ((SYS_ ## x) & 0xff) ;\
> >                         add r12, r12, #((SYS_ ## x) & 0xff00) ;\
> >                         swi SWI_OS_NETBSD | SYS_ ## x
> >
> > Note I thinking we can probably a bit of tweaking to remove an  
> > instruction count if the swi is < 256
> >
> > This would allow a post 5.0 kernel to only need to look at the r12/ 
> > ip to work out the SWI call.
> 
> I'm already doing that for the THUMB SWI where syscall # > 255.
> One question is how do we know we are using ip?  Think binary
> compat with older binaries...
> 

Use 0 in the SWI # field (as linux does).  You only need to look in the
SWI field if you have a relevant COMPAT_.. enabled.

Overall I think this would be a good move (with potential performance
boost), but probably should be combined with a move to the AEABI as
well...

BTW, AFAICT linux uses r7 for the syscall number, since Thumb finds it
very hard to set up r12.

R.



Home | Main Index | Thread Index | Old Index