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