196685Sobrien/*-
2109499Sobrien * Copyright (c) 2002 Benno Rice.  All rights reserved.
396685Sobrien * Copyright (c) 2002 David E. O'Brien.  All rights reserved.
496685Sobrien *
596685Sobrien * Redistribution and use in source and binary forms, with or without
696685Sobrien * modification, are permitted provided that the following conditions
796685Sobrien * are met:
896685Sobrien * 1. Redistributions of source code must retain the above copyright
996685Sobrien *    notice, this list of conditions and the following disclaimer.
1096685Sobrien * 2. Redistributions in binary form must reproduce the above copyright
1196685Sobrien *    notice, this list of conditions and the following disclaimer in the
1296685Sobrien *    documentation and/or other materials provided with the distribution.
1396685Sobrien * 3. Neither the name of the author nor the names of any contributors
1496685Sobrien *    may be used to endorse or promote products derived from this software
1596685Sobrien *    without specific prior written permission.
1696685Sobrien *
1796685Sobrien * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1896685Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1996685Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2096685Sobrien * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2196685Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2296685Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2396685Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2496685Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2596685Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2696685Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2796685Sobrien * SUCH DAMAGE.
2896685Sobrien *
2996693Sobrien *	$NetBSD: SYS.h,v 1.8 2002/01/14 00:55:56 thorpej Exp $
3096685Sobrien * $FreeBSD$
3196685Sobrien */
3296685Sobrien
3396685Sobrien#include <sys/syscall.h>
3496685Sobrien#include <machine/asm.h>
3596685Sobrien
36231044Sandreast#define	_SYSCALL(name)						\
3796775Sbenno	.text;							\
3896775Sbenno	.align 2;						\
39231044Sandreast	li	0,(__CONCAT(SYS_, name));			\
4096775Sbenno	sc
4196775Sbenno
42231044Sandreast#define	SYSCALL(name)						\
4396775Sbenno	.text;							\
4496775Sbenno	.align 2;						\
4596786Sbenno2:	b	PIC_PLT(CNAME(HIDENAME(cerror)));		\
46231044SandreastENTRY(__CONCAT(__sys_, name));				\
47231044Sandreast	WEAK_REFERENCE(__CONCAT(__sys_, name), name);		\
48231044Sandreast	WEAK_REFERENCE(__CONCAT(__sys_, name), __CONCAT(_, name));\
49231044Sandreast	_SYSCALL(name);						\
5096685Sobrien	bso	2b
5196695Sobrien
52231044Sandreast#define	PSEUDO(name)						\
5396775Sbenno	.text;							\
5496775Sbenno	.align 2;						\
55231044SandreastENTRY(__CONCAT(__sys_, name));				\
56231044Sandreast	WEAK_REFERENCE(__CONCAT(__sys_, name), __CONCAT(_, name));\
57231044Sandreast	_SYSCALL(name);						\
5896775Sbenno	bnslr;							\
5996786Sbenno	b	PIC_PLT(CNAME(HIDENAME(cerror)))
6096775Sbenno
61231044Sandreast#define	RSYSCALL(name)						\
6296775Sbenno	.text;							\
6396775Sbenno	.align 2;						\
6496786Sbenno2:	b	PIC_PLT(CNAME(HIDENAME(cerror)));		\
65231044SandreastENTRY(__CONCAT(__sys_, name));				\
66231044Sandreast	WEAK_REFERENCE(__CONCAT(__sys_, name), name);		\
67231044Sandreast	WEAK_REFERENCE(__CONCAT(__sys_, name), __CONCAT(_, name));\
68231044Sandreast	_SYSCALL(name);						\
6996775Sbenno	bnslr;							\
7096786Sbenno	b	PIC_PLT(CNAME(HIDENAME(cerror)))
71