1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
|
/*
* include/asm-xtensa/unistd.h
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 2001 - 2005 Tensilica Inc.
*/
#ifndef _XTENSA_UNISTD_H
#define _XTENSA_UNISTD_H
#ifndef __SYSCALL
# define __SYSCALL(nr,func,nargs)
#endif
#define __NR_spill 0
__SYSCALL( 0, sys_ni_syscall, 0)
#define __NR_xtensa 1
__SYSCALL( 1, sys_ni_syscall, 0)
#define __NR_available4 2
__SYSCALL( 2, sys_ni_syscall, 0)
#define __NR_available5 3
__SYSCALL( 3, sys_ni_syscall, 0)
#define __NR_available6 4
__SYSCALL( 4, sys_ni_syscall, 0)
#define __NR_available7 5
__SYSCALL( 5, sys_ni_syscall, 0)
#define __NR_available8 6
__SYSCALL( 6, sys_ni_syscall, 0)
#define __NR_available9 7
__SYSCALL( 7, sys_ni_syscall, 0)
/* File Operations */
#define __NR_open 8
__SYSCALL( 8, sys_open, 3)
#define __NR_close 9
__SYSCALL( 9, sys_close, 1)
#define __NR_dup 10
__SYSCALL( 10, sys_dup, 1)
#define __NR_dup2 11
__SYSCALL( 11, sys_dup2, 2)
#define __NR_read 12
__SYSCALL( 12, sys_read, 3)
#define __NR_write 13
__SYSCALL( 13, sys_write, 3)
#define __NR_select 14
__SYSCALL( 14, sys_select, 5)
#define __NR_lseek 15
__SYSCALL( 15, sys_lseek, 3)
#define __NR_poll 16
__SYSCALL( 16, sys_poll, 3)
#define __NR__llseek 17
__SYSCALL( 17, sys_llseek, 5)
#define __NR_epoll_wait 18
__SYSCALL( 18, sys_epoll_wait, 4)
#define __NR_epoll_ctl 19
__SYSCALL( 19, sys_epoll_ctl, 4)
#define __NR_epoll_create 20
__SYSCALL( 20, sys_epoll_create, 1)
#define __NR_creat 21
__SYSCALL( 21, sys_creat, 2)
#define __NR_truncate 22
__SYSCALL( 22, sys_truncate, 2)
#define __NR_ftruncate 23
__SYSCALL( 23, sys_ftruncate, 2)
#define __NR_readv 24
__SYSCALL( 24, sys_readv, 3)
#define __NR_writev 25
__SYSCALL( 25, sys_writev, 3)
#define __NR_fsync 26
__SYSCALL( 26, sys_fsync, 1)
#define __NR_fdatasync 27
__SYSCALL( 27, sys_fdatasync, 1)
#define __NR_truncate64 28
__SYSCALL( 28, sys_truncate64, 2)
#define __NR_ftruncate64 29
__SYSCALL( 29, sys_ftruncate64, 2)
#define __NR_pread64 30
__SYSCALL( 30, sys_pread64, 6)
#define __NR_pwrite64 31
__SYSCALL( 31, sys_pwrite64, 6)
#define __NR_link 32
__SYSCALL( 32, sys_link, 2)
#define __NR_rename 33
__SYSCALL( 33, sys_rename, 2)
#define __NR_symlink 34
__SYSCALL( 34, sys_symlink, 2)
#define __NR_readlink 35
__SYSCALL( 35, sys_readlink, 3)
#define __NR_mknod 36
__SYSCALL( 36, sys_mknod, 3)
#define __NR_pipe 37
__SYSCALL( 37, xtensa_pipe, 1)
#define __NR_unlink 38
__SYSCALL( 38, sys_unlink, 1)
#define __NR_rmdir 39
__SYSCALL( 39, sys_rmdir, 1)
#define __NR_mkdir 40
__SYSCALL( 40, sys_mkdir, 2)
#define __NR_chdir 41
__SYSCALL( 41, sys_chdir, 1)
#define __NR_fchdir 42
__SYSCALL( 42, sys_fchdir, 1)
#define __NR_getcwd 43
__SYSCALL( 43, sys_getcwd, 2)
#define __NR_chmod 44
__SYSCALL( 44, sys_chmod, 2)
#define __NR_chown 45
__SYSCALL( 45, sys_chown, 3)
#define __NR_stat 46
__SYSCALL( 46, sys_newstat, 2)
#define __NR_stat64 47
__SYSCALL( 47, sys_stat64, 2)
#define __NR_lchown 48
__SYSCALL( 48, sys_lchown, 3)
#define __NR_lstat 49
__SYSCALL( 49, sys_newlstat, 2)
#define __NR_lstat64 50
__SYSCALL( 50, sys_lstat64, 2)
#define __NR_available51 51
__SYSCALL( 51, sys_ni_syscall, 0)
#define __NR_fchmod 52
__SYSCALL( 52, sys_fchmod, 2)
#define __NR_fchown 53
__SYSCALL( 53, sys_fchown, 3)
#define __NR_fstat 54
__SYSCALL( 54, sys_newfstat, 2)
#define __NR_fstat64 55
__SYSCALL( 55, sys_fstat64, 2)
#define __NR_flock 56
__SYSCALL( 56, sys_flock, 2)
#define __NR_access 57
__SYSCALL( 57, sys_access, 2)
#define __NR_umask 58
__SYSCALL( 58, sys_umask, 1)
#define __NR_getdents 59
__SYSCALL( 59, sys_getdents, 3)
#define __NR_getdents64 60
__SYSCALL( 60, sys_getdents64, 3)
#define __NR_fcntl64 61
__SYSCALL( 61, sys_fcntl64, 3)
#define __NR_available62 62
__SYSCALL( 62, sys_ni_syscall, 0)
#define __NR_fadvise64_64 63
__SYSCALL( 63, sys_fadvise64_64, 6)
#define __NR_utime 64 /* glibc 2.3.3 ?? */
__SYSCALL( 64, sys_utime, 2)
#define __NR_utimes 65
__SYSCALL( 65, sys_utimes, 2)
#define __NR_ioctl 66
__SYSCALL( 66, sys_ioctl, 3)
#define __NR_fcntl 67
__SYSCALL( 67, sys_fcntl, 3)
#define __NR_setxattr 68
__SYSCALL( 68, sys_setxattr, 5)
#define __NR_getxattr 69
__SYSCALL( 69, sys_getxattr, 4)
#define __NR_listxattr 70
__SYSCALL( 70, sys_listxattr, 3)
#define __NR_removexattr 71
__SYSCALL( 71, sys_removexattr, 2)
#define __NR_lsetxattr 72
__SYSCALL( 72, sys_lsetxattr, 5)
#define __NR_lgetxattr 73
__SYSCALL( 73, sys_lgetxattr, 4)
#define __NR_llistxattr 74
__SYSCALL( 74, sys_llistxattr, 3)
#define __NR_lremovexattr 75
__SYSCALL( 75, sys_lremovexattr, 2)
#define __NR_fsetxattr 76
__SYSCALL( 76, sys_fsetxattr, 5)
#define __NR_fgetxattr 77
__SYSCALL( 77, sys_fgetxattr, 4)
#define __NR_flistxattr 78
__SYSCALL( 78, sys_flistxattr, 3)
#define __NR_fremovexattr 79
__SYSCALL( 79, sys_fremovexattr, 2)
/* File Map / Shared Memory Operations */
#define __NR_mmap2 80
__SYSCALL( 80, xtensa_mmap2, 6)
#define __NR_munmap 81
__SYSCALL( 81, sys_munmap, 2)
#define __NR_mprotect 82
__SYSCALL( 82, sys_mprotect, 3)
#define __NR_brk 83
__SYSCALL( 83, sys_brk, 1)
#define __NR_mlock 84
__SYSCALL( 84, sys_mlock, 2)
#define __NR_munlock 85
__SYSCALL( 85, sys_munlock, 2)
#define __NR_mlockall 86
__SYSCALL( 86, sys_mlockall, 1)
#define __NR_munlockall 87
__SYSCALL( 87, sys_munlockall, 0)
#define __NR_mremap 88
__SYSCALL( 88, sys_mremap, 4)
#define __NR_msync 89
__SYSCALL( 89, sys_msync, 3)
#define __NR_mincore 90
__SYSCALL( 90, sys_mincore, 3)
#define __NR_madvise 91
__SYSCALL( 91, sys_madvise, 3)
#define __NR_shmget 92
__SYSCALL( 92, sys_shmget, 4)
#define __NR_shmat 93
__SYSCALL( 93, xtensa_shmat, 4)
#define __NR_shmctl 94
__SYSCALL( 94, sys_shmctl, 4)
#define __NR_shmdt 95
__SYSCALL( 95, sys_shmdt, 4)
/* Socket Operations */
#define __NR_socket 96
__SYSCALL( 96, sys_socket, 3)
#define __NR_setsockopt 97
__SYSCALL( 97, sys_setsockopt, 5)
#define __NR_getsockopt 98
__SYSCALL( 98, sys_getsockopt, 5)
#define __NR_shutdown 99
__SYSCALL( 99, sys_shutdown, 2)
#define __NR_bind 100
__SYSCALL(100, sys_bind, 3)
#define __NR_connect 101
__SYSCALL(101, sys_connect, 3)
#define __NR_listen 102
__SYSCALL(102, sys_listen, 2)
#define __NR_accept 103
__SYSCALL(103,
|