Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/pgoyette-compat]: src/sys Move closer to having a compat_60 module



details:   https://anonhg.NetBSD.org/src/rev/10a361a3388b
branches:  pgoyette-compat
changeset: 321054:10a361a3388b
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Sat Mar 17 00:48:19 2018 +0000

description:
Move closer to having a compat_60 module

diffstat:

 sys/compat/common/compat_60_mod.c |  70 +++++++++++++++++++++-----------------
 sys/modules/compat/Makefile       |  12 ++++++-
 sys/modules/compat_60/Makefile    |  18 +++++++--
 3 files changed, 62 insertions(+), 38 deletions(-)

diffs (169 lines):

diff -r 44356e2aa802 -r 10a361a3388b sys/compat/common/compat_60_mod.c
--- a/sys/compat/common/compat_60_mod.c Sat Mar 17 00:44:38 2018 +0000
+++ b/sys/compat/common/compat_60_mod.c Sat Mar 17 00:48:19 2018 +0000
@@ -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 @@
 #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 @@
 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,7 +70,40 @@
         { SYS_compat_60__lwp_park, 0, (sy_call_t *)compat_60_sys__lwp_park },  
         NULL, 0, NULL }
 };
+#endif /* _MODULE */
 
+int
+compat_60_init(void)
+{
+       int error;
+
+       error = syscall_establish(NULL, compat_60_syscalls);
+       if (error != 0)
+               return error;
+#ifdef CPU_UCODE
+       orig_compat_6_cpu_get_version = vec_compat6_cpu_ucode_get_version;
+       *vec_compat6_cpu_ucode_get_version = compat6_cpu_ucode_get_version;
+       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 error;
+
+#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)
 {
@@ -86,30 +119,3 @@
        }
 }
 #endif /* _MODULE */
-
-int compat_60_init(void)
-{
-       int error;
-
-       error = syscall_establish(NULL, compat_60_syscalls);
-       if (error != 0)
-               return error;
-#ifdef CPU_UCODE
-       orig_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;
-       *vec_compat6_cpu_ucode_apply = compat6_cpu_ucode_apply;
-#endif
-       return 0;
-}
-
-int compat_60_fini(void)
-{
-       int error;
-
-       *vec_compat6_cpu_ucode_get_version = orig_get_version;
-       *vec_compat6_cpu_ucode_apply = orig_apply;
-       error = syscall_disestablish(NULL, compat_60_syscalls);
-
-       return error;
-}
diff -r 44356e2aa802 -r 10a361a3388b sys/modules/compat/Makefile
--- a/sys/modules/compat/Makefile       Sat Mar 17 00:44:38 2018 +0000
+++ b/sys/modules/compat/Makefile       Sat Mar 17 00:48:19 2018 +0000
@@ -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_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>
diff -r 44356e2aa802 -r 10a361a3388b sys/modules/compat_60/Makefile
--- a/sys/modules/compat_60/Makefile    Sat Mar 17 00:44:38 2018 +0000
+++ b/sys/modules/compat_60/Makefile    Sat Mar 17 00:48:19 2018 +0000
@@ -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
+
+.if ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "i386"
+
+CPPFLAGS+=     -DCPU_UCODE
 
-SRCS+= compat_60_mod.c kern_sa_60.c tty_60.c kern_time_60.c
+.PATH: ${S}/arch/x86/x86
+
+SRCS+= cpu_ucode.c
+
+.endif
 
 .include <bsd.kmodule.mk>



Home | Main Index | Thread Index | Old Index