SYS.h revision 1.12 1 1.12 matt /* $NetBSD: SYS.h,v 1.12 2011/01/15 07:31:12 matt Exp $ */
2 1.1 thorpej
3 1.1 thorpej #include <machine/asm.h>
4 1.1 thorpej #include <sys/syscall.h>
5 1.1 thorpej
6 1.10 wiz #ifdef __STDC__
7 1.11 matt #define _DOSYSCALL(x) li %r0,(SYS_ ## x) ;\
8 1.4 thorpej sc
9 1.10 wiz #else
10 1.11 matt #define _DOSYSCALL(x) li %r0,(SYS_/**/x) ;\
11 1.10 wiz sc
12 1.10 wiz #endif /* __STDC__ */
13 1.1 thorpej
14 1.4 thorpej #define _SYSCALL_NOERROR(x,y) .text ;\
15 1.1 thorpej .align 2 ;\
16 1.1 thorpej ENTRY(x) ;\
17 1.4 thorpej _DOSYSCALL(y)
18 1.1 thorpej
19 1.2 kleink #define _SYSCALL(x,y) .text ;\
20 1.1 thorpej .align 2 ;\
21 1.12 matt 2: b _C_LABEL(__cerror) ;\
22 1.2 kleink _SYSCALL_NOERROR(x,y) ;\
23 1.1 thorpej bso 2b
24 1.1 thorpej
25 1.2 kleink #define SYSCALL_NOERROR(x) _SYSCALL_NOERROR(x,x)
26 1.2 kleink
27 1.2 kleink #define SYSCALL(x) _SYSCALL(x,x)
28 1.2 kleink
29 1.2 kleink #define PSEUDO_NOERROR(x,y) _SYSCALL_NOERROR(x,y) ;\
30 1.12 matt blr ;\
31 1.12 matt END(x)
32 1.2 kleink
33 1.2 kleink #define PSEUDO(x,y) _SYSCALL_NOERROR(x,y) ;\
34 1.3 kleink bnslr ;\
35 1.12 matt b _C_LABEL(__cerror) ;\
36 1.12 matt END(x)
37 1.2 kleink
38 1.2 kleink #define RSYSCALL_NOERROR(x) PSEUDO_NOERROR(x,x)
39 1.2 kleink
40 1.2 kleink #define RSYSCALL(x) PSEUDO(x,x)
41 1.8 thorpej
42 1.8 thorpej #define WSYSCALL(weak,strong) WEAK_ALIAS(weak,strong) ;\
43 1.8 thorpej PSEUDO(strong,weak)
44