xref: /netbsd-src/sys/arch/mips/mips/netbsd32_machdep_16.c (revision 2599cb36a471ea9278140dc5e0da39491b979430)
1 /*	$NetBSD: netbsd32_machdep_16.c,v 1.8 2024/06/17 20:25:20 pgoyette Exp $	*/
2 
3 /*-
4  * Copyright (c) 2009 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Matt Thomas <matt@3am-software.com>.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 #include <sys/cdefs.h>
33 __KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep_16.c,v 1.8 2024/06/17 20:25:20 pgoyette Exp $");
34 
35 #ifdef _KERNEL_OPT
36 #include "opt_compat_netbsd.h"
37 #endif
38 
39 #include <sys/param.h>
40 #include <sys/systm.h>
41 #include <sys/ioctl.h>
42 #include <sys/exec.h>
43 #include <sys/cpu.h>
44 #include <sys/core.h>
45 #include <sys/file.h>
46 #include <sys/time.h>
47 #include <sys/proc.h>
48 #include <sys/uio.h>
49 #include <sys/kernel.h>
50 #include <sys/buf.h>
51 #include <sys/signal.h>
52 #include <sys/signalvar.h>
53 #include <sys/mount.h>
54 #include <sys/syscallargs.h>
55 #include <sys/module_hook.h>
56 
57 #include <compat/netbsd32/netbsd32.h>
58 #include <compat/netbsd32/netbsd32_exec.h>
59 #include <compat/netbsd32/netbsd32_syscallargs.h>
60 
61 #include <mips/cache.h>
62 #include <mips/sysarch.h>
63 #include <mips/cachectl.h>
64 #include <mips/locore.h>
65 #include <mips/frame.h>
66 #include <mips/regnum.h>
67 #include <mips/pcb.h>
68 
69 #include <uvm/uvm_extern.h>
70 
71 void sendsig_context(const ksiginfo_t *, const sigset_t *);
72 
73 int
compat_16_netbsd32___sigreturn14(struct lwp * l,const struct compat_16_netbsd32___sigreturn14_args * uap,register_t * retval)74 compat_16_netbsd32___sigreturn14(struct lwp *l,
75 	const struct compat_16_netbsd32___sigreturn14_args *uap,
76 	register_t *retval)
77 {
78 	struct compat_16_sys___sigreturn14_args ua;
79 
80 	NETBSD32TOP_UAP(sigcntxp, struct sigcontext *);
81 
82 	return compat_16_sys___sigreturn14(l, &ua, retval);
83 }
84 
85 void
netbsd32_machdep_md_16_init(void)86 netbsd32_machdep_md_16_init(void)
87 {
88 
89 	MODULE_HOOK_SET(netbsd32_sendsig_sigcontext_16_hook,
90 	    sendsig_sigcontext);
91 }
92 
93 void
netbsd32_machdep_md_16_fini(void)94 netbsd32_machdep_md_16_fini(void)
95 {
96 
97 	MODULE_HOOK_UNSET(netbsd32_sendsig_sigcontext_16_hook);
98 }
99