Hi,
On Tue, 13 Jul 1999, Russell King - ARM Linux Admin wrote:
> Philip Blundell writes:
> > Russell can probably give you a more definitive answer. I don't really have
> > time to experiment with it right now.
>
> No, I don't see anything wrong with the code. It's highly optimised tho...
> Here's the explaination of how it works:
>
> The SP is pointing at the stacked r0, hence:
>
> r5
> r4
> r3
> r2
> r1
> SP-> r0
>
> The LDMIB loads into r0 to r4 the values of r1 to r5, hence shifting
> the arguments down one register (LDMIB increments before the load
> operation). This is done since the arguments to the syscall are
> (syscall_number, arg0, arg1, arg2, ...) and we want arg0 in r0.
>
> Next, to be compliant with APCS r4 is stacked by replacing the original
> r0. This is ok, since the value will overwritten later. We now have
> the arguments for the system call in r0 to r3, with the fifth argument
> on the stack. Plus, more importantly, original r1 - r5 stacking is left
> untouched in case we need to redo the call.
>
> We now call the real syscall.
>
Okay, I understand the above. But, when I looked at kernel 2.3.6, I saw
the following section of code. It differs from 2.2.10, and follows
along the lines of how Phil told me to modify 2.2.10:
@ r0 = syscall number
@ r1 = syscall r0
@ r5 = syscall r4
@ ip = syscall table
SYMBOL_NAME(sys_syscall):
mov r6, r0
eor r6, r6, #OS_NUMBER << 20
cmp r6, #NR_syscalls @ check range
movgt r0, #-ENOSYS
movgt pc, lr
add sp, sp, #4 @ take of the save of our r4
ldmib sp, {r0 - r4} @ get our args
str r4, [sp, #-4]! @ Put our arg on the stack
ldr pc, [ip, r6, lsl #2]
So, if I follow this route in 2.2.10, things work as expected.
--
Kyle Mestery | StorageTek's Storage Networking Group
[EMAIL PROTECTED] | http://www.freebsd.org/
[EMAIL PROTECTED] | http://www.netwinder.org/
Protect your right to privacy: www.freecrypto.org
unsubscribe: body of `unsubscribe linux-arm' to [EMAIL PROTECTED]