]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/uclibc/lib/contrib/uclibc/libc/sysdeps/linux/cris/sysdep.S
update
[l4.git] / l4 / pkg / uclibc / lib / contrib / uclibc / libc / sysdeps / linux / cris / sysdep.S
1 /* Copyright (C) 2001, 2003 Free Software Foundation, Inc.
2    This file is part of the GNU C Library.
3
4    The GNU C Library is free software; you can redistribute it and/or
5    modify it under the terms of the GNU Library General Public License as
6    published by the Free Software Foundation; either version 2 of the
7    License, or (at your option) any later version.
8
9    The GNU C Library is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    Library General Public License for more details.
13
14    You should have received a copy of the GNU Library General Public
15    License along with the GNU C Library; see the file COPYING.LIB.  If not,
16    see <http://www.gnu.org/licenses/>.  */
17
18 #include <features.h>
19 #include "sysdep.h"
20
21 /* The syscall stubs jump here when they detect an error, bot for PIC and
22    non-PIC.  */
23
24         .syntax no_register_prefix
25
26 ENTRY (__syscall_error)
27         neg.d   r10,r10
28
29 #ifdef  __UCLIBC_HAS_THREADS__
30         subq    4,sp
31         move.d  r10,[sp]
32         subq    4,sp
33         move    srp,[sp]
34
35         /* Note that __syscall_error is only visible within this library,
36            and no-one passes it on as a pointer, so can assume that R0 (GOT
37            pointer) is correctly set up.  */
38         PLTCALL (HIDDEN_JUMPTARGET(__errno_location))
39
40         move    [sp+],srp
41         move.d  [sp+],r11
42         move.d  r11,[r10]
43
44 #else /* not __UCLIBC_HAS_THREADS__ */
45 #ifdef __arch_v32
46 # ifdef __PIC__
47         addo.d  C_SYMBOL_NAME(errno:GOT),r0,acr
48         move.d  [acr],r9
49         move.d  r10,[r9]
50 # else /* not __PIC__ */
51         lapc    C_SYMBOL_NAME(errno),acr
52         move.d  r10,[r9]
53 # endif /* not __PIC__ */
54 #else /* not __arch_v32 */
55 # ifdef __PIC__
56         move.d  [r0+C_SYMBOL_NAME(errno:GOT)],r9
57         move.d  r10,[r9]
58 # else
59         move.d  r10,[C_SYMBOL_NAME(errno)]
60 # endif
61 #endif /* not __arch_v32 */
62 #endif /* __UCLIBC_HAS_THREADS__ */
63
64 #ifdef __PIC__
65 /* PIC callers are supposed to have R0 on stack, ready for us to restore.
66    Callers are only allowed from within this DSO, so the GOT in r0 is the
67    one we want to use.
68
69    (Don't use "ret" - it's a macro).   */
70
71         moveq   -1,r10
72         Ret
73         move.d  [sp+],r0
74 #else
75         Ret
76         moveq   -1,r10
77 #endif
78
79 END (__syscall_error)