netbsd32_machdep_16.c revision 1.2.4.3 1 1.2.4.2 christos /*-
2 1.2.4.2 christos * Copyright (c) 2012 The NetBSD Foundation, Inc.
3 1.2.4.2 christos * All rights reserved.
4 1.2.4.2 christos *
5 1.2.4.2 christos * This code is derived from software contributed to The NetBSD Foundation
6 1.2.4.2 christos * by Matt Thomas of 3am Software Foundry.
7 1.2.4.2 christos *
8 1.2.4.2 christos * Redistribution and use in source and binary forms, with or without
9 1.2.4.2 christos * modification, are permitted provided that the following conditions
10 1.2.4.2 christos * are met:
11 1.2.4.2 christos * 1. Redistributions of source code must retain the above copyright
12 1.2.4.2 christos * notice, this list of conditions and the following disclaimer.
13 1.2.4.2 christos * 2. Redistributions in binary form must reproduce the above copyright
14 1.2.4.2 christos * notice, this list of conditions and the following disclaimer in the
15 1.2.4.2 christos * documentation and/or other materials provided with the distribution.
16 1.2.4.2 christos *
17 1.2.4.2 christos * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
18 1.2.4.2 christos * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19 1.2.4.2 christos * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20 1.2.4.2 christos * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
21 1.2.4.2 christos * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 1.2.4.2 christos * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 1.2.4.2 christos * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 1.2.4.2 christos * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 1.2.4.2 christos * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 1.2.4.2 christos * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 1.2.4.2 christos * POSSIBILITY OF SUCH DAMAGE.
28 1.2.4.2 christos */
29 1.2.4.2 christos
30 1.2.4.2 christos #include <sys/cdefs.h>
31 1.2.4.2 christos
32 1.2.4.3 martin __KERNEL_RCSID(1, "$NetBSD: netbsd32_machdep_16.c,v 1.2.4.3 2020/04/13 08:03:32 martin Exp $");
33 1.2.4.2 christos
34 1.2.4.2 christos #ifdef _KERNEL_OPT
35 1.2.4.2 christos #include "opt_compat_netbsd.h"
36 1.2.4.2 christos #include "opt_compat_netbsd32.h"
37 1.2.4.2 christos #endif
38 1.2.4.2 christos
39 1.2.4.2 christos #include <sys/param.h>
40 1.2.4.2 christos #include <sys/core.h>
41 1.2.4.2 christos #include <sys/exec.h>
42 1.2.4.2 christos #include <sys/lwp.h>
43 1.2.4.2 christos #include <sys/signalvar.h>
44 1.2.4.2 christos #include <sys/syscallvar.h>
45 1.2.4.2 christos #include <sys/syscallargs.h>
46 1.2.4.2 christos
47 1.2.4.2 christos #include <uvm/uvm_extern.h>
48 1.2.4.2 christos
49 1.2.4.2 christos #include <compat/netbsd32/netbsd32.h>
50 1.2.4.2 christos #include <compat/netbsd32/netbsd32_exec.h>
51 1.2.4.2 christos #include <compat/netbsd32/netbsd32_syscall.h>
52 1.2.4.2 christos #include <compat/netbsd32/netbsd32_syscallargs.h>
53 1.2.4.2 christos
54 1.2.4.2 christos #ifdef COMPAT_16
55 1.2.4.2 christos
56 1.2.4.2 christos int
57 1.2.4.2 christos compat_16_netbsd32___sigreturn14(struct lwp *l,
58 1.2.4.2 christos const struct compat_16_netbsd32___sigreturn14_args *uap,
59 1.2.4.2 christos register_t *retval)
60 1.2.4.2 christos {
61 1.2.4.2 christos struct compat_16_sys___sigreturn14_args ua;
62 1.2.4.2 christos
63 1.2.4.2 christos NETBSD32TOP_UAP(sigcntxp, struct sigcontext *);
64 1.2.4.2 christos
65 1.2.4.2 christos return compat_16_sys___sigreturn14(l, &ua, retval);
66 1.2.4.2 christos }
67 1.2.4.2 christos
68 1.2.4.2 christos static struct syscall_package compat_arm32_netbsd32_16_syscalls[] = {
69 1.2.4.2 christos { NETBSD32_SYS_compat_16_netbsd32___sigreturn14, 0,
70 1.2.4.2 christos (sy_call_t *)compat_16_netbsd32___sigreturn14 },
71 1.2.4.2 christos { 0, 0, NULL }
72 1.2.4.2 christos };
73 1.2.4.2 christos
74 1.2.4.2 christos void
75 1.2.4.2 christos netbsd32_machdep_md_16_init(void)
76 1.2.4.2 christos {
77 1.2.4.2 christos
78 1.2.4.2 christos (void)syscall_establish(&emul_netbsd32,
79 1.2.4.2 christos compat_arm32_netbsd32_16_syscalls);
80 1.2.4.2 christos }
81 1.2.4.2 christos
82 1.2.4.2 christos void
83 1.2.4.2 christos netbsd32_machdep_md_16_fini(void)
84 1.2.4.2 christos {
85 1.2.4.2 christos
86 1.2.4.2 christos (void)syscall_disestablish(&emul_netbsd32,
87 1.2.4.2 christos compat_arm32_netbsd32_16_syscalls);
88 1.2.4.2 christos }
89 1.2.4.2 christos #endif
90