Module Name: src Committed By: pgoyette Date: Sat Mar 17 00:48:20 UTC 2018
Modified Files: src/sys/compat/common [pgoyette-compat]: compat_60_mod.c src/sys/modules/compat [pgoyette-compat]: Makefile src/sys/modules/compat_60 [pgoyette-compat]: Makefile Log Message: Move closer to having a compat_60 module To generate a diff of this commit: cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/sys/compat/common/compat_60_mod.c cvs rdiff -u -r1.14.14.1 -r1.14.14.2 src/sys/modules/compat/Makefile cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/sys/modules/compat_60/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/compat/common/compat_60_mod.c diff -u src/sys/compat/common/compat_60_mod.c:1.1.2.3 src/sys/compat/common/compat_60_mod.c:1.1.2.4 --- src/sys/compat/common/compat_60_mod.c:1.1.2.3 Fri Mar 16 08:10:26 2018 +++ src/sys/compat/common/compat_60_mod.c Sat Mar 17 00:48:19 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: compat_60_mod.c,v 1.1.2.3 2018/03/16 08:10:26 pgoyette Exp $ */ +/* $NetBSD: compat_60_mod.c,v 1.1.2.4 2018/03/17 00:48:19 pgoyette Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: compat_60_mod.c,v 1.1.2.3 2018/03/16 08:10:26 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: compat_60_mod.c,v 1.1.2.4 2018/03/17 00:48:19 pgoyette Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -52,8 +52,8 @@ __KERNEL_RCSID(0, "$NetBSD: compat_60_mo #include <compat/common/compat_mod.h> static const struct syscall_package compat_60_syscalls[] = { - { SYS_compat_60__lwp_park, 0, (sy_call_t *)compat_60__lwp_park }, - { NULL, 0, NULL } + { SYS_compat_60__lwp_park, 0, (sy_call_t *)compat_60_sys__lwp_park }, + { 0, 0, NULL } }; #ifdef _MODULE @@ -62,7 +62,7 @@ static const struct syscall_package comp MODULE(MODULE_CLASS_EXEC, compat_60, REQUIRED_60); #ifdef CPU_UCODE -int (*orig_compat_6_cpu_ucode)(struct compat6_cpu_ucode *); +int (*orig_compat_6_cpu_get_version)(struct compat6_cpu_ucode *); int (*orig_compat6_cpu_ucode_apply)(const struct compat6_cpu_ucode *); #endif @@ -70,24 +70,10 @@ static const struct syscall_package comp { SYS_compat_60__lwp_park, 0, (sy_call_t *)compat_60_sys__lwp_park }, NULL, 0, NULL } }; - -static int -compat_60_modcmd(modcmd_t cmd, void *arg) -{ - int error; - - switch (cmd) { - case MODULE_CMD_INIT: - return compat_60_init(); - case MODULE_CMD_FINI: - return compat_60_init(); - default: - return ENOTTY; - } -} #endif /* _MODULE */ -int compat_60_init(void) +int +compat_60_init(void) { int error; @@ -95,21 +81,41 @@ int compat_60_init(void) if (error != 0) return error; #ifdef CPU_UCODE - orig_get_version = vec_compat6_cpu_ucode_get_version; + orig_compat_6_cpu_get_version = vec_compat6_cpu_ucode_get_version; *vec_compat6_cpu_ucode_get_version = compat6_cpu_ucode_get_version; - orig_apply = vec_compat6_cpu_ucode_apply; + orig_compat6_cpu_ucode_apply = vec_compat6_cpu_ucode_apply; *vec_compat6_cpu_ucode_apply = compat6_cpu_ucode_apply; #endif return 0; } -int compat_60_fini(void) +int +compat_60_fini(void) { int error; - *vec_compat6_cpu_ucode_get_version = orig_get_version; - *vec_compat6_cpu_ucode_apply = orig_apply; +#ifdef CPU_UCODE + *vec_compat6_cpu_ucode_get_version = orig_compat_6_cpu_get_version; + *vec_compat6_cpu_ucode_apply = orig_compat6_cpu_ucode_apply; +#endif error = syscall_disestablish(NULL, compat_60_syscalls); return error; } + +#ifdef _MODULE +static int +compat_60_modcmd(modcmd_t cmd, void *arg) +{ + int error; + + switch (cmd) { + case MODULE_CMD_INIT: + return compat_60_init(); + case MODULE_CMD_FINI: + return compat_60_init(); + default: + return ENOTTY; + } +} +#endif /* _MODULE */ Index: src/sys/modules/compat/Makefile diff -u src/sys/modules/compat/Makefile:1.14.14.1 src/sys/modules/compat/Makefile:1.14.14.2 --- src/sys/modules/compat/Makefile:1.14.14.1 Thu Mar 8 09:54:36 2018 +++ src/sys/modules/compat/Makefile Sat Mar 17 00:48:20 2018 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.14.14.1 2018/03/08 09:54:36 pgoyette Exp $ +# $NetBSD: Makefile,v 1.14.14.2 2018/03/17 00:48:20 pgoyette Exp $ .include "../Makefile.inc" @@ -45,4 +45,14 @@ SRCS+= compat_13_machdep.c SRCS+= compat_16_machdep.c .endif +.if ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "i386" + +CPPFLAGS+= -DCPU_UCODE + +.PATH: ${S}/arch/x86/x86 + +SRCS+= cpu_ucode.c + +.endif + .include <bsd.kmodule.mk> Index: src/sys/modules/compat_60/Makefile diff -u src/sys/modules/compat_60/Makefile:1.1.2.3 src/sys/modules/compat_60/Makefile:1.1.2.4 --- src/sys/modules/compat_60/Makefile:1.1.2.3 Fri Mar 16 08:10:27 2018 +++ src/sys/modules/compat_60/Makefile Sat Mar 17 00:48:20 2018 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.1.2.3 2018/03/16 08:10:27 pgoyette Exp $ +# $NetBSD: Makefile,v 1.1.2.4 2018/03/17 00:48:20 pgoyette Exp $ .include "../Makefile.inc" @@ -6,13 +6,21 @@ KMOD= compat_60 -CPPFLAGS+= -D COMPAT_60 -DCOMPAT_70 -DCOMPAT_80 +CPPFLAGS+= -DCOMPAT_60 -DCOMPAT_70 -DCOMPAT_80 + +SRCS+= compat_60_mod.c kern_sa_60.c tty_60.c kern_time_60.c # If being built for amd64, i386, or XEN3_DOM0 (but _not_ DOMU), we # need to add -# -# SRCS+= CPU_UCODE -SRCS+= compat_60_mod.c kern_sa_60.c tty_60.c kern_time_60.c +.if ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "i386" + +CPPFLAGS+= -DCPU_UCODE + +.PATH: ${S}/arch/x86/x86 + +SRCS+= cpu_ucode.c + +.endif .include <bsd.kmodule.mk>