SYS.h revision 1.1 1 /* $NetBSD: SYS.h,v 1.1 2014/09/03 19:34:25 matt Exp $ */
2
3 #include <machine/asm.h>
4 #include <sys/syscall.h>
5
6 #define _DOSYSCALL(x) l.addi r13,r0,(SYS_ ## x) ;\
7 l.sys 0 ;\
8 l.nop
9
10 #define _SYSCALL_NOERROR(x,y) .text ;\
11 .p2align 2 ;\
12 ENTRY(x) ;\
13 _DOSYSCALL(y)
14
15 #define _SYSCALL(x,y) .text ;\
16 .align 2 ;\
17 2: l.j _C_LABEL(__cerror) ;\
18 l.nop ;\
19 _SYSCALL_NOERROR(x,y) ;\
20 l.bf 2b ;\
21 l.nop
22
23 #define SYSCALL_NOERROR(x) _SYSCALL_NOERROR(x,x)
24
25 #define SYSCALL(x) _SYSCALL(x,x)
26
27 #define PSEUDO_NOERROR(x,y) _SYSCALL_NOERROR(x,y) ;\
28 l.jr lr ;\
29 l.nop ;\
30 END(x)
31
32 #define PSEUDO(x,y) _SYSCALL_NOERROR(x,y) ;\
33 l.bf _C_LABEL(__cerror) ;\
34 l.nop ;\
35 l.jr lr ;\
36 l.nop ;\
37 END(x)
38
39 #define RSYSCALL_NOERROR(x) PSEUDO_NOERROR(x,x)
40
41 #define RSYSCALL(x) PSEUDO(x,x)
42
43 #define WSYSCALL(weak,strong) WEAK_ALIAS(weak,strong) ;\
44 PSEUDO(strong,weak)
45