Subject: Re: RFC: Change SWI number base?
To: None <port-arm@netbsd.org>
From: David Laight <David.Laight@btinternet.com>
List: port-arm
Date: 01/04/2002 13:48:46
> 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...
> 
> 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).

Arm:
    swi    SYS_foo
    movcc  pc,lr
    b      __cerror

Thumb:
    .word  SYS_foo
label:
    swi    0
    bcs    __cerror
    mov    pc,lr        /* or is it 'ret' */

Kernel:
    code = *(unsigned short *)(load + saved_pc - 4);

        David