Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc rearrange slightly to enable crash(8) to build.



details:   https://anonhg.NetBSD.org/src/rev/173a7126df5b
branches:  trunk
changeset: 349413:173a7126df5b
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sat Dec 10 10:41:07 2016 +0000

description:
rearrange slightly to enable crash(8) to build.

diffstat:

 sys/arch/sparc/include/cpu.h        |   14 +++-
 sys/arch/sparc/include/db_machdep.h |    5 +-
 sys/arch/sparc/sparc/cpuvar.h       |    4 +-
 sys/arch/sparc/sparc/db_interface.c |  130 +++++++++++++++++++++++------------
 sys/arch/sparc/sparc/db_trace.c     |   22 +++++-
 sys/arch/sparc/sparc/machdep.c      |    6 +-
 6 files changed, 126 insertions(+), 55 deletions(-)

diffs (truncated from 476 to 300 lines):

diff -r a4dba879db71 -r 173a7126df5b sys/arch/sparc/include/cpu.h
--- a/sys/arch/sparc/include/cpu.h      Sat Dec 10 10:26:38 2016 +0000
+++ b/sys/arch/sparc/include/cpu.h      Sat Dec 10 10:41:07 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.h,v 1.96 2016/12/10 09:51:43 mrg Exp $ */
+/*     $NetBSD: cpu.h,v 1.97 2016/12/10 10:41:07 mrg Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -52,11 +52,13 @@
 #define        CPU_ARCH                4       /* integer: cpu architecture version */
 #define        CPU_MAXID               5       /* number of valid machdep ids */
 
-#ifdef _KERNEL
 /*
  * Exported definitions unique to SPARC cpu support.
  */
 
+/* Things needed by crash or the kernel */
+#if defined(_KERNEL) || defined(_KMEMUSER)
+
 #if defined(_KERNEL_OPT)
 #include "opt_multiprocessor.h"
 #include "opt_lockdebug.h"
@@ -77,6 +79,8 @@
 #include <arch/sparc/sparc/cache.h>
 #endif
 
+struct trapframe;
+
 /*
  * Message structure for Inter Processor Communication in MP systems
  */
@@ -337,11 +341,17 @@
  * definitions of cpu-dependent requirements
  * referenced in generic code
  */
+#define        cpuinfo                 (*(struct cpu_info *)CPUINFO_VA)
 #define        curcpu()                (cpuinfo.ci_self)
 #define        curlwp                  (cpuinfo.ci_curlwp)
 #define        CPU_IS_PRIMARY(ci)      ((ci)->master)
 
 #define        cpu_number()            (cpuinfo.ci_cpuid)
+
+#endif /* _KERNEL || _KMEMUSER */
+
+/* Kernel only things. */
+#if defined(_KERNEL)
 void   cpu_proc_fork(struct proc *, struct proc *);
 
 #if defined(MULTIPROCESSOR)
diff -r a4dba879db71 -r 173a7126df5b sys/arch/sparc/include/db_machdep.h
--- a/sys/arch/sparc/include/db_machdep.h       Sat Dec 10 10:26:38 2016 +0000
+++ b/sys/arch/sparc/include/db_machdep.h       Sat Dec 10 10:41:07 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_machdep.h,v 1.26 2011/05/26 15:34:13 joerg Exp $ */
+/*     $NetBSD: db_machdep.h,v 1.27 2016/12/10 10:41:07 mrg Exp $ */
 
 /*
  * Mach Operating System
@@ -32,7 +32,10 @@
 /*
  * Machine-dependent defines for new kernel debugger.
  */
+#include <sys/types.h>
+
 #include <uvm/uvm_extern.h>
+
 #include <machine/frame.h>
 #include <machine/pcb.h>
 #include <machine/psl.h>
diff -r a4dba879db71 -r 173a7126df5b sys/arch/sparc/sparc/cpuvar.h
--- a/sys/arch/sparc/sparc/cpuvar.h     Sat Dec 10 10:26:38 2016 +0000
+++ b/sys/arch/sparc/sparc/cpuvar.h     Sat Dec 10 10:41:07 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpuvar.h,v 1.93 2016/12/10 09:51:43 mrg Exp $ */
+/*     $NetBSD: cpuvar.h,v 1.94 2016/12/10 10:41:07 mrg Exp $ */
 
 /*
  *  Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -233,8 +233,6 @@
 extern u_int cpu_ready_mask;           /* the set of CPUs marked as READY */
 #endif
 
-#define cpuinfo        (*(struct cpu_info *)CPUINFO_VA)
-
 #if defined(DDB) || defined(MULTIPROCESSOR)
 /*
  * These are called by ddb mach functions.
diff -r a4dba879db71 -r 173a7126df5b sys/arch/sparc/sparc/db_interface.c
--- a/sys/arch/sparc/sparc/db_interface.c       Sat Dec 10 10:26:38 2016 +0000
+++ b/sys/arch/sparc/sparc/db_interface.c       Sat Dec 10 10:41:07 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_interface.c,v 1.91 2015/10/04 08:17:03 joerg Exp $ */
+/*     $NetBSD: db_interface.c,v 1.92 2016/12/10 10:41:07 mrg Exp $ */
 
 /*
  * Mach Operating System
@@ -33,16 +33,20 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.91 2015/10/04 08:17:03 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.92 2016/12/10 10:41:07 mrg Exp $");
 
+#ifdef _KERNEL_OPT
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
 #include "opt_multiprocessor.h"
+#endif
 
 #include <sys/param.h>
 #include <sys/proc.h>
+#include <sys/cpu.h>
 #include <sys/reboot.h>
 #include <sys/systm.h>
+#include <sys/lwp.h>
 
 #include <dev/cons.h>
 
@@ -53,7 +57,8 @@
 #include <ddb/db_access.h>
 #include <ddb/ddbvar.h>
 
-#if defined(DDB)
+#if defined(DDB) || defined(_KMEMUSER)
+#include <ddb/db_user.h>
 #include <ddb/db_command.h>
 #include <ddb/db_sym.h>
 #include <ddb/db_variables.h>
@@ -63,9 +68,13 @@
 #endif
 
 #include <machine/instr.h>
+#if defined(_KERNEL)
 #include <machine/promlib.h>
+#endif
 #include <machine/ctlreg.h>
 #include <machine/pmap.h>
+
+#if defined(_KERNEL)
 #include <sparc/sparc/asm.h>
 
 #include "fb.h"
@@ -102,6 +111,7 @@
        }
 
 }
+#endif
 
 db_regs_t *ddb_regp;
 
@@ -118,6 +128,10 @@
        sparc_noop();   /* Force this function to allocate a stack frame */
 }
 
+#endif /* DDB */
+
+#if defined(DDB) || defined(_KMEMUSER)
+
 static long nil;
 
 /*
@@ -129,43 +143,43 @@
 static int db_sparc_regop(const struct db_variable *, db_expr_t *, int);
 
 const struct db_variable db_regs[] = {
-       { "psr",        dbreg(psr),             db_sparc_regop, },
-       { "pc",         dbreg(pc),              db_sparc_regop, },
-       { "npc",        dbreg(npc),             db_sparc_regop, },
-       { "y",          dbreg(y),               db_sparc_regop, },
-       { "wim",        dbreg(global[0]),       db_sparc_regop, }, /* see reg.h */
-       { "g0",         &nil,                   FCN_NULL,       },
-       { "g1",         dbreg(global[1]),       db_sparc_regop, },
-       { "g2",         dbreg(global[2]),       db_sparc_regop, },
-       { "g3",         dbreg(global[3]),       db_sparc_regop, },
-       { "g4",         dbreg(global[4]),       db_sparc_regop, },
-       { "g5",         dbreg(global[5]),       db_sparc_regop, },
-       { "g6",         dbreg(global[6]),       db_sparc_regop, },
-       { "g7",         dbreg(global[7]),       db_sparc_regop, },
-       { "o0",         dbreg(out[0]),          db_sparc_regop, },
-       { "o1",         dbreg(out[1]),          db_sparc_regop, },
-       { "o2",         dbreg(out[2]),          db_sparc_regop, },
-       { "o3",         dbreg(out[3]),          db_sparc_regop, },
-       { "o4",         dbreg(out[4]),          db_sparc_regop, },
-       { "o5",         dbreg(out[5]),          db_sparc_regop, },
-       { "o6",         dbreg(out[6]),          db_sparc_regop, },
-       { "o7",         dbreg(out[7]),          db_sparc_regop, },
-       { "l0",         dbregfr(local[0]),      db_sparc_regop, },
-       { "l1",         dbregfr(local[1]),      db_sparc_regop, },
-       { "l2",         dbregfr(local[2]),      db_sparc_regop, },
-       { "l3",         dbregfr(local[3]),      db_sparc_regop, },
-       { "l4",         dbregfr(local[4]),      db_sparc_regop, },
-       { "l5",         dbregfr(local[5]),      db_sparc_regop, },
-       { "l6",         dbregfr(local[6]),      db_sparc_regop, },
-       { "l7",         dbregfr(local[7]),      db_sparc_regop, },
-       { "i0",         dbregfr(arg[0]),        db_sparc_regop, },
-       { "i1",         dbregfr(arg[1]),        db_sparc_regop, },
-       { "i2",         dbregfr(arg[2]),        db_sparc_regop, },
-       { "i3",         dbregfr(arg[3]),        db_sparc_regop, },
-       { "i4",         dbregfr(arg[4]),        db_sparc_regop, },
-       { "i5",         dbregfr(arg[5]),        db_sparc_regop, },
-       { "i6",         dbregfr(fp),            db_sparc_regop, },
-       { "i7",         dbregfr(pc),            db_sparc_regop, },
+       { "psr",        dbreg(psr),             db_sparc_regop, NULL, },
+       { "pc",         dbreg(pc),              db_sparc_regop, NULL, },
+       { "npc",        dbreg(npc),             db_sparc_regop, NULL, },
+       { "y",          dbreg(y),               db_sparc_regop, NULL, },
+       { "wim",        dbreg(global[0]),       db_sparc_regop, NULL, }, /* see reg.h */
+       { "g0",         &nil,                   FCN_NULL,       NULL, },
+       { "g1",         dbreg(global[1]),       db_sparc_regop, NULL, },
+       { "g2",         dbreg(global[2]),       db_sparc_regop, NULL, },
+       { "g3",         dbreg(global[3]),       db_sparc_regop, NULL, },
+       { "g4",         dbreg(global[4]),       db_sparc_regop, NULL, },
+       { "g5",         dbreg(global[5]),       db_sparc_regop, NULL, },
+       { "g6",         dbreg(global[6]),       db_sparc_regop, NULL, },
+       { "g7",         dbreg(global[7]),       db_sparc_regop, NULL, },
+       { "o0",         dbreg(out[0]),          db_sparc_regop, NULL, },
+       { "o1",         dbreg(out[1]),          db_sparc_regop, NULL, },
+       { "o2",         dbreg(out[2]),          db_sparc_regop, NULL, },
+       { "o3",         dbreg(out[3]),          db_sparc_regop, NULL, },
+       { "o4",         dbreg(out[4]),          db_sparc_regop, NULL, },
+       { "o5",         dbreg(out[5]),          db_sparc_regop, NULL, },
+       { "o6",         dbreg(out[6]),          db_sparc_regop, NULL, },
+       { "o7",         dbreg(out[7]),          db_sparc_regop, NULL, },
+       { "l0",         dbregfr(local[0]),      db_sparc_regop, NULL, },
+       { "l1",         dbregfr(local[1]),      db_sparc_regop, NULL, },
+       { "l2",         dbregfr(local[2]),      db_sparc_regop, NULL, },
+       { "l3",         dbregfr(local[3]),      db_sparc_regop, NULL, },
+       { "l4",         dbregfr(local[4]),      db_sparc_regop, NULL, },
+       { "l5",         dbregfr(local[5]),      db_sparc_regop, NULL, },
+       { "l6",         dbregfr(local[6]),      db_sparc_regop, NULL, },
+       { "l7",         dbregfr(local[7]),      db_sparc_regop, NULL, },
+       { "i0",         dbregfr(arg[0]),        db_sparc_regop, NULL, },
+       { "i1",         dbregfr(arg[1]),        db_sparc_regop, NULL, },
+       { "i2",         dbregfr(arg[2]),        db_sparc_regop, NULL, },
+       { "i3",         dbregfr(arg[3]),        db_sparc_regop, NULL, },
+       { "i4",         dbregfr(arg[4]),        db_sparc_regop, NULL, },
+       { "i5",         dbregfr(arg[5]),        db_sparc_regop, NULL, },
+       { "i6",         dbregfr(fp),            db_sparc_regop, NULL, },
+       { "i7",         dbregfr(pc),            db_sparc_regop, NULL, },
 };
 const struct db_variable * const db_eregs =
     db_regs + sizeof(db_regs)/sizeof(db_regs[0]);
@@ -184,7 +198,11 @@
                *regaddr = *val;
                break;
        default:
+#ifdef _KERNEL
                panic("db_sparc_regop: unknown op %d", opcode);
+#else
+               printf("db_sparc_regop: unknown op %d\n", opcode);
+#endif
        }
        return 0;
 }
@@ -193,17 +211,19 @@
 
 extern char *trap_type[];
 
+#ifdef _KERNEL
 void kdb_kbd_trap(struct trapframe *);
 void db_prom_cmd(db_expr_t, bool, db_expr_t, const char *);
+void db_page_cmd(db_expr_t, bool, db_expr_t, const char *);
 void db_proc_cmd(db_expr_t, bool, db_expr_t, const char *);
 void db_dump_pcb(db_expr_t, bool, db_expr_t, const char *);
-void db_uvmhistdump(db_expr_t, bool, db_expr_t, const char *);
+#endif
 #ifdef MULTIPROCESSOR
 void db_cpu_cmd(db_expr_t, bool, db_expr_t, const char *);
 void db_xcall_cmd(db_expr_t, bool, db_expr_t, const char *);
 #endif
-void db_page_cmd(db_expr_t, bool, db_expr_t, const char *);
 
+#ifdef _KERNEL
 /*
  * Received keyboard interrupt sequence.
  */
@@ -215,6 +235,7 @@
                kdb_trap(-1, tf);
        }
 }
+#endif
 
 /* struct cpu_info of CPU being investigated */
 struct cpu_info *ddb_cpuinfo;
@@ -278,6 +299,7 @@
 }
 #endif /* MULTIPROCESSOR */
 
+#if defined(DDB)
 /*
  *  kdb_trap - field a TRACE or BPT trap
  */
@@ -342,7 +364,17 @@
 
        return (1);
 }
+#endif /* DDB */
 



Home | Main Index | Thread Index | Old Index