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