libc: build tsd only when tls is enabled
[uclibc-ng.git] / libpthread / nptl / sysdeps / mips / sysdep.h
blobb53c9a9c46c797de09a32c4ddd45bd7a4b595de4
1 /* Copyright (C) 1992, 1995, 1997, 1999, 2000, 2002, 2003, 2004
2 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Contributed by Brendan Kehoe (brendan@zen.org).
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, write to the Free
18 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 02111-1307 USA. */
21 #include <sgidefs.h>
22 #include <common/sysdep.h>
24 #ifdef __ASSEMBLER__
26 #include <regdef.h>
28 #define ENTRY(name) \
29 .globl name; \
30 .align 2; \
31 .ent name,0; \
32 name##:
34 #undef END
35 #define END(function) \
36 .end function; \
37 .size function,.-function
39 #define ret j ra ; nop
41 #undef PSEUDO_END
42 #define PSEUDO_END(sym) .end sym; .size sym,.-sym
44 #define PSEUDO_NOERRNO(name, syscall_name, args) \
45 .align 2; \
46 ENTRY(name) \
47 .set noreorder; \
48 li v0, SYS_ify(syscall_name); \
49 syscall
51 #undef PSEUDO_END_NOERRNO
52 #define PSEUDO_END_NOERRNO(sym) .end sym; .size sym,.-sym
54 #define ret_NOERRNO ret
56 #define PSEUDO_ERRVAL(name, syscall_name, args) \
57 .align 2; \
58 ENTRY(name) \
59 .set noreorder; \
60 li v0, SYS_ify(syscall_name); \
61 syscall
63 #undef PSEUDO_END_ERRVAL
64 #define PSEUDO_END_ERRVAL(sym) .end sym; .size sym,.-sym
66 #define ret_ERRVAL ret
68 #define r0 v0
69 #define r1 v1
70 /* The mips move insn is d,s. */
71 #define MOVE(x,y) move y , x
73 #if _MIPS_SIM == _ABIO32
74 # define L(label) $L ## label
75 #else
76 # define L(label) .L ## label
77 #endif
79 /* Note that while it's better structurally, going back to call __syscall_error
80 can make things confusing if you're debugging---it looks like it's jumping
81 backwards into the previous fn. */
82 #ifdef __PIC__
83 #define PSEUDO(name, syscall_name, args) \
84 .align 2; \
85 99: la t9,__syscall_error; \
86 jr t9; \
87 ENTRY(name) \
88 .set noreorder; \
89 .cpload t9; \
90 li v0, SYS_ify(syscall_name); \
91 syscall; \
92 .set reorder; \
93 bne a3, zero, 99b; \
94 L(syse1):
95 #else
96 #define PSEUDO(name, syscall_name, args) \
97 .set noreorder; \
98 .align 2; \
99 99: j __syscall_error; \
100 nop; \
101 ENTRY(name) \
102 .set noreorder; \
103 li v0, SYS_ify(syscall_name); \
104 syscall; \
105 .set reorder; \
106 bne a3, zero, 99b; \
107 L(syse1):
108 #endif
110 #endif