1 #include "sys/syscall.h"
3 #define SYSCALL(name) \
6 ldi r4, SYS ## name ; \
10 .stabs "trap.S",100,0,0,__trap0
11 .stabs "int:t(0,1)=r(0,1);-65536;65535;",128,0,0,0
12 .stabs "long int:t(0,2)=r(0,1);0020000000000;0017777777777;",128,0,0,0
13 .stabs "_trap0:F(0,1)",36,0,1,__trap0
14 .stabs "arg1:P(0,1)",64,0,1,0
15 .stabs "arg2:P(0,1)",64,0,1,1
16 .stabs "arg3:P(0,1)",64,0,1,2
17 .stabs "arg4:P(0,1)",64,0,1,3
18 .stabs "number:P(0,1)",64,0,1,4
20 .type __trap0,@function
22 trap 15 /* trap 15 returns result in r0, error code in r4 */
23 cmpeqi r4,0 /* is error code zero? */
24 brf0t ret /* yes, skip setting errno */
26 st r4,@(errno+2,r14) /* no, set errno */
27 srai r4,15 /* sign extend high word */
30 st r4,@(errno,r14) /* no, set errno */
34 jmp r13 /* return to caller */
36 .size __trap0,.Ltrap0-__trap0
37 .stabs "",36,0,0,.Ltrap0-__trap0
39 #define CONCAT(a,b) a ## b
41 #define XSTRING(a) STRING(a)
42 #define XSTRING2(a,b) XSTRING(CONCAT(a,b))
46 #define _lseek _lseek16
47 #define _write _write16
48 #define _close _close16
50 #define _creat _creat16
53 #define _chmod _chmod16
54 #define _chown _chown16
57 #define _execve _execve16
58 #define _execv _execv16
61 #define _getpid _getpid16
64 /* Until the assembler allows semicolon as a statement separator, */
65 /* we cannot use the SYSCALL macro. So expand it manually for now. */
68 /* #SYSCALL(_lseek) */
69 /* #SYSCALL(_write) */
70 /* #SYSCALL(_close) */
72 /* #SYSCALL(_creat) */
75 /* #SYSCALL(_chmod) */
76 /* #SYSCALL(_chown) */
79 /* #SYSCALL(_execve) */
80 /* #SYSCALL(_execv) */
82 /* #SYSCALL(_getpid) */
87 .stabs XSTRING2(_read,:F(0,1)),36,0,2,_read
88 .stabs "fd:P(0,1)",64,0,1,0
89 .stabs "ptr:P(0,1)",64,0,1,1
90 .stabs "len:P(0,1)",64,0,1,2
96 .stabs "",36,0,0,.Lread-_read
99 .type _lseek,@function
100 .stabs XSTRING2(_lseek,:F(0,1)),36,0,3,_lseek
101 .stabs "fd:P(0,1)",64,0,1,0
102 .stabs "offset:P(0,1)",64,0,1,2
103 .stabs "whence:p(0,1)",160,0,1,0
108 .size _lseek,.Llseek-_lseek
109 .stabs "",36,0,0,.Llseek-_lseek
112 .type _write,@function
113 .stabs XSTRING2(_write,:F(0,1)),36,0,4,_write
114 .stabs "fd:P(0,1)",64,0,1,0
115 .stabs "ptr:P(0,1)",64,0,1,1
116 .stabs "len:P(0,1)",64,0,1,2
121 .size _write,.Lwrite-_write
122 .stabs "",36,0,0,.Lwrite-_write
125 .type _close,@function
126 .stabs XSTRING2(_close,:F(0,1)),36,0,5,_close
127 .stabs "fd:P(0,1)",64,0,1,0
132 .size _close,.Lclose-_close
133 .stabs "",36,0,0,.Lclose-_close
136 .type _open,@function
137 .stabs XSTRING2(_open,:F(0,1)),36,0,6,_open
138 .stabs "name:P(0,1)",64,0,1,0
139 .stabs "flags:P(0,1)",64,0,1,1
140 .stabs "mode:P(0,1)",64,0,1,2
145 .size _open,.Lopen-_open
146 .stabs "",36,0,0,.Lopen-_open
149 .type _creat,@function
150 .stabs XSTRING2(_creat,:F(0,1)),36,0,7,_creat
151 .stabs "name:P(0,1)",64,0,1,0
152 .stabs "mode:P(0,1)",64,0,1,1
157 .size _creat,.Lcreat-_creat
158 .stabs "",36,0,0,.Lcreat-_creat
161 .type _exit,@function
162 .stabs XSTRING2(_exit,:F(0,1)),36,0,8,_exit
163 .stabs "status:P(0,1)",64,0,1,0
168 .size _exit,.Lexit-_exit
169 .stabs "",36,0,0,.Lexit-_exit
172 .type _stat,@function
173 .stabs XSTRING2(_stat,:F(0,1)),36,0,9,_stat
174 .stabs "name:P(0,1)",64,0,1,0
175 .stabs "packet:P(0,1)",64,0,1,1
180 .size _stat,.Lstat-_stat
181 .stabs "",36,0,0,.Lstat-_stat
184 .type _chmod,@function
185 .stabs XSTRING2(_chmod,:F(0,1)),36,0,10,_chmod
186 .stabs "name:P(0,1)",64,0,1,0
187 .stabs "mode:P(0,1)",64,0,1,1
192 .size _chmod,.Lchmod-_chmod
193 .stabs "",36,0,0,.Lchmod-_chmod
196 .type _chown,@function
197 .stabs XSTRING2(_chown,:F(0,1)),36,0,11,_chown
198 .stabs "name:P(0,1)",64,0,1,0
199 .stabs "uid:P(0,1)",64,0,1,1
200 .stabs "gid:P(0,1)",64,0,1,2
205 .size _chown,.Lchown-_chown
206 .stabs "",36,0,0,.Lchown-_chown
209 .type _fork,@function
210 .stabs XSTRING2(_fork,:F(0,1)),36,0,12,_fork
215 .size _fork,.Lfork-_fork
216 .stabs "",36,0,0,.Lfork-_fork
219 .type _wait,@function
220 .stabs "status:P(0,1)",64,0,1,0
221 .stabs XSTRING2(_wait,:F(0,1)),36,0,13,_wait
226 .size _wait,.Lwait-_wait
227 .stabs "",36,0,0,.Lwait-_wait
230 .type _execve,@function
231 .stabs "name:P(0,1)",64,0,1,0
232 .stabs "argv:P(0,1)",64,0,1,1
233 .stabs "envp:P(0,1)",64,0,1,2
234 .stabs XSTRING2(_execve,:F(0,1)),36,0,14,_execve
239 .size _execve,.Lexecve-_execve
240 .stabs "",36,0,0,.Lexecve-_execve
243 .type _execv,@function
244 .stabs XSTRING2(_execv,:F(0,1)),36,0,15,_execv
245 .stabs "name:P(0,1)",64,0,1,0
246 .stabs "argv:P(0,1)",64,0,1,1
251 .size _execv,.Lexecv-_execv
252 .stabs "",36,0,0,.Lexecv-_execv
255 .type _pipe,@function
256 .stabs XSTRING2(_pipe,:F(0,1)),36,0,16,_pipe
257 .stabs "fds:P(0,1)",64,0,1,0
262 .size _pipe,.Lpipe-_pipe
263 .stabs "",36,0,0,.Lpipe-_pipe
267 .stabs XSTRING2(time,:F(0,1)),36,0,17,time
268 .stabs "ptr:P(0,1)",64,0,1,0
273 .size time,.Ltime-time
274 .stabs "",36,0,0,.Ltime-time
277 .type _kill,@function
278 .stabs XSTRING2(_kill,:F(0,1)),36,0,18,_kill
279 .stabs "pid:P(0,1)",64,0,1,0
280 .stabs "sig:P(0,1)",64,0,1,1
285 .size _kill,.Lkill-_kill
286 .stabs "",36,0,0,.Lkill-_kill
289 .type _getpid,@function
290 .stabs XSTRING2(_getpid,:F(0,1)),36,0,19,_getpid
295 .size _getpid,.Lgetpid-_getpid
296 .stabs "",36,0,0,.Lgetpid-_getpid