SYS.h revision 1.13 1 1.13 matt /* $NetBSD: SYS.h,v 1.13 2014/08/23 02:24:22 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.13 matt #define BRANCH_TO_CERROR() b _C_LABEL(__cerror)
7 1.13 matt
8 1.11 matt #define _DOSYSCALL(x) li %r0,(SYS_ ## x) ;\
9 1.4 thorpej sc
10 1.1 thorpej
11 1.4 thorpej #define _SYSCALL_NOERROR(x,y) .text ;\
12 1.13 matt .p2align 2 ;\
13 1.1 thorpej ENTRY(x) ;\
14 1.4 thorpej _DOSYSCALL(y)
15 1.1 thorpej
16 1.2 kleink #define _SYSCALL(x,y) .text ;\
17 1.13 matt .p2align 2 ;\
18 1.13 matt 2: BRANCH_TO_CERROR() ;\
19 1.2 kleink _SYSCALL_NOERROR(x,y) ;\
20 1.1 thorpej bso 2b
21 1.1 thorpej
22 1.2 kleink #define SYSCALL_NOERROR(x) _SYSCALL_NOERROR(x,x)
23 1.2 kleink
24 1.2 kleink #define SYSCALL(x) _SYSCALL(x,x)
25 1.2 kleink
26 1.2 kleink #define PSEUDO_NOERROR(x,y) _SYSCALL_NOERROR(x,y) ;\
27 1.12 matt blr ;\
28 1.12 matt END(x)
29 1.2 kleink
30 1.2 kleink #define PSEUDO(x,y) _SYSCALL_NOERROR(x,y) ;\
31 1.3 kleink bnslr ;\
32 1.13 matt BRANCH_TO_CERROR() ;\
33 1.12 matt END(x)
34 1.2 kleink
35 1.2 kleink #define RSYSCALL_NOERROR(x) PSEUDO_NOERROR(x,x)
36 1.2 kleink
37 1.2 kleink #define RSYSCALL(x) PSEUDO(x,x)
38 1.8 thorpej
39 1.8 thorpej #define WSYSCALL(weak,strong) WEAK_ALIAS(weak,strong) ;\
40 1.8 thorpej PSEUDO(strong,weak)
41