Subject: Re: RFC: Change SWI number base?
To: David Laight <David.Laight@btinternet.com>
From: Richard Earnshaw <rearnsha@arm.com>
List: port-arm
Date: 01/04/2002 14:04:59
> > code = 0;
> > 
> > if (saved_pc & THUMB_BIT == 0) {
> > instruction = load[saved_pc - 4];
> > code = instruction & 0xffffff;
> > }
> > if (code == 0) {
> > code = reg0;
> > shuffle_regs();
> > }
> > 
> > While the alternative would be
> > 
> > code = reg0;
> > /* No need to shuffle regs, since we can adjust all uses.  */
> 
> No - you still need the userspace shuffle...

Incorrect, the current code

        stackargs = (caddr_t)&frame->tf_r0;
        regparams = 4 * sizeof(int);
        callp = p->p_emul->e_sysent;

        switch (code) { 
        case SYS_syscall:
                /* Don't have to look in user space, we have it in the 
trapframe
 */
/*              code = fuword(stackargs);*/
                code = ReadWord(stackargs);
                stackargs += sizeof(int);
                regparams -= sizeof(int);
                break;

simply becomes

	stackargs = (caddr_t) &frame->tf_r1;
	regparms = 3 * sizeof(int);
	callp = p->p_emul->e_sysent;

> > 
> > When you take into account the fact that mem[saved_pc] will probably not 
> > be in the Dcache (it will normally be only in the Icache), the second 
> > sequence should execute significantly faster; certainly it should be much 
> > faster than the overhead of shuffling the registers before the call.
> > 
> 
> Actually I think the following will work (provided 16bit syscall numbers
> are adequate).

They aren't.