]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/uclibc/lib/contrib/uclibc/libc/sysdeps/linux/cris/sysdep.S
Inital import
[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    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17    Boston, MA 02111-1307, USA.  */
18
19 #include <features.h>
20 #include "sysdep.h"
21
22 /* The syscall stubs jump here when they detect an error, bot for PIC and
23    non-PIC.  */
24
25         .syntax no_register_prefix
26
27 ENTRY (__syscall_error)
28         neg.d   r10,r10
29
30 #ifdef  __UCLIBC_HAS_THREADS__
31         subq    4,sp
32         move.d  r10,[sp]
33         subq    4,sp
34         move    srp,[sp]
35
36         /* Note that __syscall_error is only visible within this library,
37            and no-one passes it on as a pointer, so can assume that R0 (GOT
38            pointer) is correctly set up.  */
39         PLTCALL (HIDDEN_JUMPTARGET(__errno_location))
40
41         move    [sp+],srp
42         move.d  [sp+],r11
43         move.d  r11,[r10]
44
45 #else /* not __UCLIBC_HAS_THREADS__ */
46 #ifdef __arch_v32
47 # ifdef __PIC__
48         addo.d  C_SYMBOL_NAME(errno:GOT),r0,acr
49         move.d  [acr],r9
50         move.d  r10,[r9]
51 # else /* not __PIC__ */
52         lapc    C_SYMBOL_NAME(errno),acr
53         move.d  r10,[r9]
54 # endif /* not __PIC__ */
55 #else /* not __arch_v32 */
56 # ifdef __PIC__
57         move.d  [r0+C_SYMBOL_NAME(errno:GOT)],r9
58         move.d  r10,[r9]
59 # else
60         move.d  r10,[C_SYMBOL_NAME(errno)]
61 # endif
62 #endif /* not __arch_v32 */
63 #endif /* __UCLIBC_HAS_THREADS__ */
64
65 #ifdef __PIC__
66 /* PIC callers are supposed to have R0 on stack, ready for us to restore.
67    Callers are only allowed from within this DSO, so the GOT in r0 is the
68    one we want to use.
69
70    (Don't use "ret" - it's a macro).   */
71
72         moveq   -1,r10
73         Ret
74         move.d  [sp+],r0
75 #else
76         Ret
77         moveq   -1,r10
78 #endif
79
80 END (__syscall_error)