1 /* $Id: SYS.h,v 1.4 1998/12/23 11:50:51 dfr 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(name,0); /* XXX # of args? */ \
52 #define SYSCALL_NOERROR(name) \
53 LEAF(name,0); /* XXX # of args? */ \
57 #define RSYSCALL(name) \
62 #define RSYSCALL_NOERROR(name) \
63 SYSCALL_NOERROR(name); \
68 #define PSEUDO(label,name) \
69 LEAF(label,0); /* XXX # of args? */ \
70 CALLSYS_ERROR(name); \
74 #define PSEUDO_NOERROR(label,name) \
75 LEAF(label,0); /* XXX # of args? */ \
76 CALLSYS_NOERROR(name); \
83 * The macros PSYSCALL() and PRSYSCALL() are intended for use where a
84 * syscall needs to be renamed in the threaded library. When building
85 * a normal library, they default to the traditional SYSCALL() and
86 * RSYSCALL(). This avoids the need to #ifdef _THREAD_SAFE everywhere
87 * that the renamed function needs to be called.
91 * For the thread_safe versions, we prepend _thread_sys_ to the function
92 * name so that the 'C' wrapper can go around the real name.
95 CALL(___CONCAT(_thread_sys_,name))
97 #define PLEAF(name, args) \
98 LEAF(___CONCAT(_thread_sys_,name),args)
101 END(___CONCAT(_thread_sys_,name))
103 #define PSYSCALL(name) \
104 PLEAF(name,0); /* XXX # of args? */ \
107 #define PRSYSCALL(name) \
108 PLEAF(name,0); /* XXX # of args? */ \
109 CALLSYS_ERROR(name) \
113 #define PPSEUDO(label,name) \
114 PLEAF(label,0); /* XXX # of args? */ \
115 CALLSYS_ERROR(name); \
121 * The non-threaded library defaults to traditional syscalls where
122 * the function name matches the syscall name.
124 #define PSYSCALL(x) SYSCALL(x)
125 #define PRSYSCALL(x) RSYSCALL(x)
126 #define PPSEUDO(x,y) PSEUDO(x,y)
127 #define PLEAF(x,y) LEAF(x,y)
128 #define PEND(x) END(x)
129 #define PCALL(x) CALL(x)