xref: /netbsd/lib/libc/arch/powerpc/SYS.h (revision bf9ec67e)
1 /*	$NetBSD: SYS.h,v 1.10 2002/05/26 12:24:57 wiz Exp $	*/
2 
3 #include <machine/asm.h>
4 #include <sys/syscall.h>
5 
6 #ifdef __STDC__
7 #define	_DOSYSCALL(x)		li	0,(SYS_ ## x)		;\
8 				sc
9 #else
10 #define	_DOSYSCALL(x)		li	0,(SYS_/**/x)		;\
11 				sc
12 #endif /* __STDC__ */
13 
14 #define	_SYSCALL_NOERROR(x,y)	.text				;\
15 				.align	2			;\
16 			ENTRY(x)				;\
17 				_DOSYSCALL(y)
18 
19 #define _SYSCALL(x,y)		.text				;\
20 				.align	2			;\
21 			2:	b	PIC_PLT(_C_LABEL(__cerror));\
22 				_SYSCALL_NOERROR(x,y)		;\
23 				bso	2b
24 
25 #define SYSCALL_NOERROR(x)	_SYSCALL_NOERROR(x,x)
26 
27 #define SYSCALL(x)		_SYSCALL(x,x)
28 
29 #define PSEUDO_NOERROR(x,y)	_SYSCALL_NOERROR(x,y)		;\
30 				blr
31 
32 #define PSEUDO(x,y)		_SYSCALL_NOERROR(x,y)		;\
33 				bnslr				;\
34 				b	PIC_PLT(_C_LABEL(__cerror))
35 
36 #define RSYSCALL_NOERROR(x)	PSEUDO_NOERROR(x,x)
37 
38 #define RSYSCALL(x)		PSEUDO(x,x)
39 
40 #define	WSYSCALL(weak,strong)	WEAK_ALIAS(weak,strong)		;\
41 				PSEUDO(strong,weak)
42