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