2 * Copyright (c) 1992, 1993
3 * The Regents of the University of California. All rights reserved.
5 * This software was developed by the Computer Systems Engineering group
6 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
7 * contributed to Berkeley.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * @(#)SYS.h 8.1 (Berkeley) 6/4/93
35 * from: Header: SYS.h,v 1.2 92/07/03 18:57:00 torek Exp
36 * $NetBSD: SYS.h,v 1.18 2011/03/28 11:19:12 martin Exp $
39 #include <machine/asm.h>
40 #include <sys/syscall.h>
41 #include <machine/trap.h>
44 #define _CAT(x,y) x##y
46 #define _CAT(x,y) x/**/y
50 #define CERROR _C_LABEL(__cerror)
51 #define CURBRK _C_LABEL(__curbrk)
53 #define CERROR _ASM_LABEL(cerror)
54 #define CURBRK _ASM_LABEL(curbrk)
58 * ERROR branches to cerror.
62 PIC_PROLOGUE(%g1, %g5); \
64 ld [%g1 + %g5], %g5; \
73 #define ERROR() CALL(CERROR)
76 * SYSCALL is used when further action must be taken before returning.
77 * Note that it adds a `nop' over what we could do, if we only knew
78 * what came at label 1....
80 #define _SYSCALL(x,y) \
82 mov _CAT(SYS_,y), %g1; \
93 * RSYSCALL is used when the system call should just return. Here we
94 * use the SYSCALL_G5RFLAG to put the `success' return address in %g5
97 * PSEUDO(x,y) is like RSYSCALL(y), except that the name is x.
99 #define _RSYSCALL(x,y) \
101 mov (_CAT(SYS_,y)) | SYSCALL_G5RFLAG, %g1; \
106 #define RSYSCALL(x) _RSYSCALL(x,x)
107 #define PSEUDO(x,y) _RSYSCALL(x,y)
110 * WSYSCALL(weak,strong) is like RSYSCALL(weak),
111 * except that weak is a weak internal alias for the strong symbol.
114 #define WSYSCALL(weak,strong) \
115 WEAK_ALIAS(weak,strong); \
118 #define WSYSCALL(weak,strong) \
123 * SYSCALL_NOERROR is like SYSCALL, except it's used for syscalls that
126 * XXX - This should be optimized.
128 #define SYSCALL_NOERROR(x) \
130 mov _CAT(SYS_,x), %g1; \
134 * RSYSCALL_NOERROR is like RSYSCALL, except it's used for syscalls
137 * PSEUDO_NOERROR(x,y) is like RSYSCALL_NOERROR(y), except that the
140 * XXX - This should be optimized.
142 #define _RSYSCALL_NOERROR(x,y) \
144 mov (_CAT(SYS_,y)) | SYSCALL_G5RFLAG, %g1; \
148 #define RSYSCALL_NOERROR(x) _RSYSCALL_NOERROR(x,x)
149 #define PSEUDO_NOERROR(x,y) _RSYSCALL_NOERROR(x,y)