1 /* $FreeBSD: src/lib/libc/alpha/SYS.h,v 1.11.2.2 2002/10/15 19:46:45 fjoe Exp $ */
2 /* $DragonFly: src/lib/libc/alpha/Attic/SYS.h,v 1.2 2003/06/17 04:26:41 dillon Exp $ */
3 /* From: NetBSD: SYS.h,v 1.5 1997/05/02 18:15:15 kleink Exp */
6 * Copyright (c) 1994, 1995 Carnegie-Mellon University.
9 * Author: Chris G. Demetriou
11 * Permission to use, copy, modify and distribute this software and
12 * its documentation is hereby granted, provided that both the copyright
13 * notice and this permission notice appear in all copies of the
14 * software, derivative works or modified versions, and any portions
15 * thereof, and that both notices appear in supporting documentation.
17 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
18 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
19 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
21 * Carnegie Mellon requests users of this software to return to
23 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
24 * School of Computer Science
25 * Carnegie Mellon University
26 * Pittsburgh PA 15213-3890
28 * any improvements or extensions that they make and grant Carnegie the
29 * rights to redistribute these changes.
32 #include <machine/asm.h>
33 #ifdef __NETBSD_SYSCALLS
34 #include <sys/netbsd_syscall.h>
36 #include <sys/syscall.h>
39 #define CALLSYS_ERROR(name) \
40 CALLSYS_NOERROR(name); \
41 br gp, LLABEL(name,0); \
44 beq a3, LLABEL(name,1); \
49 #define SYSCALL(name) \
50 LEAF(__CONCAT(_,name),0); /* XXX # of args? */ \
51 WEAK_ALIAS(name, __CONCAT(_,name)); \
54 #define SYSCALL_NOERROR(name) \
55 LEAF(name,0); /* XXX # of args? */ \
59 #define RSYSCALL(name) \
64 #define RSYSCALL_NOERROR(name) \
65 SYSCALL_NOERROR(name); \
70 #define PSEUDO(label,name) \
71 LEAF(__CONCAT(_,label),0); /* XXX # of args? */ \
72 WEAK_ALIAS(label, __CONCAT(_,label)); \
73 CALLSYS_ERROR(name); \
75 END(__CONCAT(_,label));
77 #define PSEUDO_NOERROR(label,name) \
78 LEAF(label,0); /* XXX # of args? */ \
79 CALLSYS_NOERROR(name); \
86 * The macros PSYSCALL() and PRSYSCALL() are intended for use where a
87 * syscall needs to be renamed in the threaded library. When building
88 * a normal library, they default to the traditional SYSCALL() and
89 * RSYSCALL(). This avoids the need to #ifdef _THREAD_SAFE everywhere
90 * that the renamed function needs to be called.
94 * For the thread_safe versions, we prepend __sys_ to the function
95 * name so that the 'C' wrapper can go around the real name.
98 CALL(___CONCAT(__sys_,name))
100 #define PLEAF(name, args) \
101 LEAF(___CONCAT(__sys_,name),args)
104 END(___CONCAT(__sys_,name))
106 #define PSYSCALL(name) \
107 PLEAF(name,0); /* XXX # of args? */ \
110 #define PRSYSCALL(name) \
111 PLEAF(name,0); /* XXX # of args? */ \
112 CALLSYS_ERROR(name) \
116 #define PPSEUDO(label,name) \
117 PLEAF(label,0); /* XXX # of args? */ \
118 CALLSYS_ERROR(name); \
124 * The non-threaded library defaults to traditional syscalls where
125 * the function name matches the syscall name.
127 #define PSYSCALL(x) SYSCALL(x)
128 #define PRSYSCALL(x) RSYSCALL(x)
129 #define PPSEUDO(x,y) PSEUDO(x,y)
130 #define PLEAF(x,y) LEAF(x,y)
131 #define PEND(x) END(x)
132 #define PCALL(x) CALL(x)