chiark / gitweb /
41a0486679b0163192aaa3698381e2f57778a2e0
[elogind.git] / klibc / klibc / arch / sh / syscall.S
1 /*
2  * arch/sh/syscall.S
3  *
4  * On sh, r3 contains the syscall number (set by generated stub);
5  * r4..r7 contain arguments 0-3 per the standard calling convention,
6  * and arguments 4-5 are passed in r0 and r1.
7  *
8  * The return value is in r3 rather than standard r0.
9  */
10
11         .section ".text.syscall","ax"
12         .align  2
13         .globl  ___syscall_common
14         .type   ___syscall_common,@function
15 ___syscall_common:
16         mov.l   @(sp),r0
17         mov.l   @(4,sp),r1
18         trapa   #0x15
19         mov.l   1f,r0
20         cmp/hs  r0,r3
21         bt/s    3f
22           neg   r3,r4
23         mov.l   2f,r5
24         mov.l   r4,@r5
25         rts
26           mov   #-1,r0
27 3:
28         rts
29           mov   r3,r0
30
31         .align 2
32 1:      .long   -4096           /* Errno limit */
33 2:      .long   errno
34
35         .size   ___syscall_common,.-___syscall_common