1 /* $NetBSD: compat_stub.c,v 1.22 2021/08/09 20:49:10 andvar Exp $ */
2
3 /*-
4 * Copyright (c) 2018 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Paul Goyette
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
34 #ifdef _KERNEL_OPT
35 #include "opt_ntp.h"
36 #endif
37
38 #include <sys/systm.h>
39 #include <sys/compat_stub.h>
40
41 #ifdef NTP
42 #include <sys/timespec.h>
43 #include <sys/timex.h>
44 #endif
45
46 /*
47 * Routine vectors for compat_50___sys_ntp_gettime
48 *
49 * MP-hooks not needed since the NTP code is not modular
50 */
51
52 #ifdef NTP
53 void (*vec_ntp_gettime)(struct ntptimeval *) = ntp_gettime;
54 int (*vec_ntp_timestatus)(void) = ntp_timestatus;
55 void (*vec_ntp_adjtime1)(struct timex *) = ntp_adjtime1;
56 #else
57 void (*vec_ntp_gettime)(struct ntptimeval *) = NULL;
58 int (*vec_ntp_timestatus)(void) = NULL;
59 void (*vec_ntp_adjtime1)(struct timex *) = NULL;
60 #endif
61
62 /*
63 * Routine vectors for sctp (called from within rtsock)
64 *
65 * MP-hooks not needed since the SCTP code is not modular
66 *
67 * For now, just point these at NULL. Network initialization code
68 * in if.c will overwrite these with correct values. This is needed
69 * to enable building of rumpkern library without creating circular
70 * dependency with rumpnet library
71 */
72
73 void (*vec_sctp_add_ip_address)(struct ifaddr *) = NULL;
74 void (*vec_sctp_delete_ip_address)(struct ifaddr *) = NULL;
75
76
77 /*
78 * usb device_info compatibility
79 */
80 struct usb_subr_fill_30_hook_t usb_subr_fill_30_hook;
81 struct usb_subr_copy_30_hook_t usb_subr_copy_30_hook;
82
83 /*
84 * ccd device compatibility ioctl
85 */
86
87 struct ccd_ioctl_60_hook_t ccd_ioctl_60_hook;
88
89 /*
90 * clockctl device compatibility ioctl
91 */
92
93 struct clockctl_ioctl_50_hook_t clockctl_ioctl_50_hook;
94
95 /*
96 * if_sppp device compatibility ioctl subroutine
97 */
98
99 struct sppp_params_50_hook_t sppp_params_50_hook;
100
101 /*
102 * cryptodev compatibility ioctl
103 */
104
105 struct ocryptof_50_hook_t ocryptof_50_hook;
106
107 /*
108 * raidframe compatibility
109 */
110 struct raidframe_ioctl_50_hook_t raidframe_ioctl_50_hook;
111 struct raidframe_ioctl_80_hook_t raidframe_ioctl_80_hook;
112 struct raidframe_netbsd32_ioctl_hook_t raidframe_netbsd32_ioctl_hook;
113
114 /*
115 * puffs compatibility
116 */
117
118 struct puffs_out_50_hook_t puffs_out_50_hook;
119 struct puffs_in_50_hook_t puffs_in_50_hook;
120
121 /*
122 * wsevents compatibility
123 */
124 struct wscons_copyout_events_50_hook_t wscons_copyout_events_50_hook;
125
126 /*
127 * sysmon_power compatibility
128 */
129 struct compat_sysmon_power_40_hook_t compat_sysmon_power_40_hook;
130
131 /*
132 * compat_bio compatibility
133 */
134 struct compat_bio_30_hook_t compat_bio_30_hook;
135
136 /*
137 * vnd ioctl compatibility
138 */
139 struct compat_vndioctl_30_hook_t compat_vndioctl_30_hook;
140 struct compat_vndioctl_50_hook_t compat_vndioctl_50_hook;
141
142 /*
143 * ieee80211 ioctl compatibility
144 */
145 struct ieee80211_ioctl_20_hook_t ieee80211_ioctl_20_hook;
146
147 /*
148 * if_43 compatibility
149 */
150 struct if_cvtcmd_43_hook_t if_cvtcmd_43_hook;
151 struct if_ifioctl_43_hook_t if_ifioctl_43_hook;
152
153 /*
154 * if43_cvtcmd_20 compatibility
155 */
156 struct if43_cvtcmd_20_hook_t if43_cvtcmd_20_hook;
157
158 /*
159 * tty 43 ioctl compatibility
160 */
161 struct tty_ttioctl_43_hook_t tty_ttioctl_43_hook;
162
163 /*
164 * uipc_syscalls_40 compatibility
165 */
166 struct uipc_syscalls_40_hook_t uipc_syscalls_40_hook;
167
168 /*
169 * uipc_socket_50 compatibility
170 */
171 struct uipc_socket_50_setopt1_hook_t uipc_socket_50_setopt1_hook;
172 struct uipc_socket_50_getopt1_hook_t uipc_socket_50_getopt1_hook;
173 struct uipc_socket_50_sbts_hook_t uipc_socket_50_sbts_hook;
174
175 /*
176 * uipc_syscalls_50 compatibility
177 */
178 struct uipc_syscalls_50_hook_t uipc_syscalls_50_hook;
179
180 /*
181 * rtsock 14 compatibility
182 */
183 struct rtsock_oifmsg_14_hook_t rtsock_oifmsg_14_hook;
184 struct rtsock_iflist_14_hook_t rtsock_iflist_14_hook;
185
186 /*
187 * rtsock 50 compatibility
188 */
189 struct rtsock_iflist_50_hook_t rtsock_iflist_50_hook;
190 struct rtsock_oifmsg_50_hook_t rtsock_oifmsg_50_hook;
191 struct rtsock_rt_missmsg_50_hook_t rtsock_rt_missmsg_50_hook;
192 struct rtsock_rt_ifmsg_50_hook_t rtsock_rt_ifmsg_50_hook;
193 struct rtsock_rt_ifannouncemsg_50_hook_t rtsock_rt_ifannouncemsg_50_hook;
194 struct rtsock_rt_addrmsg_rt_50_hook_t rtsock_rt_addrmsg_rt_50_hook;
195 struct rtsock_rt_addrmsg_src_50_hook_t rtsock_rt_addrmsg_src_50_hook;
196 struct rtsock_rt_addrmsg_50_hook_t rtsock_rt_addrmsg_50_hook;
197 struct rtsock_rt_ieee80211msg_50_hook_t rtsock_rt_ieee80211msg_50_hook;
198
199 /*
200 * rtsock 70 compatibility
201 */
202 struct rtsock_newaddr_70_hook_t rtsock_newaddr_70_hook;
203 struct rtsock_iflist_70_hook_t rtsock_iflist_70_hook;
204
205 /*
206 * modctl handler for old style OSTAT
207 */
208 struct compat_modstat_80_hook_t compat_modstat_80_hook;
209
210 /*
211 * mask for kern_sig_43's killpg (updated by compat_09)
212 */
213 int kern_sig_43_pgid_mask = ~0;
214
215 /*
216 * hook for kern_proc_32
217 */
218 struct kern_proc32_copyin_hook_t kern_proc32_copyin_hook;
219 struct kern_proc32_base_hook_t kern_proc32_base_hook;
220
221 /*
222 * Hook for sparc fpu code to check if a process is running
223 * under sunos emulation
224 */
225 struct get_emul_sunos_hook_t get_emul_sunos_hook;
226
227 /*
228 * Hook for rnd_ioctl_50 callbacks
229 */
230 struct rnd_ioctl_50_hook_t rnd_ioctl_50_hook;
231 struct rnd_ioctl32_50_hook_t rnd_ioctl32_50_hook;
232
233 /*
234 * Hooks for compat_60 ttioctl and ptmioctl
235 */
236 struct tty_ttioctl_60_hook_t tty_ttioctl_60_hook;
237 struct tty_ptmioctl_60_hook_t tty_ptmioctl_60_hook;
238
239 /*
240 * Hook for compat_10 openat
241 */
242 struct vfs_openat_10_hook_t vfs_openat_10_hook;
243
244 /*
245 * Hook for compat_70_unp_addsockcred
246 */
247 struct uipc_unp_70_hook_t uipc_unp_70_hook;
248
249 /*
250 * Hook for sysvipc50_sysctl
251 */
252 struct sysvipc_sysctl_50_hook_t sysvipc_sysctl_50_hook;
253
254 /*
255 * ifmedia_80 compatibility
256 */
257 struct ifmedia_80_pre_hook_t ifmedia_80_pre_hook;
258 struct ifmedia_80_post_hook_t ifmedia_80_post_hook;
259
260 /*
261 * Hook for 32-bit machine name
262 *
263 * This probably would be better placed in compat/netbsd32/netbsd32_mod.c
264 * but the consumer code in linux32_exec_elf32.c is sometimes included in
265 * the main kernel, and not in a compat_netbsd32 module. (In particular,
266 * this is true for i386 and sgimips.)
267 */
268 struct netbsd32_machine32_hook_t netbsd32_machine32_hook;
269 struct netbsd32_reg_validate_hook_t netbsd32_reg_validate_hook;
270
271 /*
272 * Hook for sendsig_sigcontext_16
273 */
274 struct sendsig_sigcontext_16_hook_t sendsig_sigcontext_16_hook;
275
276 /*
277 * Hooks for coredumps
278 */
279 struct coredump_hook_t coredump_hook;
280 struct coredump_offset_hook_t coredump_offset_hook;
281 struct coredump_write_hook_t coredump_write_hook;
282 struct coredump_netbsd_hook_t coredump_netbsd_hook;
283 struct coredump_netbsd32_hook_t coredump_netbsd32_hook;
284 struct coredump_elf32_hook_t coredump_elf32_hook;
285 struct coredump_elf64_hook_t coredump_elf64_hook;
286 struct uvm_coredump_walkmap_hook_t uvm_coredump_walkmap_hook;
287 struct uvm_coredump_count_segs_hook_t uvm_coredump_count_segs_hook;
288
289
Cache object: b5b620c4918dc9e5cf3847ffbd283b44
|