chiark / gitweb /
0e73f68ed09ad2a1ba3ae940ddc4dbacdfab43ff
[elogind.git] / klibc / klibc / arch / arm / syscall.S
1 /*
2  * arch/arm/syscall.S
3  *
4  * System call common handling
5  */
6
7         .type   __syscall_common,#function
8         .globl  __syscall_common
9 #ifndef __thumb__
10         /* ARM version - this is executed after the swi */
11
12         .align  4
13 __syscall_common:
14         cmn     r0, #4096
15         rsbcs   r2, r0, #0
16         ldrcs   r3, 1f
17         mvncs   r0, #0
18         strcs   r2, [r3]
19         ldmfd   sp!,{r4,r5,pc}
20         
21         .align 4        
22 1:
23         .word   errno
24
25 #else
26         /* Thumb version - must still load r4 and r5 and run swi */
27
28         .thumb_func
29         .align  2
30 __syscall_common:
31         ldr     r4, [sp #12]
32         ldr     r5, [sp #16]
33         swi     0
34         ldr     r1, 2f
35         cmp     r0, r1
36         bcc     1f
37         ldr     r1, 3f
38         neg     r2, r0
39         mvn     r0, #0  
40         str     r2, [r1]
41 1:
42         pop     {r4,r5,r7,pc}
43
44         .align  4
45 2:
46         .word   #-4095
47 3:
48         .word   errno
49
50 #endif