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 getting a compat_60 module - st...



details:   https://anonhg.NetBSD.org/src/rev/36e81e4994c4
branches:  pgoyette-compat
changeset: 321048:36e81e4994c4
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Fri Mar 16 08:10:26 2018 +0000

description:
Move closer to getting a compat_60 module - still needs more work

diffstat:

 sys/compat/common/compat_60_mod.c |  66 ++++++++++++++++++++++++--------------
 sys/compat/common/compat_70_mod.c |  11 ++++--
 sys/compat/common/compat_mod.c    |  11 ++++--
 sys/compat/common/compat_mod.h    |   6 +-
 sys/compat/common/files.common    |   4 +-
 sys/compat/common/kern_sa_60.c    |  22 +------------
 sys/compat/net/route_70.h         |   4 +-
 sys/kern/kern_cpu.c               |   6 ++-
 sys/modules/compat_60/Makefile    |   4 +-
 sys/sys/cpu.h                     |   8 ++++-
 10 files changed, 78 insertions(+), 64 deletions(-)

diffs (truncated from 375 to 300 lines):

diff -r 989224543cb1 -r 36e81e4994c4 sys/compat/common/compat_60_mod.c
--- a/sys/compat/common/compat_60_mod.c Fri Mar 16 02:55:20 2018 +0000
+++ b/sys/compat/common/compat_60_mod.c Fri Mar 16 08:10:26 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_60_mod.c,v 1.1.2.2 2018/03/16 01:16:29 pgoyette Exp $   */
+/*     $NetBSD: compat_60_mod.c,v 1.1.2.3 2018/03/16 08:10:26 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.2 2018/03/16 01:16:29 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_60_mod.c,v 1.1.2.3 2018/03/16 08:10:26 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -44,18 +44,20 @@
 #include <sys/systm.h>
 #include <sys/module.h>
 #include <sys/sysctl.h>
-
-#include <net/if.h>
-#include <net/route.h>
+#include <sys/syscall.h>
+#include <sys/syscallvar.h>
+#include <sys/syscallargs.h>
 
 #include <compat/common/compat_util.h>
 #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_sys__lwp_park },
+       { SYS_compat_60__lwp_park, 0, (sy_call_t *)compat_60__lwp_park },
        { NULL, 0, NULL }
 };
 
+#ifdef _MODULE
+
 #define REQUIRED_60 "compat_70"                /* XXX No compat_80 yet */
 MODULE(MODULE_CLASS_EXEC, compat_60, REQUIRED_60);
 
@@ -64,6 +66,11 @@
 int (*orig_compat6_cpu_ucode_apply)(const struct compat6_cpu_ucode *);
 #endif
 
+static const struct syscall_package compat__60_syscalls[] = {
+        { 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)
 {
@@ -71,29 +78,38 @@
 
        switch (cmd) {
        case MODULE_CMD_INIT:
-               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;
-
+               return compat_60_init();
        case MODULE_CMD_FINI:
-               *vec_compat6_cpu_ucode_get_version = orig_get_version;
-               *vec_compat6_cpu_ucode_apply = orig_apply;
-               error = syscall_disestablish(NULL, compat_60_syscalls);
-               if (error != 0)
-                       return error;
-               return 0;
-
+               return compat_60_init();
        default:
                return ENOTTY;
        }
 }
+#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 989224543cb1 -r 36e81e4994c4 sys/compat/common/compat_70_mod.c
--- a/sys/compat/common/compat_70_mod.c Fri Mar 16 02:55:20 2018 +0000
+++ b/sys/compat/common/compat_70_mod.c Fri Mar 16 08:10:26 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_70_mod.c,v 1.1.2.3 2018/03/16 01:16:29 pgoyette Exp $   */
+/*     $NetBSD: compat_70_mod.c,v 1.1.2.4 2018/03/16 08:10:26 pgoyette Exp $   */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: compat_70_mod.c,v 1.1.2.3 2018/03/16 01:16:29 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_70_mod.c,v 1.1.2.4 2018/03/16 08:10:26 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -54,8 +54,6 @@
 #include <compat/net/route.h>
 #include <compat/net/route_70.h>
 
-MODULE(MODULE_CLASS_EXEC, compat_70, NULL);    /* XXX No compat_80 yet */
-
 void compat_70_init(void)
 {
 
@@ -70,6 +68,10 @@
        vec_ocreds_valid = false;
 }
 
+#ifdef _MODULE
+
+MODULE(MODULE_CLASS_EXEC, compat_70, NULL);    /* XXX No compat_80 yet */
+
 static int
 compat_70_modcmd(modcmd_t cmd, void *arg)
 {
@@ -87,3 +89,4 @@
                return ENOTTY;
        }
 }
+#endif /* _MODULE */
diff -r 989224543cb1 -r 36e81e4994c4 sys/compat/common/compat_mod.c
--- a/sys/compat/common/compat_mod.c    Fri Mar 16 02:55:20 2018 +0000
+++ b/sys/compat/common/compat_mod.c    Fri Mar 16 08:10:26 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_mod.c,v 1.24.14.12 2018/03/16 01:16:29 pgoyette Exp $   */
+/*     $NetBSD: compat_mod.c,v 1.24.14.13 2018/03/16 08:10:26 pgoyette Exp $   */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.24.14.12 2018/03/16 01:16:29 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.24.14.13 2018/03/16 08:10:26 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -79,6 +79,7 @@
 #endif
 
 #ifdef COMPAT_70
+#include <net/route.h>
 #include <compat/net/route.h>
 #include <compat/net/route_70.h>
 #endif
@@ -285,7 +286,8 @@
                if_50_init();
 #endif
 #ifdef COMPAT_60
-               compat_60_init();
+               if ((error = compat_60_init()) != 0)
+                       return error;
 #endif
 #ifdef COMPAT_70
                compat_70_init();
@@ -297,7 +299,8 @@
                compat_70_fini();
 #endif
 #ifdef COMPAT_60
-               compat_60_fini();
+               if ((error = compat_60_fini()) != 0)
+                       return error;
 #endif
 #ifdef COMPAT_10
                vfs_syscalls_10_fini();
diff -r 989224543cb1 -r 36e81e4994c4 sys/compat/common/compat_mod.h
--- a/sys/compat/common/compat_mod.h    Fri Mar 16 02:55:20 2018 +0000
+++ b/sys/compat/common/compat_mod.h    Fri Mar 16 08:10:26 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_mod.h,v 1.1.42.1 2018/03/16 01:16:29 pgoyette Exp $     */
+/*     $NetBSD: compat_mod.h,v 1.1.42.2 2018/03/16 08:10:26 pgoyette Exp $     */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
 void compat_70_init(void);
 void compat_70_fini(void);
 
-void compat_60_init(void);
-void compat_60_fini(void);
+int compat_60_init(void);
+int compat_60_fini(void);
 
 #endif /* !_COMPAT_MOD_H_ */
diff -r 989224543cb1 -r 36e81e4994c4 sys/compat/common/files.common
--- a/sys/compat/common/files.common    Fri Mar 16 02:55:20 2018 +0000
+++ b/sys/compat/common/files.common    Fri Mar 16 08:10:26 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.common,v 1.1.2.10 2018/03/15 11:17:54 pgoyette Exp $
+#      $NetBSD: files.common,v 1.1.2.11 2018/03/16 08:10:26 pgoyette Exp $
 
 #
 # Generic files, used by all compat options.
@@ -66,11 +66,13 @@
 file   compat/common/uvm_50.c                  compat_50
 
 # Compatibility code for NetBSD 6.0
+file   compat/common/compat_60_mod.c           compat_60
 file   compat/common/kern_sa_60.c              compat_60
 file   compat/common/tty_60.c                  compat_60
 file   compat/common/kern_time_60.c            compat_60
 
 # Compatibility code for NetBSD 7.0
+file   compat/common/compat_70_mod.c           compat_70
 file   compat/common/rtsock_70.c               compat_70
 file   compat/common/uipc_usrreq_70.c          compat_70
 
diff -r 989224543cb1 -r 36e81e4994c4 sys/compat/common/kern_sa_60.c
--- a/sys/compat/common/kern_sa_60.c    Fri Mar 16 02:55:20 2018 +0000
+++ b/sys/compat/common/kern_sa_60.c    Fri Mar 16 08:10:26 2018 +0000
@@ -29,7 +29,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(1, "$NetBSD: kern_sa_60.c,v 1.1.42.1 2018/03/16 01:16:29 pgoyette Exp $");
+__KERNEL_RCSID(1, "$NetBSD: kern_sa_60.c,v 1.1.42.2 2018/03/16 08:10:26 pgoyette Exp $");
 
 #include <sys/systm.h>
 #include <sys/syscall.h>
@@ -82,23 +82,3 @@
 {
        return sys_nosys(l, uap, retval);
 }
-
-static const struct syscall_package compat__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 },
-       { SYS_compat_60_lwp_park, 0, (sy_call_t *)
-
-
-62      COMPAT_43 MODULAR compat        \
-                { int|sys||fstat(int fd, struct stat43 *sb); } fstat43
-
-       { SYS_compat_43_fstat43, 0, (sy_call_t *)compat_43_sys_fstat },
-
-
-
diff -r 989224543cb1 -r 36e81e4994c4 sys/compat/net/route_70.h
--- a/sys/compat/net/route_70.h Fri Mar 16 02:55:20 2018 +0000
+++ b/sys/compat/net/route_70.h Fri Mar 16 08:10:26 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: route_70.h,v 1.1.2.1 2018/03/15 05:10:05 pgoyette Exp $        */
+/*     $NetBSD: route_70.h,v 1.1.2.2 2018/03/16 08:10:26 pgoyette Exp $        */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -32,6 +32,8 @@
 #ifndef _COMPAT_NET_ROUTE_70_H_
 #define _COMPAT_NET_ROUTE_70_H_
 
+#include <net/route.h>
+
 /* compat interfaces */
 
 void rtsock_70_init(void);
diff -r 989224543cb1 -r 36e81e4994c4 sys/kern/kern_cpu.c
--- a/sys/kern/kern_cpu.c       Fri Mar 16 02:55:20 2018 +0000



Home | Main Index | Thread Index | Old Index