xref: /openbsd/libexec/ld.so/sparc64/SYS.h (revision 04459484)
1*04459484Sderaadt /*	$OpenBSD: SYS.h,v 1.6 2023/12/11 22:29:25 deraadt Exp $	*/
2d6979ba5Sderaadt /*	$NetBSD: rtld_start.S,v 1.5 2001/08/14 22:17:48 eeh Exp $	*/
3d6979ba5Sderaadt 
4d6979ba5Sderaadt /*
5d6979ba5Sderaadt  * Copyright (c) 2001 Jason L. Wright (jason@thought.net)
6d6979ba5Sderaadt  * All rights reserved.
7d6979ba5Sderaadt  *
8d6979ba5Sderaadt  * Redistribution and use in source and binary forms, with or without
9d6979ba5Sderaadt  * modification, are permitted provided that the following conditions
10d6979ba5Sderaadt  * are met:
11d6979ba5Sderaadt  * 1. Redistributions of source code must retain the above copyright
12d6979ba5Sderaadt  *    notice, this list of conditions and the following disclaimer.
13d6979ba5Sderaadt  * 2. Redistributions in binary form must reproduce the above copyright
14d6979ba5Sderaadt  *    notice, this list of conditions and the following disclaimer in the
15d6979ba5Sderaadt  *    documentation and/or other materials provided with the distribution.
16d6979ba5Sderaadt  *
17d6979ba5Sderaadt  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18d6979ba5Sderaadt  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19d6979ba5Sderaadt  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20d6979ba5Sderaadt  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
21d6979ba5Sderaadt  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22d6979ba5Sderaadt  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23d6979ba5Sderaadt  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24d6979ba5Sderaadt  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
25d6979ba5Sderaadt  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
26d6979ba5Sderaadt  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27d6979ba5Sderaadt  * POSSIBILITY OF SUCH DAMAGE.
28d6979ba5Sderaadt  */
29d6979ba5Sderaadt 
30d6979ba5Sderaadt /*-
31d6979ba5Sderaadt  * Copyright (c) 2000 Eduardo Horvath.
32d6979ba5Sderaadt  * Copyright (c) 1999 The NetBSD Foundation, Inc.
33d6979ba5Sderaadt  * All rights reserved.
34d6979ba5Sderaadt  *
35d6979ba5Sderaadt  * This code is derived from software contributed to The NetBSD Foundation
36d6979ba5Sderaadt  * by Christos Zoulas and Paul Kranenburg.
37d6979ba5Sderaadt  *
38d6979ba5Sderaadt  * Redistribution and use in source and binary forms, with or without
39d6979ba5Sderaadt  * modification, are permitted provided that the following conditions
40d6979ba5Sderaadt  * are met:
41d6979ba5Sderaadt  * 1. Redistributions of source code must retain the above copyright
42d6979ba5Sderaadt  *    notice, this list of conditions and the following disclaimer.
43d6979ba5Sderaadt  * 2. Redistributions in binary form must reproduce the above copyright
44d6979ba5Sderaadt  *    notice, this list of conditions and the following disclaimer in the
45d6979ba5Sderaadt  *    documentation and/or other materials provided with the distribution.
46d6979ba5Sderaadt  * 3. All advertising materials mentioning features or use of this software
47d6979ba5Sderaadt  *    must display the following acknowledgement:
48d6979ba5Sderaadt  *	This product includes software developed by the NetBSD
49d6979ba5Sderaadt  *	Foundation, Inc. and its contributors.
50d6979ba5Sderaadt  * 4. Neither the name of The NetBSD Foundation nor the names of its
51d6979ba5Sderaadt  *    contributors may be used to endorse or promote products derived
52d6979ba5Sderaadt  *    from this software without specific prior written permission.
53d6979ba5Sderaadt  *
54d6979ba5Sderaadt  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
55d6979ba5Sderaadt  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
56d6979ba5Sderaadt  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
57d6979ba5Sderaadt  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
58d6979ba5Sderaadt  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
59d6979ba5Sderaadt  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
60d6979ba5Sderaadt  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
61d6979ba5Sderaadt  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
62d6979ba5Sderaadt  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
63d6979ba5Sderaadt  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
64d6979ba5Sderaadt  * POSSIBILITY OF SUCH DAMAGE.
65d6979ba5Sderaadt  */
66d6979ba5Sderaadt 
67d6979ba5Sderaadt #include <sys/syscall.h>
68d6979ba5Sderaadt #include <machine/trap.h>
69d6979ba5Sderaadt #include <machine/asm.h>
70d6979ba5Sderaadt 
7183762a71Sderaadt #define PINSYSCALL(sysno, label)				\
7283762a71Sderaadt 	.pushsection .openbsd.syscalls,"",@progbits		;\
73*04459484Sderaadt 	.p2align 2						;\
7483762a71Sderaadt 	.long label						;\
7583762a71Sderaadt 	.long sysno						;\
7683762a71Sderaadt 	.popsection
7783762a71Sderaadt 
781dde9cbeSderaadt #define __CONCAT(x,y) x##y
791dde9cbeSderaadt 
80d6979ba5Sderaadt #define DL_SYSCALL(n)						\
81d6979ba5Sderaadt _ENTRY(__CONCAT(_dl_,n))					\
82d6979ba5Sderaadt 	mov __CONCAT(SYS_,n) | SYSCALL_G2RFLAG, %g1		;\
83d6979ba5Sderaadt 	add %o7, 8, %g2						;\
8483762a71Sderaadt 99:	t ST_SYSCALL						;\
8583762a71Sderaadt 	PINSYSCALL(__CONCAT(SYS_,n), 99b)			;\
86d6979ba5Sderaadt 	retl							;\
87d6979ba5Sderaadt 	 sub %g0, %o0, %o0
88d6979ba5Sderaadt 
89d6979ba5Sderaadt 
90