1 /* $NetBSD: SYS.h,v 1.18 2003/10/29 12:28:33 pooka Exp $ */
4 * Copyright (c) 1996 Jonathan Stone
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by Jonathan Stone for
19 * 4. The name of the author may not be used to endorse or promote products
20 * derived from this software without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 * Copyright (c) 1991, 1993
36 * The Regents of the University of California. All rights reserved.
38 * This code is derived from software contributed to Berkeley by
41 * Redistribution and use in source and binary forms, with or without
42 * modification, are permitted provided that the following conditions
44 * 1. Redistributions of source code must retain the above copyright
45 * notice, this list of conditions and the following disclaimer.
46 * 2. Redistributions in binary form must reproduce the above copyright
47 * notice, this list of conditions and the following disclaimer in the
48 * documentation and/or other materials provided with the distribution.
49 * 3. Neither the name of the University nor the names of its contributors
50 * may be used to endorse or promote products derived from this software
51 * without specific prior written permission.
53 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
54 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
55 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
56 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
57 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
58 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
59 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
60 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
61 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
62 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
65 * from: @(#)SYS.h 8.1 (Berkeley) 6/4/93
68 #include <sys/syscall.h>
73 * If compiling for shared libs, Emit sysV ABI PIC segment pseudo-ops.
75 * i) Emit .abicalls before .LEAF entrypoint, and .cpload/.cprestore after.
76 * ii) Do interprocedure jumps indirectly via t9, with the side-effect of
77 * preserving the callee's entry address in t9.
81 # if defined(__mips_o32) || defined(__mips_o64)
82 # define PIC_PROLOGUE(x) SETUP_GP
83 # define PIC_TAILCALL(l) PTR_LA t9, _C_LABEL(l); jr t9
84 # define PIC_RETURN() j ra
86 # define PIC_PROLOGUE(x) SETUP_GP64(t3, x)
87 # define PIC_TAILCALL(l) PTR_LA t9, _C_LABEL(l); RESTORE_GP64; jr t9
88 # define PIC_RETURN() RESTORE_GP64; j ra
91 # define PIC_PROLOGUE(x)
92 # define PIC_TAILCALL(l) j _C_LABEL(l)
94 #endif /* __ABICALLS__ */
98 # define SYSTRAP(x) li v0,SYS_ ## x; syscall;
100 # define SYSTRAP(x) li v0,SYS_/**/x; syscall;
105 * Do a syscall that cannot fail (sync, get{p,u,g,eu,eg)id)
107 #define RSYSCALL_NOERROR(x) \
111 * Do a normal syscall.
113 #define RSYSCALL(x) \
117 * Do a syscall that has an internal name and a weak external alias.
119 #define WSYSCALL(weak,strong) \
120 WEAK_ALIAS(weak,strong); \
124 * Do a renamed or pseudo syscall (e.g., _exit()), where the entrypoint
125 * and syscall name are not the same.
127 #define PSEUDO_NOERROR(x,y) \
133 #define PSEUDO(x,y) \
140 PIC_TAILCALL(__cerror); \