1 /* $NetBSD: SYS.h,v 1.13 2014/08/23 02:24:22 matt Exp $ */ 2 3 #include <machine/asm.h> 4 #include <sys/syscall.h> 5 6 #define BRANCH_TO_CERROR() b _C_LABEL(__cerror) 7 8 #define _DOSYSCALL(x) li %r0,(SYS_ ## x) ;\ 9 sc 10 11 #define _SYSCALL_NOERROR(x,y) .text ;\ 12 .p2align 2 ;\ 13 ENTRY(x) ;\ 14 _DOSYSCALL(y) 15 16 #define _SYSCALL(x,y) .text ;\ 17 .p2align 2 ;\ 18 2: BRANCH_TO_CERROR() ;\ 19 _SYSCALL_NOERROR(x,y) ;\ 20 bso 2b 21 22 #define SYSCALL_NOERROR(x) _SYSCALL_NOERROR(x,x) 23 24 #define SYSCALL(x) _SYSCALL(x,x) 25 26 #define PSEUDO_NOERROR(x,y) _SYSCALL_NOERROR(x,y) ;\ 27 blr ;\ 28 END(x) 29 30 #define PSEUDO(x,y) _SYSCALL_NOERROR(x,y) ;\ 31 bnslr ;\ 32 BRANCH_TO_CERROR() ;\ 33 END(x) 34 35 #define RSYSCALL_NOERROR(x) PSEUDO_NOERROR(x,x) 36 37 #define RSYSCALL(x) PSEUDO(x,x) 38 39 #define WSYSCALL(weak,strong) WEAK_ALIAS(weak,strong) ;\ 40 PSEUDO(strong,weak) 41