Source-Changes-HG archive

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

[src/pgoyette-compat]: src/sys/compat Clean-up for kern_cpu_60 code.



details:   https://anonhg.NetBSD.org/src/rev/65db40300fe7
branches:  pgoyette-compat
changeset: 321064:65db40300fe7
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Sun Mar 18 09:00:55 2018 +0000

description:
Clean-up for kern_cpu_60 code.

Also, although not strictly necessary, include the kern_sa_60 stuff in
the compat_60 module, for completeness.

Still need to deal with some tty code and the ccd driver to finish off
the compat_60 module.

diffstat:

 sys/compat/common/compat_60_mod.c |  32 +++++++++++++++++++++++++++-----
 sys/compat/common/compat_mod.h    |   6 +++---
 sys/compat/common/kern_cpu_60.c   |   7 +++----
 sys/compat/common/kern_sa_60.c    |  31 ++++++++++++++++++++++++++++++-
 sys/compat/sys/cpuio.h            |   5 ++++-
 5 files changed, 67 insertions(+), 14 deletions(-)

diffs (196 lines):

diff -r 97768f3aa931 -r 65db40300fe7 sys/compat/common/compat_60_mod.c
--- a/sys/compat/common/compat_60_mod.c Sun Mar 18 02:05:21 2018 +0000
+++ b/sys/compat/common/compat_60_mod.c Sun Mar 18 09:00:55 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_60_mod.c,v 1.1.2.6 2018/03/18 02:05:21 pgoyette Exp $   */
+/*     $NetBSD: compat_60_mod.c,v 1.1.2.7 2018/03/18 09:00:55 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.6 2018/03/18 02:05:21 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_60_mod.c,v 1.1.2.7 2018/03/18 09:00:55 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -51,11 +51,13 @@
 #include <compat/common/compat_util.h>
 #include <compat/common/compat_mod.h>
 
+#include <compat/sys/cpuio.h>
+
 #define REQUIRED_60 "compat_70"                /* XXX No compat_80 yet */
 MODULE(MODULE_CLASS_EXEC, compat_60, REQUIRED_60);
 
 int
-compat_60_init()
+compat_60_init(void)
 {
        int error = 0;
 
@@ -63,6 +65,12 @@
        if (error != 0)
                return error;
 
+       error = kern_sa_60_init();
+       if (error != 0) {
+               kern_time_60_fini();
+               return 0;
+       }
+
 #ifdef CPU_UCODE
        error = kern_cpu_60_init();
        if (error != 0) {
@@ -75,7 +83,7 @@
 }
 
 int
-compat_60_fini()
+compat_60_fini(void)
 {
        int error = 0;
 
@@ -85,9 +93,23 @@
                return error;
 #endif
 
+       error = kern_sa_60_fini();
+       if (error != 0) {
+#ifdef CPU_UCODE
+               kern_cpu_60_init();
+#endif
+               return error;
+       }
+
        error = kern_time_60_fini();
-       if (error != 0)
+       if (error != 0) {
+               kern_sa_60_init();
+#ifdef CPU_UCODE
                kern_cpu_60_init();
+#endif
+               return error;
+       }
+
 
        return error;
 }
diff -r 97768f3aa931 -r 65db40300fe7 sys/compat/common/compat_mod.h
--- a/sys/compat/common/compat_mod.h    Sun Mar 18 02:05:21 2018 +0000
+++ b/sys/compat/common/compat_mod.h    Sun Mar 18 09:00:55 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_mod.h,v 1.1.42.4 2018/03/18 02:05:21 pgoyette Exp $     */
+/*     $NetBSD: compat_mod.h,v 1.1.42.5 2018/03/18 09:00:55 pgoyette Exp $     */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -50,8 +50,8 @@
 int compat_60_fini(void);
 int kern_time_60_init(void);
 int kern_time_60_fini(void);
-int kern_cpu_60_init(void);
-int kern_cpu_60_fini(void);
+int kern_sa_60_init(void);
+int kern_sa_60_fini(void);
 int kern_tty_60_init(void);
 int kern_tty_60_fini(void);
 #endif
diff -r 97768f3aa931 -r 65db40300fe7 sys/compat/common/kern_cpu_60.c
--- a/sys/compat/common/kern_cpu_60.c   Sun Mar 18 02:05:21 2018 +0000
+++ b/sys/compat/common/kern_cpu_60.c   Sun Mar 18 09:00:55 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_cpu_60.c,v 1.1.2.3 2018/03/18 01:17:29 pgoyette Exp $     */
+/*     $NetBSD: kern_cpu_60.c,v 1.1.2.4 2018/03/18 09:00:55 pgoyette Exp $     */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_cpu_60.c,v 1.1.2.3 2018/03/18 01:17:29 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_cpu_60.c,v 1.1.2.4 2018/03/18 09:00:55 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_cpu_ucode.h"
@@ -44,9 +44,8 @@
 #include <sys/kauth.h>
 #include <sys/lwp.h>
 #include <sys/cpu.h>
-#include <sys/cpuio.h>
 
-#include <compat/common/compat_mod.h>
+#include <compat/sys/cpuio.h>
 
 static int
 compat6_cpuctl_ioctl(struct lwp *l, u_long cmd, void *data)
diff -r 97768f3aa931 -r 65db40300fe7 sys/compat/common/kern_sa_60.c
--- a/sys/compat/common/kern_sa_60.c    Sun Mar 18 02:05:21 2018 +0000
+++ b/sys/compat/common/kern_sa_60.c    Sun Mar 18 09:00:55 2018 +0000
@@ -29,12 +29,27 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(1, "$NetBSD: kern_sa_60.c,v 1.1.42.2 2018/03/16 08:10:26 pgoyette Exp $");
+__KERNEL_RCSID(1, "$NetBSD: kern_sa_60.c,v 1.1.42.3 2018/03/18 09:00:55 pgoyette Exp $");
 
 #include <sys/systm.h>
 #include <sys/syscall.h>
+#include <sys/syscallvar.h>
 #include <sys/syscallargs.h>
 
+#include <compat/common/compat_mod.h>
+
+static const struct syscall_package kern_sa_60_syscalls[] = {
+       { SYS_compat_60_sa_register, 0,
+            (sy_call_t *)compat_60_sys_sa_register },
+       { SYS_compat_60_sa_stacks, 0, (sy_call_t *)compat_60_sys_sa_stacks },
+       { SYS_compat_60_sa_enable, 0, (sy_call_t *)compat_60_sys_sa_enable },
+       { SYS_compat_60_sa_setconcurrency, 0,
+            (sy_call_t *)compat_60_sys_sa_setconcurrency },
+       { SYS_compat_60_sa_yield, 0, (sy_call_t *)compat_60_sys_sa_yield },
+       { SYS_compat_60_sa_preempt, 0, (sy_call_t *)compat_60_sys_sa_preempt },
+       { 0, 0, NULL }
+};
+
 int
 compat_60_sys_sa_register(lwp_t *l,
        const struct compat_60_sys_sa_register_args *uap,
@@ -82,3 +97,17 @@
 {
        return sys_nosys(l, uap, retval);
 }
+
+int
+kern_sa_60_init(void)
+{
+
+       return syscall_establish(NULL, kern_sa_60_syscalls);
+}
+
+int
+kern_sa_60_fini(void)
+{
+
+       return syscall_disestablish(NULL, kern_sa_60_syscalls);
+}
diff -r 97768f3aa931 -r 65db40300fe7 sys/compat/sys/cpuio.h
--- a/sys/compat/sys/cpuio.h    Sun Mar 18 02:05:21 2018 +0000
+++ b/sys/compat/sys/cpuio.h    Sun Mar 18 09:00:55 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpuio.h,v 1.5.16.3 2018/03/18 01:17:29 pgoyette Exp $ */
+/* $NetBSD: cpuio.h,v 1.5.16.4 2018/03/18 09:00:55 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -44,4 +44,7 @@
 #define OIOC_CPU_UCODE_GET_VERSION      _IOR('c', 4, struct compat6_cpu_ucode)
 #define OIOC_CPU_UCODE_APPLY            _IOW('c', 5, struct compat6_cpu_ucode)
 
+int kern_cpu_60_init(void);
+int kern_cpu_60_fini(void);
+
 #endif /* _COMPAT_SYS_CPUIO_H */



Home | Main Index | Thread Index | Old Index