Ooops! Attached is the correct SYS.s. Sorry about that.
--
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
On Tue, 13 Jul 1999, Philip Blundell wrote:
> >I am running 2.2.10-rmk2-stk1 on an ebsa-285 like board. I have
> >implemented my own system call which reads out some data stored in the
> >kernel, or lets the user change this data depending on what arguments
> >they pass in. It takes 4 arguments:
>
> You should probably consider using sysctl for this, incidentally.
>
> >if ((i = syscall(VP_SYSCALL, &my_vp, &my_vp_size, 0, 0)) < 0)
>
> Where is your definition of `syscall' coming from; can you post the
> preprocessed output and/or assembler that it generates?
>
> >It looks like it actually pushes all 5 arguments passed to it onto the
> >stack, and thus the reason for the syscall number being the first
> >argument to my sys_vend_param() function. If I put a dummy int as the
> >first argument to my sys_vend_param() routine, things seem to work fine.
> >
> >Is this expected behaviour?
>
> Kind of. The ARM Linux ABI puts the syscall number in the SWI instruction
> rather than in a register. So yes, it is expected that all five arguments to
> the syscall are simply passed straight through to your routine, but no it is
> not expected that one of them is your syscall number.
>
> p.
>
>
.file "sys_call.c"
rfp .req r9
sl .req r10
fp .req r11
ip .req r12
sp .req r13
lr .req r14
pc .req r15
gcc2_compiled.:
__gnu_compiled_c:
.section .rodata
.align 2
.LC0:
.ascii "Slotnum: %d\012\000"
.align 2
.LC1:
.ascii "sys_vend_param\000"
.align 2
.LC2:
.ascii "syscall() return value: %d\012\000"
.text
.align 2
.global main
.type main,%function
main:
@ args = 0, pretend = 0, frame = 1028
@ frame_needed = 1, current_function_anonymous_args = 0
mov ip, sp
stmfd sp!, {fp, ip, lr, pc}
sub fp, ip, #4
sub sp, sp, #1024
sub sp, sp, #8
mov r3, #0
str r3, [fp, #-20]
mov r3, #1016
str r3, [fp, #-1040]
ldrb r3, [fp, #-1027] @ zero_extendqisi2
ldr r0, .L3
mov r1, r3
bl printf
sub r3, fp, #1024
sub r3, r3, #12
sub r2, fp, #1024
sub r2, r2, #12
sub r2, r2, #4
mov r1, #0
str r1, [sp, #0]
mov r0, #191
add r0, r0, #9437184
mov r1, r3
mov r3, #0
bl syscall
mov r3, r0
str r3, [fp, #-16]
ldr r3, [fp, #-16]
cmp r3, #0
bge .L2
ldr r0, .L3+4
bl perror
ldr r0, .L3+8
ldr r1, [fp, #-16]
bl printf
b .L1
.L4:
.align 2
.L3:
.word .LC0
.word .LC1
.word .LC2
.L2:
ldrb r3, [fp, #-1027] @ zero_extendqisi2
ldr r0, .L5
mov r1, r3
bl printf
b .L1
.L6:
.align 2
.L5:
.word .LC0
.L1:
ldmea fp, {fp, sp, pc}
.Lfe1:
.size main, .Lfe1 - main
.ident "GCC: (GNU) egcs-2.91.60 Debian 2.1 (egcs-1.1.1 release)"