| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: netbsd32_mod.c,v 1.15.4.1 2020/03/08 10:54:43 martin Exp $ */ | | 1 | /* $NetBSD: netbsd32_mod.c,v 1.15.4.2 2020/03/09 05:36:24 martin Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2008 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2008 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software developed for The NetBSD Foundation | | 7 | * This code is derived from software developed for The NetBSD Foundation |
8 | * by Andrew Doran. | | 8 | * by Andrew Doran. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -49,27 +49,27 @@ | | | @@ -49,27 +49,27 @@ |
49 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 49 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
50 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 50 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
51 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 51 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
52 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 52 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
53 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 53 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
54 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 54 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
55 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 55 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
56 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 56 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
57 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 57 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
58 | * POSSIBILITY OF SUCH DAMAGE. | | 58 | * POSSIBILITY OF SUCH DAMAGE. |
59 | */ | | 59 | */ |
60 | | | 60 | |
61 | #include <sys/cdefs.h> | | 61 | #include <sys/cdefs.h> |
62 | __KERNEL_RCSID(0, "$NetBSD: netbsd32_mod.c,v 1.15.4.1 2020/03/08 10:54:43 martin Exp $"); | | 62 | __KERNEL_RCSID(0, "$NetBSD: netbsd32_mod.c,v 1.15.4.2 2020/03/09 05:36:24 martin Exp $"); |
63 | | | 63 | |
64 | #ifdef _KERNEL_OPT | | 64 | #ifdef _KERNEL_OPT |
65 | #include "opt_execfmt.h" | | 65 | #include "opt_execfmt.h" |
66 | #endif | | 66 | #endif |
67 | | | 67 | |
68 | #ifndef ELFSIZE | | 68 | #ifndef ELFSIZE |
69 | #define ELFSIZE ARCH_ELFSIZE | | 69 | #define ELFSIZE ARCH_ELFSIZE |
70 | #endif | | 70 | #endif |
71 | | | 71 | |
72 | #include <sys/param.h> | | 72 | #include <sys/param.h> |
73 | #include <sys/module.h> | | 73 | #include <sys/module.h> |
74 | #include <sys/exec.h> | | 74 | #include <sys/exec.h> |
75 | #include <sys/exec_elf.h> | | 75 | #include <sys/exec_elf.h> |
| @@ -163,44 +163,44 @@ static int | | | @@ -163,44 +163,44 @@ static int |
163 | compat_netbsd32_modcmd(modcmd_t cmd, void *arg) | | 163 | compat_netbsd32_modcmd(modcmd_t cmd, void *arg) |
164 | { | | 164 | { |
165 | int error; | | 165 | int error; |
166 | | | 166 | |
167 | switch (cmd) { | | 167 | switch (cmd) { |
168 | case MODULE_CMD_INIT: | | 168 | case MODULE_CMD_INIT: |
169 | error = exec_add(netbsd32_execsw, | | 169 | error = exec_add(netbsd32_execsw, |
170 | __arraycount(netbsd32_execsw)); | | 170 | __arraycount(netbsd32_execsw)); |
171 | if (error == 0) { | | 171 | if (error == 0) { |
172 | netbsd32_sysctl_init(); | | 172 | netbsd32_sysctl_init(); |
173 | netbsd32_machdep_md_init(); | | 173 | netbsd32_machdep_md_init(); |
174 | netbsd32_kern_proc_32_init(); | | 174 | netbsd32_kern_proc_32_init(); |
175 | #if defined(__amd64__) | | 175 | #if defined(__amd64__) |
176 | MODULE_HOOK_SET(amd64_oosyscall_hook, | | 176 | MODULE_HOOK_SET(amd64_oosyscall_hook, "nb32oo", |
177 | amd64_oosyscall_handle); | | 177 | amd64_oosyscall_handle); |
178 | #endif | | 178 | #endif |
179 | } | | 179 | } |
180 | return error; | | 180 | return error; |
181 | | | 181 | |
182 | case MODULE_CMD_FINI: | | 182 | case MODULE_CMD_FINI: |
183 | #if defined(__amd64__) | | 183 | #if defined(__amd64__) |
184 | MODULE_HOOK_UNSET(amd64_oosyscall_hook); | | 184 | MODULE_HOOK_UNSET(amd64_oosyscall_hook); |
185 | #endif | | 185 | #endif |
186 | netbsd32_machdep_md_fini(); | | 186 | netbsd32_machdep_md_fini(); |
187 | netbsd32_sysctl_fini(); | | 187 | netbsd32_sysctl_fini(); |
188 | netbsd32_kern_proc_32_fini(); | | 188 | netbsd32_kern_proc_32_fini(); |
189 | | | 189 | |
190 | error = exec_remove(netbsd32_execsw, | | 190 | error = exec_remove(netbsd32_execsw, |
191 | __arraycount(netbsd32_execsw)); | | 191 | __arraycount(netbsd32_execsw)); |
192 | if (error) { | | 192 | if (error) { |
193 | netbsd32_kern_proc_32_init(); | | 193 | netbsd32_kern_proc_32_init(); |
194 | netbsd32_sysctl_init(); | | 194 | netbsd32_sysctl_init(); |
195 | netbsd32_machdep_md_init(); | | 195 | netbsd32_machdep_md_init(); |
196 | #if defined(__amd64__) | | 196 | #if defined(__amd64__) |
197 | MODULE_HOOK_SET(amd64_oosyscall_hook, | | 197 | MODULE_HOOK_SET(amd64_oosyscall_hook, "nb32oo", |
198 | amd64_oosyscall_handle); | | 198 | amd64_oosyscall_handle); |
199 | #endif | | 199 | #endif |
200 | } | | 200 | } |
201 | return error; | | 201 | return error; |
202 | | | 202 | |
203 | default: | | 203 | default: |
204 | return ENOTTY; | | 204 | return ENOTTY; |
205 | } | | 205 | } |
206 | } | | 206 | } |