Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm Move all non-emulation-specific coredump code into t...



details:   https://anonhg.NetBSD.org/src/rev/8dd0a456ae24
branches:  trunk
changeset: 1004911:8dd0a456ae24
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Wed Nov 20 19:37:51 2019 +0000

description:
Move all non-emulation-specific coredump code into the coredump module,
and remove all #ifdef COREDUMP conditional compilation.  Now, the
coredump module is completely separated from the emulation modules, and
they can all be independently loaded and unloaded.

Welcome to 9.99.18 !

diffstat:

 sys/arch/aarch64/aarch64/core_machdep.c     |  15 ++++--
 sys/arch/aarch64/aarch64/netbsd32_machdep.c |  15 ++++--
 sys/arch/aarch64/conf/files.aarch64         |   4 +-
 sys/arch/alpha/alpha/core_machdep.c         |  15 ++++--
 sys/arch/amd64/amd64/netbsd32_machdep.c     |  17 +++----
 sys/arch/arm/arm/core_machdep.c             |  15 ++++--
 sys/arch/arm/conf/files.arm                 |   4 +-
 sys/arch/hppa/hppa/core_machdep.c           |  15 ++++--
 sys/arch/ia64/conf/files.ia64               |   3 +-
 sys/arch/m68k/m68k/core_machdep.c           |  15 ++++--
 sys/arch/mips/mips/core_machdep.c           |  15 ++++--
 sys/arch/mips/mips/netbsd32_machdep.c       |  17 +++----
 sys/arch/mips/mips/vm_machdep.c             |   5 +-
 sys/arch/powerpc/powerpc/core_machdep.c     |  15 ++++--
 sys/arch/riscv/conf/files.riscv             |   4 +-
 sys/arch/riscv/riscv/core_machdep.c         |  13 +++--
 sys/arch/sh3/sh3/coff_exec.c                |  16 +------
 sys/arch/sh3/sh3/core_machdep.c             |  15 ++++--
 sys/arch/sh3/sh3/process_machdep.c          |  10 +---
 sys/arch/sparc/sparc/core_machdep.c         |  15 ++++--
 sys/arch/sparc64/sparc64/core_machdep.c     |  15 ++++--
 sys/arch/sparc64/sparc64/netbsd32_machdep.c |  17 +++----
 sys/arch/vax/vax/core_machdep.c             |  15 ++++--
 sys/arch/x86/x86/core_machdep.c             |  15 ++++--
 sys/compat/m68k4k/m68k4k_exec.c             |  12 +----
 sys/compat/netbsd32/netbsd32_core.c         |  17 +++++++-
 sys/compat/netbsd32/netbsd32_mod.c          |   6 +-
 sys/compat/vax1k/vax1k_exec.c               |   9 +---
 sys/kern/compat_stub.c                      |  11 ++++-
 sys/kern/core_elf32.c                       |  59 +++++++++++++---------------
 sys/kern/core_netbsd.c                      |  46 ++++++++-------------
 sys/kern/exec_aout.c                        |  16 +------
 sys/kern/exec_ecoff.c                       |  16 +------
 sys/kern/exec_elf32.c                       |  12 +----
 sys/kern/exec_elf64.c                       |  12 +----
 sys/kern/files.kern                         |   4 +-
 sys/kern/kern_core.c                        |  33 ++++++++++-----
 sys/kern/kern_sig.c                         |  20 ++++++++-
 sys/modules/compat_aoutm68k/Makefile        |   4 +-
 sys/modules/compat_netbsd32/Makefile        |   4 +-
 sys/modules/coredump/Makefile               |   8 +--
 sys/modules/exec_aout/Makefile              |   4 +-
 sys/modules/exec_elf32/Makefile             |   4 +-
 sys/modules/exec_elf64/Makefile             |   4 +-
 sys/sys/compat_stub.h                       |  14 +++++-
 sys/sys/exec.h                              |   6 +--
 sys/sys/param.h                             |   4 +-
 sys/sys/signalvar.h                         |   3 +-
 sys/uvm/files.uvm                           |   4 +-
 49 files changed, 328 insertions(+), 309 deletions(-)

diffs (truncated from 1846 to 300 lines):

diff -r 9c7367d613f6 -r 8dd0a456ae24 sys/arch/aarch64/aarch64/core_machdep.c
--- a/sys/arch/aarch64/aarch64/core_machdep.c   Wed Nov 20 17:29:51 2019 +0000
+++ b/sys/arch/aarch64/aarch64/core_machdep.c   Wed Nov 20 19:37:51 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: core_machdep.c,v 1.4 2018/04/01 04:35:03 ryo Exp $ */
+/* $NetBSD: core_machdep.c,v 1.5 2019/11/20 19:37:51 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,13 +31,14 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(1, "$NetBSD: core_machdep.c,v 1.4 2018/04/01 04:35:03 ryo Exp $");
+__KERNEL_RCSID(1, "$NetBSD: core_machdep.c,v 1.5 2019/11/20 19:37:51 pgoyette Exp $");
 
 #include <sys/types.h>
 #include <sys/cpu.h>
 #include <sys/exec.h>
 #include <sys/core.h>
 #include <sys/lwp.h>
+#include <sys/compat_stub.h>
 
 #include <aarch64/pcb.h>
 #include <aarch64/frame.h>
@@ -79,11 +80,13 @@
        cseg.c_addr = 0;
        cseg.c_size = chdr->c_cpusize;
 
-       error = coredump_write(iocookie, UIO_SYSSPACE, &cseg,
-                   chdr->c_seghdrsize);
+       MODULE_HOOK_CALL(coredump_write_hook, (iocookie, UIO_SYSSPACE, &cseg,
+                   chdr->c_seghdrsize), ENOSYS, error);
        if (error)
                return error;
 
-       return coredump_write(iocookie, UIO_SYSSPACE, &md_core,
-           sizeof(md_core));
+       MODULE_HOOK_CALL(coredump_write_hook, (iocookie, UIO_SYSSPACE, &md_core,
+           sizeof(md_core)), ENOSYS, error);
+
+       return error;
 }
diff -r 9c7367d613f6 -r 8dd0a456ae24 sys/arch/aarch64/aarch64/netbsd32_machdep.c
--- a/sys/arch/aarch64/aarch64/netbsd32_machdep.c       Wed Nov 20 17:29:51 2019 +0000
+++ b/sys/arch/aarch64/aarch64/netbsd32_machdep.c       Wed Nov 20 19:37:51 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_machdep.c,v 1.7 2019/07/12 06:44:49 skrll Exp $       */
+/*     $NetBSD: netbsd32_machdep.c,v 1.8 2019/11/20 19:37:51 pgoyette Exp $    */
 
 /*
  * Copyright (c) 2018 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.7 2019/07/12 06:44:49 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.8 2019/11/20 19:37:51 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -40,6 +40,7 @@
 #include <sys/ras.h>
 #include <sys/signalvar.h>
 #include <sys/syscallargs.h>
+#include <sys/compat_stub.h>
 
 #include <uvm/uvm_extern.h>
 
@@ -193,13 +194,15 @@
        cseg.c_addr = 0;
        cseg.c_size = chdr->c_cpusize;
 
-       error = coredump_write(iocookie, UIO_SYSSPACE,
-           &cseg, chdr->c_seghdrsize);
+       MODULE_HOOK_CALL(coredump_write_hook, (iocookie, UIO_SYSSPACE,
+           &cseg, chdr->c_seghdrsize), ENOSYS, error);
        if (error)
                return error;
 
-       return coredump_write(iocookie, UIO_SYSSPACE,
-           &md_core32, sizeof(md_core32));
+       MODULE_HOOK_CALL(coredump_write_hook, (iocookie, UIO_SYSSPACE,
+           &md_core32, sizeof(md_core32)), ENOSYS, error);
+
+       return error;
 }
 
 static void
diff -r 9c7367d613f6 -r 8dd0a456ae24 sys/arch/aarch64/conf/files.aarch64
--- a/sys/arch/aarch64/conf/files.aarch64       Wed Nov 20 17:29:51 2019 +0000
+++ b/sys/arch/aarch64/conf/files.aarch64       Wed Nov 20 19:37:51 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.aarch64,v 1.13 2019/01/27 02:08:36 pgoyette Exp $
+#      $NetBSD: files.aarch64,v 1.14 2019/11/20 19:37:51 pgoyette Exp $
 
 defflag opt_cpuoptions.h       AARCH64_ALIGNMENT_CHECK
 defflag opt_cpuoptions.h       AARCH64_EL0_STACK_ALIGNMENT_CHECK
@@ -88,7 +88,7 @@
 file   arch/arm/arm/bootconfig.c
 file   arch/aarch64/aarch64/aarch64_machdep.c
 file   arch/aarch64/aarch64/aarch64_reboot.c
-file   arch/aarch64/aarch64/core_machdep.c
+file   arch/aarch64/aarch64/core_machdep.c             coredump
 file   arch/aarch64/aarch64/copyinout.S
 file   arch/aarch64/aarch64/cpu_in_cksum.S             (inet | inet6) & cpu_in_cksum
 file   arch/aarch64/aarch64/cpu_machdep.c
diff -r 9c7367d613f6 -r 8dd0a456ae24 sys/arch/alpha/alpha/core_machdep.c
--- a/sys/arch/alpha/alpha/core_machdep.c       Wed Nov 20 17:29:51 2019 +0000
+++ b/sys/arch/alpha/alpha/core_machdep.c       Wed Nov 20 19:37:51 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: core_machdep.c,v 1.9 2014/05/16 19:18:21 matt Exp $ */
+/* $NetBSD: core_machdep.c,v 1.10 2019/11/20 19:37:51 pgoyette Exp $ */
 
 /*
  * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@@ -29,7 +29,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: core_machdep.c,v 1.9 2014/05/16 19:18:21 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: core_machdep.c,v 1.10 2019/11/20 19:37:51 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -39,6 +39,7 @@
 #include <sys/vnode.h>
 #include <sys/core.h>
 #include <sys/exec.h>
+#include <sys/compat_stub.h>
 
 #include <sys/exec_aout.h>
 
@@ -79,11 +80,13 @@
        cseg.c_addr = 0;
        cseg.c_size = chdr->c_cpusize;
 
-       error = coredump_write(iocookie, UIO_SYSSPACE, &cseg,
-           chdr->c_seghdrsize);
+       MODULE_HOOK_CALL(coredump_write_hook, (iocookie, UIO_SYSSPACE, &cseg,
+           chdr->c_seghdrsize), ENOSYS, error);
        if (error)
                return error;
 
-       return coredump_write(iocookie, UIO_SYSSPACE, &cpustate,
-           sizeof(cpustate));
+       MODULE_HOOK_CALL(coredump_write_hook, (iocookie, UIO_SYSSPACE,
+           &cpustate, sizeof(cpustate)), ENOSYS, error);
+
+       return error;
 }
diff -r 9c7367d613f6 -r 8dd0a456ae24 sys/arch/amd64/amd64/netbsd32_machdep.c
--- a/sys/arch/amd64/amd64/netbsd32_machdep.c   Wed Nov 20 17:29:51 2019 +0000
+++ b/sys/arch/amd64/amd64/netbsd32_machdep.c   Wed Nov 20 19:37:51 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_machdep.c,v 1.130 2019/11/20 10:57:08 rin Exp $       */
+/*     $NetBSD: netbsd32_machdep.c,v 1.131 2019/11/20 19:37:51 pgoyette Exp $  */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,12 +36,11 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.130 2019/11/20 10:57:08 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.131 2019/11/20 19:37:51 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
 #include "opt_compat_netbsd32.h"
-#include "opt_coredump.h"
 #include "opt_execfmt.h"
 #include "opt_user_ldt.h"
 #include "opt_mtrr.h"
@@ -283,7 +282,6 @@
            netbsd32_sendsig_siginfo(ksi, mask));
 }
 
-#ifdef COREDUMP
 /*
  * Dump the machine specific segment at the start of a core dump.
  */
@@ -323,15 +321,16 @@
        cseg.c_addr = 0;
        cseg.c_size = chdr->c_cpusize;
 
-       error = coredump_write(iocookie, UIO_SYSSPACE, &cseg,
-           chdr->c_seghdrsize);
+       MODULE_HOOK_CALL(coredump_write_hook, (iocookie, UIO_SYSSPACE, &cseg,
+           chdr->c_seghdrsize), ENOSYS, error);
        if (error)
                return error;
 
-       return coredump_write(iocookie, UIO_SYSSPACE, &md_core,
-           sizeof(md_core));
+       MODULE_HOOK_CALL(coredump_write_hook, (iocookie, UIO_SYSSPACE, &md_core,
+           sizeof(md_core)), ENOSYS, error);
+
+       return error;
 }
-#endif
 
 int
 netbsd32_ptrace_translate_request(int req)
diff -r 9c7367d613f6 -r 8dd0a456ae24 sys/arch/arm/arm/core_machdep.c
--- a/sys/arch/arm/arm/core_machdep.c   Wed Nov 20 17:29:51 2019 +0000
+++ b/sys/arch/arm/arm/core_machdep.c   Wed Nov 20 19:37:51 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: core_machdep.c,v 1.8 2015/04/27 06:54:12 skrll Exp $   */
+/*     $NetBSD: core_machdep.c,v 1.9 2019/11/20 19:37:51 pgoyette Exp $        */
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -37,7 +37,7 @@
 
 #include <sys/param.h>
 
-__KERNEL_RCSID(0, "$NetBSD: core_machdep.c,v 1.8 2015/04/27 06:54:12 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: core_machdep.c,v 1.9 2019/11/20 19:37:51 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_execfmt.h"
@@ -53,6 +53,7 @@
 #include <sys/systm.h>
 #include <sys/uio.h>
 #include <sys/vnode.h>
+#include <sys/compat_stub.h>
 
 #include <sys/exec_aout.h>     /* for MID_* */
 
@@ -104,13 +105,15 @@
        cseg.c_addr = 0;
        cseg.c_size = chdr->c_cpusize;
 
-       error = coredump_write(iocookie, UIO_SYSSPACE,
-           &cseg, chdr->c_seghdrsize);
+       MODULE_HOOK_CALL(coredump_write_hook, (iocookie, UIO_SYSSPACE,
+           &cseg, chdr->c_seghdrsize), ENOSYS, error);
        if (error)
                return error;
 
-       return coredump_write(iocookie, UIO_SYSSPACE,
-           &cpustate, sizeof(cpustate));
+       MODULE_HOOK_CALL(coredump_write_hook, (iocookie, UIO_SYSSPACE,
+           &cpustate, sizeof(cpustate)), ENOSYS, error);
+
+       return error;
 }
 
 #ifdef EXEC_ELF32
diff -r 9c7367d613f6 -r 8dd0a456ae24 sys/arch/arm/conf/files.arm
--- a/sys/arch/arm/conf/files.arm       Wed Nov 20 17:29:51 2019 +0000
+++ b/sys/arch/arm/conf/files.arm       Wed Nov 20 19:37:51 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.arm,v 1.148 2019/01/27 02:08:37 pgoyette Exp $
+#      $NetBSD: files.arm,v 1.149 2019/11/20 19:37:52 pgoyette Exp $
 
 # temporary define to allow easy moving to ../arch/arm/arm32
 defflag                                ARM32
@@ -162,7 +162,7 @@
 file   arch/arm/arm/compat_13_machdep.c        compat_13
 file   arch/arm/arm/compat_16_machdep.c        compat_16
 file   arch/arm/arm/copystr.S
-file   arch/arm/arm/core_machdep.c
+file   arch/arm/arm/core_machdep.c             coredump
 file   arch/arm/arm/cpu_in_cksum.S             (inet | inet6) & cpu_in_cksum
 file   arch/arm/arm/cpufunc.c
 file   arch/arm/arm/cpufunc_asm.S
diff -r 9c7367d613f6 -r 8dd0a456ae24 sys/arch/hppa/hppa/core_machdep.c
--- a/sys/arch/hppa/hppa/core_machdep.c Wed Nov 20 17:29:51 2019 +0000
+++ b/sys/arch/hppa/hppa/core_machdep.c Wed Nov 20 19:37:51 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: core_machdep.c,v 1.6 2014/01/04 00:10:02 dsl Exp $     */
+/*     $NetBSD: core_machdep.c,v 1.7 2019/11/20 19:37:52 pgoyette Exp $        */
 
 /*     $OpenBSD: vm_machdep.c,v 1.25 2001/09/19 20:50:56 mickey Exp $  */
 
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: core_machdep.c,v 1.6 2014/01/04 00:10:02 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: core_machdep.c,v 1.7 2019/11/20 19:37:52 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -41,6 +41,7 @@
 #include <sys/ptrace.h>
 #include <sys/exec.h>
 #include <sys/core.h>
+#include <sys/compat_stub.h>
 
 #include <sys/exec_aout.h>
 
@@ -85,11 +86,13 @@
        cseg.c_addr = 0;
        cseg.c_size = core->c_cpusize;
 
-       error = coredump_write(iocookie, UIO_SYSSPACE, &cseg,
-           core->c_seghdrsize);



Home | Main Index | Thread Index | Old Index