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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [newlib-1.17.0/] [libgloss/] [arm/] [linux-syscalls0.S] - Blame information for rev 868

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

Line No. Rev Author Line
1 148 jeremybenn
/** Linux system call interface for the ARM processor.
2
 * Written by Shaun Jackman .
3
 * Copyright 2006 Pathway Connectivity
4
 *
5
 * Permission to use, copy, modify, and distribute this software
6
 * is freely granted, provided that this notice is preserved.
7
 */
8
 
9
#include "linux-syscall.h"
10
 
11
#if __thumb__
12
# define FUNC(name) .type name, %function; .thumb_func; name:
13
# define SET .thumb_set
14
#else
15
# define FUNC(name) .type name, %function; name:
16
# define SET .set
17
#endif
18
 
19
#define GLOBAL(name) .global name; FUNC(name)
20
#define SIZE(name) .size name, .-name
21
 
22
#if __thumb__
23
 
24
# define SYSCALL0(name) \
25
        GLOBAL(_ ## name); \
26
        mov r12, r7; \
27
        mov r7, #SYS_ ## name; \
28
        swi; \
29
        mov r7, r12; \
30
        b _set_errno; \
31
        SIZE(_ ## name)
32
 
33
/* static int _syscall3(int a, int b, int c, int number); */
34
FUNC(_syscall3)
35
        push { r7 }
36
        mov r7, r3
37
        swi
38
        pop { r7 }
39
        b _set_errno
40
        SIZE(_syscall3)
41
 
42
# define SYSCALL3(name) \
43
        GLOBAL(_ ## name); \
44
        mov r3, #SYS_ ## name; \
45
        b _syscall3; \
46
        SIZE(_ ## name)
47
 
48
# define SYSCALL6(name) \
49
        GLOBAL(_ ## name); \
50
        push { r4 - r5, r7 }; \
51
        ldr r4, [sp, #12]; \
52
        ldr r5, [sp, #16]; \
53
        mov r7, #SYS_ ## name; \
54
        swi; \
55
        pop { r4 - r5, r7 }; \
56
        b _set_errno; \
57
        SIZE(_ ## name)
58
 
59
# define SYSCALL4(name) SYSCALL6(name)
60
 
61
#else /* __thumb__ */
62
 
63
# define SYSCALL4(name) \
64
        GLOBAL(_ ## name); \
65
        swi #SYS_ ## name; \
66
        b _set_errno; \
67
        SIZE(_ ## name)
68
 
69
# define SYSCALL6(name) \
70
        GLOBAL(_ ## name); \
71
        push { r4 - r5 }; \
72
        ldr r4, [sp, #8]; \
73
        ldr r5, [sp, #12]; \
74
        swi #SYS_ ## name; \
75
        pop { r4 - r5 }; \
76
        b _set_errno; \
77
        SIZE(_ ## name)
78
 
79
#define SYSCALL0(name) SYSCALL3(name)
80
#define SYSCALL3(name) SYSCALL4(name)
81
 
82
#endif /* __thumb__ */
83
 
84
#define SYSCALL1(name) SYSCALL3(name)
85
#define SYSCALL2(name) SYSCALL3(name)
86
#define SYSCALL5(name) SYSCALL6(name)
87
 
88
SYSCALL1(alarm)
89
SYSCALL1(brk)
90
SYSCALL1(chdir)
91
SYSCALL2(chmod)
92
SYSCALL3(chown)
93
SYSCALL1(close)
94
SYSCALL1(dup)
95
SYSCALL2(dup2)
96
SYSCALL3(execve)
97
SYSCALL1(exit)
98
SYSCALL3(fcntl)
99
SYSCALL2(fstat)
100
SYSCALL2(ftruncate)
101
SYSCALL3(getdents)
102
SYSCALL0(getegid)
103
SYSCALL0(geteuid)
104
SYSCALL0(getgid)
105
SYSCALL2(getgroups)
106
SYSCALL1(getpgid)
107
SYSCALL0(getpgrp)
108
SYSCALL0(getpid)
109
SYSCALL0(getuid)
110
SYSCALL2(gettimeofday)
111
SYSCALL3(ioctl)
112
SYSCALL2(kill)
113
SYSCALL3(lchown)
114
SYSCALL2(link)
115
SYSCALL3(lseek)
116
SYSCALL2(lstat)
117
SYSCALL2(mkdir)
118
SYSCALL3(mknod)
119
SYSCALL2(nanosleep)
120
SYSCALL3(open)
121
SYSCALL0(pause)
122
SYSCALL1(pipe)
123
SYSCALL3(read)
124
SYSCALL3(readlink)
125
SYSCALL4(reboot)
126
SYSCALL1(rmdir)
127
SYSCALL5(select)
128
SYSCALL2(setpgid)
129
SYSCALL1(setgid)
130
SYSCALL0(setsid)
131
SYSCALL1(setuid)
132
SYSCALL3(sigprocmask)
133
SYSCALL2(socketcall)
134
SYSCALL2(stat)
135
SYSCALL1(stime)
136
SYSCALL2(symlink)
137
SYSCALL1(sync)
138
SYSCALL1(sysinfo)
139
SYSCALL1(times)
140
SYSCALL2(truncate)
141
SYSCALL1(umask)
142
SYSCALL1(uname)
143
SYSCALL1(unlink)
144
SYSCALL2(utime)
145
SYSCALL0(vfork)
146
SYSCALL4(wait4)
147
SYSCALL3(write)
148
 
149
#define ALIAS(name) .GLOBAL name; SET name, _ ## name
150
 
151
ALIAS(alarm)
152
ALIAS(chdir)
153
ALIAS(chmod)
154
ALIAS(chown)
155
ALIAS(dup)
156
ALIAS(dup2)
157
ALIAS(ftruncate)
158
ALIAS(getdents)
159
ALIAS(getegid)
160
ALIAS(geteuid)
161
ALIAS(getgid)
162
ALIAS(getgroups)
163
ALIAS(getpgid)
164
ALIAS(getpgrp)
165
ALIAS(getuid)
166
ALIAS(ioctl)
167
ALIAS(lchown)
168
ALIAS(lstat)
169
ALIAS(mkdir)
170
ALIAS(mknod)
171
ALIAS(nanosleep)
172
ALIAS(pause)
173
ALIAS(pipe)
174
ALIAS(readlink)
175
ALIAS(rmdir)
176
ALIAS(select)
177
ALIAS(setgid)
178
ALIAS(setpgid)
179
ALIAS(setsid)
180
ALIAS(setuid)
181
ALIAS(sigprocmask)
182
ALIAS(stime)
183
ALIAS(symlink)
184
ALIAS(sync)
185
ALIAS(sysinfo)
186
ALIAS(truncate)
187
ALIAS(umask)
188
ALIAS(uname)
189
ALIAS(utime)
190
ALIAS(vfork)
191
ALIAS(wait4)
192
 
193
# define SOCKETCALL(name, NAME) \
194
        GLOBAL(name); \
195
        push { r0 - r3 }; \
196
        mov r0, #SYS_ ## NAME; \
197
        b _socketcall_tail; \
198
        SIZE(name)
199
 
200
FUNC(_socketcall_tail)
201
        mov r1, sp
202
        push { lr }
203
        bl _socketcall
204
        pop { r3 }
205
        add sp, #16
206
#if defined(__ARM_ARCH_2__) || defined(__ARM_ARCH_3__) \
207
    || defined(__ARM_ARCH_3M__) || defined(__ARM_ARCH_4__)
208
        mov pc, r3
209
#else
210
        bx r3
211
#endif
212
        SIZE(_socketcall_tail)
213
 
214
#define SOCKETCALL2(name, NAME) SOCKETCALL(name, NAME)
215
#define SOCKETCALL3(name, NAME) SOCKETCALL(name, NAME)
216
#define SOCKETCALL4(name, NAME) SOCKETCALL(name, NAME)
217
#define SOCKETCALL5(name, NAME) SOCKETCALL(name, NAME)
218
#define SOCKETCALL6(name, NAME) SOCKETCALL(name, NAME)
219
 
220
SOCKETCALL3(accept, ACCEPT)
221
SOCKETCALL3(bind, BIND)
222
SOCKETCALL3(connect, CONNECT)
223
SOCKETCALL3(getpeername, GETPEERNAME)
224
SOCKETCALL3(getsockname, GETSOCKNAME)
225
SOCKETCALL5(getsockopt, GETSOCKOPT)
226
SOCKETCALL2(listen, LISTEN)
227
SOCKETCALL4(recv, RECV)
228
SOCKETCALL6(recvfrom, RECVFROM)
229
SOCKETCALL3(recvmsg, RECVMSG)
230
SOCKETCALL4(send, SEND)
231
SOCKETCALL3(sendmsg, SENDMSG)
232
SOCKETCALL6(sendto, SENDTO)
233
SOCKETCALL5(setsockopt, SETSOCKOPT)
234
SOCKETCALL2(shutdown, SHUTDOWN)
235
SOCKETCALL3(socket, SOCKET)
236
SOCKETCALL4(socketpair, SOCKETPAIR)

powered by: WebSVN 2.1.0

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