OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [uClibc/] [ldso/] [ldso/] [powerpc/] [ld_syscalls.h] - Blame information for rev 1771

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1325 phoenix
/*
2
 * This file contains the system call macros and syscall
3
 * numbers used by the shared library loader.
4
 */
5
 
6
#define __NR_exit                 1
7
#define __NR_read                 3
8
#define __NR_write                4
9
#define __NR_open                 5
10
#define __NR_close                6
11
#define __NR_getpid              20
12
#define __NR_getuid              24
13
#define __NR_geteuid             49
14
#define __NR_getgid              47
15
#define __NR_getegid             50
16
#define __NR_readlink            85
17
#define __NR_mmap                90
18
#define __NR_munmap              91
19
#define __NR_stat               106
20
#define __NR_mprotect           125
21
 
22
/* Here are the macros which define how this platform makes
23
 * system calls.  This particular variant does _not_ set
24
 * errno (note how it is disabled in __syscall_return) since
25
 * these will get called before the errno symbol is dynamicly
26
 * linked. */
27
 
28
#undef __syscall_return
29
#define __syscall_return(type) \
30
        return (__sc_err & 0x10000000 ? /*errno = __sc_ret,*/ __sc_ret = -1 : 0), \
31
               (type) __sc_ret
32
 
33
#undef __syscall_clobbers
34
#define __syscall_clobbers \
35
        "r9", "r10", "r11", "r12"
36
        //"r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12"
37
 
38
#undef _syscall0
39
#define _syscall0(type,name)                                            \
40
type name(void)                                                         \
41
{                                                                       \
42
        unsigned long __sc_ret, __sc_err;                               \
43
        {                                                               \
44
                register unsigned long __sc_0 __asm__ ("r0");           \
45
                register unsigned long __sc_3 __asm__ ("r3");           \
46
                                                                        \
47
                __sc_0 = __NR_##name;                                   \
48
                __asm__ __volatile__                                    \
49
                        ("sc           \n\t"                            \
50
                         "mfcr %1      "                                \
51
                        : "=&r" (__sc_3), "=&r" (__sc_0)                \
52
                        : "0"   (__sc_3), "1"   (__sc_0)         \
53
                        : "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" ); \
54
                __sc_ret = __sc_3;                                      \
55
                __sc_err = __sc_0;                                      \
56
        }                                                               \
57
        __syscall_return (type);                                        \
58
}
59
 
60
#undef _syscall1
61
#define _syscall1(type,name,type1,arg1)                                 \
62
type name(type1 arg1)                                                   \
63
{                                                                       \
64
        unsigned long __sc_ret, __sc_err;                               \
65
        {                                                               \
66
                register unsigned long __sc_0 __asm__ ("r0");           \
67
                register unsigned long __sc_3 __asm__ ("r3");           \
68
                                                                        \
69
                __sc_3 = (unsigned long) (arg1);                        \
70
                __sc_0 = __NR_##name;                                   \
71
                __asm__ __volatile__                                    \
72
                        ("sc           \n\t"                            \
73
                         "mfcr %1      "                                \
74
                        : "=&r" (__sc_3), "=&r" (__sc_0)                \
75
                        : "0"   (__sc_3), "1"   (__sc_0)         \
76
                        : "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" ); \
77
                __sc_ret = __sc_3;                                      \
78
                __sc_err = __sc_0;                                      \
79
        }                                                               \
80
        __syscall_return (type);                                        \
81
}
82
 
83
#undef _syscall2
84
#define _syscall2(type,name,type1,arg1,type2,arg2)                      \
85
type name(type1 arg1, type2 arg2)                                       \
86
{                                                                       \
87
        unsigned long __sc_ret, __sc_err;                               \
88
        {                                                               \
89
                register unsigned long __sc_0 __asm__ ("r0");           \
90
                register unsigned long __sc_3 __asm__ ("r3");           \
91
                register unsigned long __sc_4 __asm__ ("r4");           \
92
                                                                        \
93
                __sc_3 = (unsigned long) (arg1);                        \
94
                __sc_4 = (unsigned long) (arg2);                        \
95
                __sc_0 = __NR_##name;                                   \
96
                __asm__ __volatile__                                    \
97
                        ("sc           \n\t"                            \
98
                         "mfcr %1      "                                \
99
                        : "=&r" (__sc_3), "=&r" (__sc_0)                \
100
                        : "0"   (__sc_3), "1"   (__sc_0),                \
101
                          "r"   (__sc_4)                                \
102
                        : "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" ); \
103
                __sc_ret = __sc_3;                                      \
104
                __sc_err = __sc_0;                                      \
105
        }                                                               \
106
        __syscall_return (type);                                        \
107
}
108
 
109
#undef _syscall3
110
#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3)           \
111
type name(type1 arg1, type2 arg2, type3 arg3)                           \
112
{                                                                       \
113
        unsigned long __sc_ret, __sc_err;                               \
114
        {                                                               \
115
                register unsigned long __sc_0 __asm__ ("r0");           \
116
                register unsigned long __sc_3 __asm__ ("r3");           \
117
                register unsigned long __sc_4 __asm__ ("r4");           \
118
                register unsigned long __sc_5 __asm__ ("r5");           \
119
                                                                        \
120
                __sc_3 = (unsigned long) (arg1);                        \
121
                __sc_4 = (unsigned long) (arg2);                        \
122
                __sc_5 = (unsigned long) (arg3);                        \
123
                __sc_0 = __NR_##name;                                   \
124
                __asm__ __volatile__                                    \
125
                        ("sc           \n\t"                            \
126
                         "mfcr %1      "                                \
127
                        : "=&r" (__sc_3), "=&r" (__sc_0)                \
128
                        : "0"   (__sc_3), "1"   (__sc_0),                \
129
                          "r"   (__sc_4),                               \
130
                          "r"   (__sc_5)                                \
131
                        : "r6", "r7", "r8", "r9", "r10", "r11", "r12" ); \
132
                __sc_ret = __sc_3;                                      \
133
                __sc_err = __sc_0;                                      \
134
        }                                                               \
135
        __syscall_return (type);                                        \
136
}
137
 
138
#undef _syscall4
139
#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
140
type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4)               \
141
{                                                                       \
142
        unsigned long __sc_ret, __sc_err;                               \
143
        {                                                               \
144
                register unsigned long __sc_0 __asm__ ("r0");           \
145
                register unsigned long __sc_3 __asm__ ("r3");           \
146
                register unsigned long __sc_4 __asm__ ("r4");           \
147
                register unsigned long __sc_5 __asm__ ("r5");           \
148
                register unsigned long __sc_6 __asm__ ("r6");           \
149
                                                                        \
150
                __sc_3 = (unsigned long) (arg1);                        \
151
                __sc_4 = (unsigned long) (arg2);                        \
152
                __sc_5 = (unsigned long) (arg3);                        \
153
                __sc_6 = (unsigned long) (arg4);                        \
154
                __sc_0 = __NR_##name;                                   \
155
                __asm__ __volatile__                                    \
156
                        ("sc           \n\t"                            \
157
                         "mfcr %1      "                                \
158
                        : "=&r" (__sc_3), "=&r" (__sc_0)                \
159
                        : "0"   (__sc_3), "1"   (__sc_0),                \
160
                          "r"   (__sc_4),                               \
161
                          "r"   (__sc_5),                               \
162
                          "r"   (__sc_6)                                \
163
                        : "r7", "r8", "r9", "r10", "r11", "r12" );      \
164
                __sc_ret = __sc_3;                                      \
165
                __sc_err = __sc_0;                                      \
166
        }                                                               \
167
        __syscall_return (type);                                        \
168
}
169
 
170
#undef _syscall5
171
#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \
172
type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5)   \
173
{                                                                       \
174
        unsigned long __sc_ret, __sc_err;                               \
175
        {                                                               \
176
                register unsigned long __sc_0 __asm__ ("r0");           \
177
                register unsigned long __sc_3 __asm__ ("r3");           \
178
                register unsigned long __sc_4 __asm__ ("r4");           \
179
                register unsigned long __sc_5 __asm__ ("r5");           \
180
                register unsigned long __sc_6 __asm__ ("r6");           \
181
                register unsigned long __sc_7 __asm__ ("r7");           \
182
                                                                        \
183
                __sc_3 = (unsigned long) (arg1);                        \
184
                __sc_4 = (unsigned long) (arg2);                        \
185
                __sc_5 = (unsigned long) (arg3);                        \
186
                __sc_6 = (unsigned long) (arg4);                        \
187
                __sc_7 = (unsigned long) (arg5);                        \
188
                __sc_0 = __NR_##name;                                   \
189
                __asm__ __volatile__                                    \
190
                        ("sc           \n\t"                            \
191
                         "mfcr %1      "                                \
192
                        : "=&r" (__sc_3), "=&r" (__sc_0)                \
193
                        : "0"   (__sc_3), "1"   (__sc_0),                \
194
                          "r"   (__sc_4),                               \
195
                          "r"   (__sc_5),                               \
196
                          "r"   (__sc_6),                               \
197
                          "r"   (__sc_7)                                \
198
                        : "r8", "r9", "r10", "r11", "r12" );            \
199
                __sc_ret = __sc_3;                                      \
200
                __sc_err = __sc_0;                                      \
201
        }                                                               \
202
        __syscall_return (type);                                        \
203
}
204
 
205
 
206
#undef _syscall6
207
#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5,type6,arg6) \
208
type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6)       \
209
{                                                                       \
210
        unsigned long __sc_ret, __sc_err;                               \
211
        {                                                               \
212
                register unsigned long __sc_0 __asm__ ("r0");           \
213
                register unsigned long __sc_3 __asm__ ("r3");           \
214
                register unsigned long __sc_4 __asm__ ("r4");           \
215
                register unsigned long __sc_5 __asm__ ("r5");           \
216
                register unsigned long __sc_6 __asm__ ("r6");           \
217
                register unsigned long __sc_7 __asm__ ("r7");           \
218
                register unsigned long __sc_8 __asm__ ("r8");           \
219
                                                                        \
220
                __sc_3 = (unsigned long) (arg1);                        \
221
                __sc_4 = (unsigned long) (arg2);                        \
222
                __sc_5 = (unsigned long) (arg3);                        \
223
                __sc_6 = (unsigned long) (arg4);                        \
224
                __sc_7 = (unsigned long) (arg5);                        \
225
                __sc_8 = (unsigned long) (arg6);                        \
226
                __sc_0 = __NR_##name;                                   \
227
                __asm__ __volatile__                                    \
228
                        ("sc           \n\t"                            \
229
                         "mfcr %1      "                                \
230
                        : "=&r" (__sc_3), "=&r" (__sc_0)                \
231
                        : "0"   (__sc_3), "1"   (__sc_0),                \
232
                          "r"   (__sc_4),                               \
233
                          "r"   (__sc_5),                               \
234
                          "r"   (__sc_6),                               \
235
                          "r"   (__sc_7),                               \
236
                          "r"   (__sc_8)                                \
237
                        : "r9", "r10", "r11", "r12" );                  \
238
                __sc_ret = __sc_3;                                      \
239
                __sc_err = __sc_0;                                      \
240
        }                                                               \
241
        __syscall_return (type);                                        \
242
}
243
 
244
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.