185518Sjake/*-
285518Sjake * Copyright (c) 1990 The Regents of the University of California.
385518Sjake * All rights reserved.
485518Sjake *
585518Sjake * This code is derived from software contributed to Berkeley by
685518Sjake * William Jolitz.
785518Sjake *
885518Sjake * Redistribution and use in source and binary forms, with or without
985518Sjake * modification, are permitted provided that the following conditions
1085518Sjake * are met:
1185518Sjake * 1. Redistributions of source code must retain the above copyright
1285518Sjake *    notice, this list of conditions and the following disclaimer.
1385518Sjake * 2. Redistributions in binary form must reproduce the above copyright
1485518Sjake *    notice, this list of conditions and the following disclaimer in the
1585518Sjake *    documentation and/or other materials provided with the distribution.
1685518Sjake * 4. Neither the name of the University nor the names of its contributors
1785518Sjake *    may be used to endorse or promote products derived from this software
1885518Sjake *    without specific prior written permission.
1985518Sjake *
2085518Sjake * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2185518Sjake * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2285518Sjake * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2385518Sjake * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2485518Sjake * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2585518Sjake * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2685518Sjake * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2785518Sjake * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2885518Sjake * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2985518Sjake * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3085518Sjake * SUCH DAMAGE.
3185518Sjake *
3292991Sobrien *	@(#)SYS.h	5.5 (Berkeley) 5/7/91
3385518Sjake *	from: FreeBSD: src/lib/libc/i386/SYS.h,v 1.20 2001/01/29
3485518Sjake * $FreeBSD$
3585518Sjake */
3685518Sjake
3785518Sjake#include <sys/syscall.h>
3885518Sjake
3985518Sjake#include <machine/asm.h>
4088608Sjake#include <machine/utrap.h>
4185518Sjake
4285518Sjake#define	ERROR() \
4385518Sjake	mov	%o7, %g1 ; \
4485518Sjake	call	HIDENAME(cerror) ; \
4585518Sjake	 mov	%g1, %o7
4685518Sjake
4785518Sjake#define	_SYSENTRY(x) \
4885518SjakeENTRY(__CONCAT(__sys_,x)) ; \
4985518Sjake	.weak	CNAME(x) ; \
5086532Sjake	.type	CNAME(x),@function ; \
5185518Sjake	.set	CNAME(x),CNAME(__CONCAT(__sys_,x)) ; \
5285518Sjake	.weak	CNAME(__CONCAT(_,x)) ; \
5386532Sjake	.type	CNAME(__CONCAT(_,x)), @function ; \
5485518Sjake	.set	CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x))
5585518Sjake
5686532Sjake#define	_SYSEND(x) \
5786532Sjake	.size	CNAME(__CONCAT(__sys_,x)), . - CNAME(__CONCAT(__sys_,x)) ; \
5886532Sjake	.size	CNAME(__CONCAT(_,x)), . - CNAME(__CONCAT(__sys_,x)) ; \
5986532Sjake	.size	CNAME(__CONCAT(,x)), . - CNAME(__CONCAT(__sys_,x))
6086532Sjake
6185518Sjake#define	_SYSCALL(x) \
6285518Sjake	mov	__CONCAT(SYS_,x), %g1 ; \
6385518Sjake	ta	%xcc, ST_SYSCALL ; \
6485518Sjake	bcc,a,pt %xcc, 1f ; \
6585518Sjake	 nop ; \
6685518Sjake	ERROR() ; \
6785518Sjake1:
6885518Sjake
6986532Sjake#define	RSYSCALL(x) \
7085518Sjake_SYSENTRY(x) ; \
7186532Sjake	_SYSCALL(x) ; \
7285518Sjake	retl ; \
7386532Sjake	 nop ; \
7486532Sjake	_SYSEND(x)
7585518Sjake
7685518Sjake#define	PSEUDO(x) \
7785518SjakeENTRY(__CONCAT(__sys_,x)) ; \
7885518Sjake	.weak	CNAME(__CONCAT(_,x)) ; \
7986532Sjake	.type	CNAME(__CONCAT(_,x)),@function ; \
8085518Sjake	.set	CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)) ; \
81171217Speter	_SYSCALL(x) ; \
8285518Sjake	retl ; \
8386532Sjake	 nop ; \
8486532Sjake	.size	CNAME(__CONCAT(__sys_,x)), . - CNAME(__CONCAT(__sys_,x)) ; \
8586532Sjake	.size	CNAME(__CONCAT(_,x)), . - CNAME(__CONCAT(__sys_,x))
86