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

Subversion Repositories or1k

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

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_getuid              24
12
#define __NR_getgid              47
13
#define __NR_geteuid             49
14
#define __NR_getegid             50
15
#define __NR_readlink            58
16
#define __NR_mmap                71
17
#define __NR_munmap              73
18
#define __NR_stat                38
19
#define __NR_mprotect            74
20
 
21
/* Here are the macros which define how this platform makes
22
 * system calls.  This particular variant does _not_ set
23
 * errno (note how it is disabled in __syscall_return) since
24
 * these will get called before the errno symbol is dynamicly
25
 * linked. */
26
 
27
#define _syscall0(type,name) \
28
type name(void) \
29
{ \
30
long __res; \
31
register long __g1 __asm__ ("g1") = __NR_##name; \
32
__asm__ __volatile__ ("t 0x10\n\t" \
33
                      "bcc 1f\n\t" \
34
                      "mov %%o0, %0\n\t" \
35
                      "sub %%g0, %%o0, %0\n\t" \
36
                      "1:\n\t" \
37
                      : "=r" (__res)\
38
                      : "r" (__g1) \
39
                      : "o0", "cc"); \
40
if (__res < -255 || __res >= 0) \
41
    return (type) __res; \
42
/*errno = -__res; */\
43
return -1; \
44
}
45
 
46
#define _syscall1(type,name,type1,arg1) \
47
type name(type1 arg1) \
48
{ \
49
long __res; \
50
register long __g1 __asm__ ("g1") = __NR_##name; \
51
register long __o0 __asm__ ("o0") = (long)(arg1); \
52
__asm__ __volatile__ ("t 0x10\n\t" \
53
                      "bcc 1f\n\t" \
54
                      "mov %%o0, %0\n\t" \
55
                      "sub %%g0, %%o0, %0\n\t" \
56
                      "1:\n\t" \
57
                      : "=r" (__res), "=&r" (__o0) \
58
                      : "1" (__o0), "r" (__g1) \
59
                      : "cc"); \
60
if (__res < -255 || __res >= 0) \
61
        return (type) __res; \
62
/*errno = -__res;*/ \
63
return -1; \
64
}
65
 
66
#define _syscall2(type,name,type1,arg1,type2,arg2) \
67
type name(type1 arg1,type2 arg2) \
68
{ \
69
long __res; \
70
register long __g1 __asm__ ("g1") = __NR_##name; \
71
register long __o0 __asm__ ("o0") = (long)(arg1); \
72
register long __o1 __asm__ ("o1") = (long)(arg2); \
73
__asm__ __volatile__ ("t 0x10\n\t" \
74
                      "bcc 1f\n\t" \
75
                      "mov %%o0, %0\n\t" \
76
                      "sub %%g0, %%o0, %0\n\t" \
77
                      "1:\n\t" \
78
                      : "=r" (__res), "=&r" (__o0) \
79
                      : "1" (__o0), "r" (__o1), "r" (__g1) \
80
                      : "cc"); \
81
if (__res < -255 || __res >= 0) \
82
        return (type) __res; \
83
/*errno = -__res;*/ \
84
return -1; \
85
}
86
 
87
#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
88
type name(type1 arg1,type2 arg2,type3 arg3) \
89
{ \
90
long __res; \
91
register long __g1 __asm__ ("g1") = __NR_##name; \
92
register long __o0 __asm__ ("o0") = (long)(arg1); \
93
register long __o1 __asm__ ("o1") = (long)(arg2); \
94
register long __o2 __asm__ ("o2") = (long)(arg3); \
95
__asm__ __volatile__ ("t 0x10\n\t" \
96
                      "bcc 1f\n\t" \
97
                      "mov %%o0, %0\n\t" \
98
                      "sub %%g0, %%o0, %0\n\t" \
99
                      "1:\n\t" \
100
                      : "=r" (__res), "=&r" (__o0) \
101
                      : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__g1) \
102
                      : "cc"); \
103
if (__res < -255 || __res>=0) \
104
        return (type) __res; \
105
/*errno = -__res;*/ \
106
return -1; \
107
}
108
 
109
#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
110
type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
111
{ \
112
long __res; \
113
register long __g1 __asm__ ("g1") = __NR_##name; \
114
register long __o0 __asm__ ("o0") = (long)(arg1); \
115
register long __o1 __asm__ ("o1") = (long)(arg2); \
116
register long __o2 __asm__ ("o2") = (long)(arg3); \
117
register long __o3 __asm__ ("o3") = (long)(arg4); \
118
__asm__ __volatile__ ("t 0x10\n\t" \
119
                      "bcc 1f\n\t" \
120
                      "mov %%o0, %0\n\t" \
121
                      "sub %%g0, %%o0, %0\n\t" \
122
                      "1:\n\t" \
123
                      : "=r" (__res), "=&r" (__o0) \
124
                      : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__g1) \
125
                      : "cc"); \
126
if (__res < -255 || __res>=0) \
127
        return (type) __res; \
128
/*errno = -__res;*/ \
129
return -1; \
130
}
131
 
132
#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
133
          type5,arg5) \
134
type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
135
{ \
136
long __res; \
137
register long __g1 __asm__ ("g1") = __NR_##name; \
138
register long __o0 __asm__ ("o0") = (long)(arg1); \
139
register long __o1 __asm__ ("o1") = (long)(arg2); \
140
register long __o2 __asm__ ("o2") = (long)(arg3); \
141
register long __o3 __asm__ ("o3") = (long)(arg4); \
142
register long __o4 __asm__ ("o4") = (long)(arg5); \
143
__asm__ __volatile__ ("t 0x10\n\t" \
144
                      "bcc 1f\n\t" \
145
                      "mov %%o0, %0\n\t" \
146
                      "sub %%g0, %%o0, %0\n\t" \
147
                      "1:\n\t" \
148
                      : "=r" (__res), "=&r" (__o0) \
149
                      : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__o4), "r" (__g1) \
150
                      : "cc"); \
151
if (__res < -255 || __res>=0) \
152
        return (type) __res; \
153
/*errno = -__res; */\
154
return -1; \
155
}

powered by: WebSVN 2.1.0

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