Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm ddb/db_active.h: New home for extern db_active.



details:   https://anonhg.NetBSD.org/src/rev/fe5dbe0f66a4
branches:  trunk
changeset: 372074:fe5dbe0f66a4
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed Oct 26 23:38:05 2022 +0000

description:
ddb/db_active.h: New home for extern db_active.

This can be included unconditionally, and db_active can then be
queried unconditionally; if DDB is not in the kernel, then db_active
is a constant zero.  Reduces need for #include opt_ddb.h, #ifdef DDB.

diffstat:

 sys/arch/aarch64/aarch64/db_machdep.c      |   5 +-
 sys/arch/alpha/alpha/db_interface.c        |   5 +-
 sys/arch/amd64/amd64/db_interface.c        |   5 +-
 sys/arch/amd64/amd64/machdep.c             |  13 ++---
 sys/arch/amiga/dev/ser.c                   |   8 +-
 sys/arch/arm/amlogic/meson_uart.c          |  12 ++---
 sys/arch/arm/arm32/db_interface.c          |   7 ++-
 sys/arch/arm/at91/at91dbgu.c               |  19 ++-----
 sys/arch/arm/at91/at91usart.c              |  17 +++----
 sys/arch/arm/clps711x/clpscom.c            |  15 ++----
 sys/arch/arm/ep93xx/epcom.c                |  20 ++++----
 sys/arch/arm/imx/imxuart.c                 |  13 ++---
 sys/arch/arm/s3c2xx0/sscom.c               |  12 ++---
 sys/arch/arm/sa11x0/sa11x0_com.c           |   7 +-
 sys/arch/arm/samsung/exynos_uart.c         |  12 ++---
 sys/arch/arm/xilinx/zynq_uart.c            |  18 ++++----
 sys/arch/arm/zynq/zynq_uart.c              |  12 ++--
 sys/arch/epoc32/windermere/wmcom.c         |   9 +--
 sys/arch/evbarm/dev/plcom.c                |  11 ++--
 sys/arch/hppa/hppa/db_interface.c          |   6 +-
 sys/arch/i386/i386/db_interface.c          |   5 +-
 sys/arch/i386/i386/machdep.c               |  13 ++---
 sys/arch/ia64/ia64/db_interface.c          |   5 +-
 sys/arch/m68k/m68k/db_interface.c          |  23 ++++-----
 sys/arch/mips/mips/db_interface.c          |   5 +-
 sys/arch/powerpc/powerpc/db_interface.c    |   5 +-
 sys/arch/riscv/riscv/db_interface.c        |   6 +-
 sys/arch/sh3/sh3/db_interface.c            |   6 +-
 sys/arch/sparc/sparc/db_interface.c        |   5 +-
 sys/arch/sparc64/dev/zs.c                  |  20 ++++----
 sys/arch/sparc64/sparc64/db_interface.c    |   5 +-
 sys/arch/sparc64/sparc64/machdep.c         |  13 ++---
 sys/arch/sun2/dev/zs.c                     |  67 +++++++++++++----------------
 sys/arch/vax/vax/db_machdep.c              |  42 +++++++++---------
 sys/arch/x86/x86/intr.c                    |   7 +-
 sys/ddb/db_active.h                        |  44 +++++++++++++++++++
 sys/dev/ic/com.c                           |  10 +--
 sys/external/bsd/drm2/include/linux/kgdb.h |  20 +-------
 sys/kern/subr_msan.c                       |   8 +-
 sys/kern/uipc_socket2.c                    |   6 +-
 sys/uvm/uvm_page.c                         |  13 ++---
 41 files changed, 274 insertions(+), 280 deletions(-)

diffs (truncated from 1849 to 300 lines):

diff -r f30acb786dda -r fe5dbe0f66a4 sys/arch/aarch64/aarch64/db_machdep.c
--- a/sys/arch/aarch64/aarch64/db_machdep.c     Wed Oct 26 23:28:42 2022 +0000
+++ b/sys/arch/aarch64/aarch64/db_machdep.c     Wed Oct 26 23:38:05 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_machdep.c,v 1.44 2022/05/29 16:45:00 ryo Exp $ */
+/* $NetBSD: db_machdep.c,v 1.45 2022/10/26 23:38:05 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.44 2022/05/29 16:45:00 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.45 2022/10/26 23:38:05 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd32.h"
@@ -55,6 +55,7 @@
 #include <arm/cpufunc.h>
 
 #include <ddb/db_access.h>
+#include <ddb/db_active.h>
 #include <ddb/db_command.h>
 #include <ddb/db_output.h>
 #include <ddb/db_proc.h>
diff -r f30acb786dda -r fe5dbe0f66a4 sys/arch/alpha/alpha/db_interface.c
--- a/sys/arch/alpha/alpha/db_interface.c       Wed Oct 26 23:28:42 2022 +0000
+++ b/sys/arch/alpha/alpha/db_interface.c       Wed Oct 26 23:38:05 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_interface.c,v 1.36 2021/02/23 07:13:51 mrg Exp $ */
+/* $NetBSD: db_interface.c,v 1.37 2022/10/26 23:38:05 riastradh Exp $ */
 
 /*
  * Mach Operating System
@@ -52,7 +52,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.36 2021/02/23 07:13:51 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.37 2022/10/26 23:38:05 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -68,6 +68,7 @@
 
 #include <alpha/alpha/db_instruction.h>
 
+#include <ddb/db_active.h>
 #include <ddb/db_sym.h>
 #include <ddb/db_command.h>
 #include <ddb/db_extern.h>
diff -r f30acb786dda -r fe5dbe0f66a4 sys/arch/amd64/amd64/db_interface.c
--- a/sys/arch/amd64/amd64/db_interface.c       Wed Oct 26 23:28:42 2022 +0000
+++ b/sys/arch/amd64/amd64/db_interface.c       Wed Oct 26 23:38:05 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_interface.c,v 1.40 2021/12/23 02:07:21 yamaguchi Exp $      */
+/*     $NetBSD: db_interface.c,v 1.41 2022/10/26 23:38:06 riastradh Exp $      */
 
 /*
  * Mach Operating System
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.40 2021/12/23 02:07:21 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.41 2022/10/26 23:38:06 riastradh Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -60,6 +60,7 @@
 #include <machine/i82489var.h>
 #endif
 
+#include <ddb/db_active.h>
 #include <ddb/db_sym.h>
 #include <ddb/db_command.h>
 #include <ddb/db_extern.h>
diff -r f30acb786dda -r fe5dbe0f66a4 sys/arch/amd64/amd64/machdep.c
--- a/sys/arch/amd64/amd64/machdep.c    Wed Oct 26 23:28:42 2022 +0000
+++ b/sys/arch/amd64/amd64/machdep.c    Wed Oct 26 23:38:05 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.365 2022/10/26 23:23:52 riastradh Exp $  */
+/*     $NetBSD: machdep.c,v 1.366 2022/10/26 23:38:06 riastradh Exp $  */
 
 /*
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -110,7 +110,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.365 2022/10/26 23:23:52 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.366 2022/10/26 23:38:06 riastradh Exp $");
 
 #include "opt_modular.h"
 #include "opt_user_ldt.h"
@@ -204,6 +204,8 @@
 #include <xen/include/public/vcpu.h>
 #endif /* XEN */
 
+#include <ddb/db_active.h>
+
 #ifdef DDB
 #include <machine/db_machdep.h>
 #include <ddb/db_extern.h>
@@ -701,12 +703,7 @@
                       vfs_unmount_forceone(curlwp))
                        ;       /* do nothing */
        } else {
-               int ddb = 0;
-#ifdef DDB
-               extern int db_active; /* XXX */
-               ddb = db_active;
-#endif
-               if (!ddb)
+               if (!db_active)
                        suspendsched();
        }
 
diff -r f30acb786dda -r fe5dbe0f66a4 sys/arch/amiga/dev/ser.c
--- a/sys/arch/amiga/dev/ser.c  Wed Oct 26 23:28:42 2022 +0000
+++ b/sys/arch/amiga/dev/ser.c  Wed Oct 26 23:38:05 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ser.c,v 1.85 2022/10/04 07:24:32 rin Exp $ */
+/*     $NetBSD: ser.c,v 1.86 2022/10/26 23:38:06 riastradh Exp $ */
 
 /*
  * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
@@ -40,7 +40,7 @@
 #include "opt_kgdb.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ser.c,v 1.85 2022/10/04 07:24:32 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ser.c,v 1.86 2022/10/26 23:38:06 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -64,6 +64,8 @@
 
 #include <dev/cons.h>
 
+#include <ddb/db_active.h>
+
 #include "ser.h"
 #if NSER > 0
 
@@ -605,8 +607,6 @@
                break_in_progress = 1;
 #ifdef DDB
                if (serconsole == 0) {
-                       extern int db_active;
-
                        if (!db_active) {
                                console_debugger();
                                return;
diff -r f30acb786dda -r fe5dbe0f66a4 sys/arch/arm/amlogic/meson_uart.c
--- a/sys/arch/arm/amlogic/meson_uart.c Wed Oct 26 23:28:42 2022 +0000
+++ b/sys/arch/arm/amlogic/meson_uart.c Wed Oct 26 23:38:05 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: meson_uart.c,v 1.6 2021/02/12 21:39:55 ryo Exp $ */
+/* $NetBSD: meson_uart.c,v 1.7 2022/10/26 23:38:06 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(1, "$NetBSD: meson_uart.c,v 1.6 2021/02/12 21:39:55 ryo Exp $");
+__KERNEL_RCSID(1, "$NetBSD: meson_uart.c,v 1.7 2022/10/26 23:38:06 riastradh Exp $");
 
 #define cn_trap()                      \
        do {                            \
@@ -54,6 +54,8 @@
 #include <sys/lwp.h>
 #include <sys/tty.h>
 
+#include <ddb/db_active.h>
+
 #include <dev/cons.h>
 
 #include <dev/fdt/fdtvar.h>
@@ -261,11 +263,7 @@
        }
 
        c = bus_space_read_4(bst, bsh, UART_RFIFO_REG) & 0xff;
-#if defined(DDB)
-       extern int db_active;
-       if (!db_active)
-#endif
-       {
+       if (!db_active) {
                int cn_trapped __unused = 0;
                cn_check_magic(dev, c, meson_uart_cnm_state);
        }
diff -r f30acb786dda -r fe5dbe0f66a4 sys/arch/arm/arm32/db_interface.c
--- a/sys/arch/arm/arm32/db_interface.c Wed Oct 26 23:28:42 2022 +0000
+++ b/sys/arch/arm/arm32/db_interface.c Wed Oct 26 23:38:05 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_interface.c,v 1.63 2020/12/03 07:45:52 skrll Exp $  */
+/*     $NetBSD: db_interface.c,v 1.64 2022/10/26 23:38:06 riastradh Exp $      */
 
 /*
  * Copyright (c) 1996 Scott K. Stevens
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.63 2020/12/03 07:45:52 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.64 2022/10/26 23:38:06 riastradh Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -54,13 +54,16 @@
 
 #include <arm/arm32/db_machdep.h>
 #include <arm/undefined.h>
+
 #include <ddb/db_access.h>
+#include <ddb/db_active.h>
 #include <ddb/db_command.h>
 #include <ddb/db_output.h>
 #include <ddb/db_variables.h>
 #include <ddb/db_sym.h>
 #include <ddb/db_extern.h>
 #include <ddb/db_interface.h>
+
 #include <dev/cons.h>
 
 #if defined(KGDB) || !defined(DDB)
diff -r f30acb786dda -r fe5dbe0f66a4 sys/arch/arm/at91/at91dbgu.c
--- a/sys/arch/arm/at91/at91dbgu.c      Wed Oct 26 23:28:42 2022 +0000
+++ b/sys/arch/arm/at91/at91dbgu.c      Wed Oct 26 23:38:05 2022 +0000
@@ -1,5 +1,5 @@
-/*     $Id: at91dbgu.c,v 1.18 2020/11/20 18:03:52 thorpej Exp $        */
-/*     $NetBSD: at91dbgu.c,v 1.18 2020/11/20 18:03:52 thorpej Exp $ */
+/*     $Id: at91dbgu.c,v 1.19 2022/10/26 23:38:06 riastradh Exp $      */
+/*     $NetBSD: at91dbgu.c,v 1.19 2022/10/26 23:38:06 riastradh Exp $ */
 
 /*
  *
@@ -76,9 +76,8 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: at91dbgu.c,v 1.18 2020/11/20 18:03:52 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: at91dbgu.c,v 1.19 2022/10/26 23:38:06 riastradh Exp $");
 
-#include "opt_ddb.h"
 #include "opt_kgdb.h"
 
 #include "rnd.h"
@@ -98,7 +97,6 @@
                cn_trapped = 1;                 \
        } while (/* CONSTCOND */ 0)
 
-
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/types.h>
@@ -115,6 +113,8 @@
 #include <machine/intr.h>
 #include <sys/bus.h>
 
+#include <ddb/db_active.h>
+
 #include <arm/at91/at91reg.h>
 #include <arm/at91/at91var.h>
 #include <arm/at91/at91dbguvar.h>
@@ -893,11 +893,7 @@
                DBGUREG(DBGU_CR) = DBGU_CR_RSTSTA;      // reset status bits
                c = CNC_BREAK;
        }
-#ifdef DDB
-       extern int db_active;
-       if (!db_active)
-#endif
-       {
+       if (!db_active) {
                int cn_trapped __unused = 0;
 
                cn_check_magic(dev, c, at91dbgu_cnm_state);
@@ -1072,10 +1068,7 @@
                if (ISSET(sr, DBGU_SR_FRAME) && c == 0) {
                        c = CNC_BREAK;
                }
-#ifdef DDB
-               extern int db_active;
                if (!db_active)
-#endif
                        cn_check_magic(cn_tab->cn_dev, c, at91dbgu_cnm_state);
                if (!cn_trapped && cc) {
                        put[0] = c & 0xff;
diff -r f30acb786dda -r fe5dbe0f66a4 sys/arch/arm/at91/at91usart.c
--- a/sys/arch/arm/at91/at91usart.c     Wed Oct 26 23:28:42 2022 +0000
+++ b/sys/arch/arm/at91/at91usart.c     Wed Oct 26 23:38:05 2022 +0000
@@ -1,5 +1,5 @@
-/*     $Id: at91usart.c,v 1.13 2015/04/13 21:18:40 riastradh Exp $     */
-/*     $NetBSD: at91usart.c,v 1.13 2015/04/13 21:18:40 riastradh Exp $ */
+/*     $Id: at91usart.c,v 1.14 2022/10/26 23:38:06 riastradh Exp $     */



Home | Main Index | Thread Index | Old Index