1 /* $NetBSD: compat_stub.c,v 1.15 2019/07/20 18:23:05 christos 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 compatability 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 compatability ioctl 85 */ 86 87 struct ccd_ioctl_60_hook_t ccd_ioctl_60_hook; 88 89 /* 90 * clockctl device compatability ioctl 91 */ 92 93 struct clockctl_ioctl_50_hook_t clockctl_ioctl_50_hook; 94 95 /* 96 * if_sppp device compatability ioctl subroutine 97 */ 98 99 struct sppp_params_50_hook_t sppp_params_50_hook; 100 101 /* 102 * cryptodev compatability ioctl 103 */ 104 105 struct ocryptof_50_hook_t ocryptof_50_hook; 106 107 /* 108 * raidframe compatability 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 compatability 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 /* XXX 122 int (*puffs50_compat_outgoing)(struct puffs_req *, struct puffs_req **, 123 ssize_t *) = (void *)enosys; 124 void (*puffs50_compat_incoming)(struct puffs_req *, struct puffs_req *) = 125 (void *)voidop; 126 XXX */ 127 128 /* 129 * wsevents compatability 130 */ 131 struct wscons_copyout_events_50_hook_t wscons_copyout_events_50_hook; 132 133 /* 134 * sysmon_power compatability 135 */ 136 struct compat_sysmon_power_40_hook_t compat_sysmon_power_40_hook; 137 138 /* 139 * compat_bio compatability 140 */ 141 struct compat_bio_30_hook_t compat_bio_30_hook; 142 143 /* 144 * vnd ioctl compatability 145 */ 146 struct compat_vndioctl_30_hook_t compat_vndioctl_30_hook; 147 struct compat_vndioctl_50_hook_t compat_vndioctl_50_hook; 148 149 /* 150 * ieee80211 ioctl compatability 151 */ 152 struct ieee80211_ioctl_20_hook_t ieee80211_ioctl_20_hook; 153 154 /* 155 * if_43 compatability 156 */ 157 struct if_cvtcmd_43_hook_t if_cvtcmd_43_hook; 158 struct if_ifioctl_43_hook_t if_ifioctl_43_hook; 159 160 /* 161 * if43_cvtcmd_20 compatability 162 */ 163 struct if43_cvtcmd_20_hook_t if43_cvtcmd_20_hook; 164 165 /* 166 * tty 43 ioctl compatibility 167 */ 168 struct tty_ttioctl_43_hook_t tty_ttioctl_43_hook; 169 170 /* 171 * uipc_syscalls_40 compatibility 172 */ 173 struct uipc_syscalls_40_hook_t uipc_syscalls_40_hook; 174 175 /* 176 * uipc_socket_50 compatibility 177 */ 178 struct uipc_socket_50_setopt1_hook_t uipc_socket_50_setopt1_hook; 179 struct uipc_socket_50_getopt1_hook_t uipc_socket_50_getopt1_hook; 180 struct uipc_socket_50_sbts_hook_t uipc_socket_50_sbts_hook; 181 182 /* 183 * uipc_syscalls_50 compatability 184 */ 185 struct uipc_syscalls_50_hook_t uipc_syscalls_50_hook; 186 187 /* 188 * rtsock 14 compatability 189 */ 190 struct rtsock_oifmsg_14_hook_t rtsock_oifmsg_14_hook; 191 struct rtsock_iflist_14_hook_t rtsock_iflist_14_hook; 192 193 /* 194 * rtsock 50 compatability 195 */ 196 struct rtsock_iflist_50_hook_t rtsock_iflist_50_hook; 197 struct rtsock_oifmsg_50_hook_t rtsock_oifmsg_50_hook; 198 struct rtsock_rt_missmsg_50_hook_t rtsock_rt_missmsg_50_hook; 199 struct rtsock_rt_ifmsg_50_hook_t rtsock_rt_ifmsg_50_hook; 200 struct rtsock_rt_ifannouncemsg_50_hook_t rtsock_rt_ifannouncemsg_50_hook; 201 struct rtsock_rt_addrmsg_rt_50_hook_t rtsock_rt_addrmsg_rt_50_hook; 202 struct rtsock_rt_addrmsg_src_50_hook_t rtsock_rt_addrmsg_src_50_hook; 203 struct rtsock_rt_addrmsg_50_hook_t rtsock_rt_addrmsg_50_hook; 204 struct rtsock_rt_ieee80211msg_50_hook_t rtsock_rt_ieee80211msg_50_hook; 205 206 /* 207 * rtsock 70 compatability 208 */ 209 struct rtsock_newaddr_70_hook_t rtsock_newaddr_70_hook; 210 struct rtsock_iflist_70_hook_t rtsock_iflist_70_hook; 211 212 /* 213 * modctl handler for old style OSTAT 214 */ 215 struct compat_modstat_80_hook_t compat_modstat_80_hook; 216 217 /* 218 * mask for kern_sig_43's killpg (updated by compat_09) 219 */ 220 int kern_sig_43_pgid_mask = ~0; 221 222 /* 223 * hook for kern_proc_32 224 */ 225 struct kern_proc32_copyin_hook_t kern_proc32_copyin_hook; 226 struct kern_proc32_base_hook_t kern_proc32_base_hook; 227 228 /* 229 * Hook for sparc fpu code to check if a process is running 230 * under sunos emulation 231 */ 232 struct get_emul_sunos_hook_t get_emul_sunos_hook; 233 234 /* 235 * Hook for rnd_ioctl_50 callbacks 236 */ 237 struct rnd_ioctl_50_hook_t rnd_ioctl_50_hook; 238 struct rnd_ioctl32_50_hook_t rnd_ioctl32_50_hook; 239 240 /* 241 * Hooks for compat_60 ttioctl and ptmioctl 242 */ 243 struct tty_ttioctl_60_hook_t tty_ttioctl_60_hook; 244 struct tty_ptmioctl_60_hook_t tty_ptmioctl_60_hook; 245 246 /* 247 * Hook for compat_10 openat 248 */ 249 struct vfs_openat_10_hook_t vfs_openat_10_hook; 250 251 /* 252 * Hook for compat_70_unp_addsockcred 253 */ 254 struct uipc_unp_70_hook_t uipc_unp_70_hook; 255 256 /* 257 * Hook for sysvipc50_sysctl 258 */ 259 struct sysvipc_sysctl_50_hook_t sysvipc_sysctl_50_hook; 260 261 /* 262 * ifmedia_80 compatability 263 */ 264 struct ifmedia_80_pre_hook_t ifmedia_80_pre_hook; 265 struct ifmedia_80_post_hook_t ifmedia_80_post_hook; 266 267 /* 268 * Hook for 32-bit machine name 269 * 270 * This probably would be better placed in compat/netbsd32/netbsd32_mod.c 271 * but the consumer code in linux32_exec_elf32.c is sometimes included in 272 * the main kernel, and not in a compat_netbsd32 module. (In particular, 273 * this is true for i386 and sgimips.) 274 */ 275 struct netbsd32_machine32_hook_t netbsd32_machine32_hook; 276 struct netbsd32_reg_validate_hook_t netbsd32_reg_validate_hook; 277