Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sparc64/sparc64 Make kernels with options KGDB at l...
details: https://anonhg.NetBSD.org/src/rev/05d69b57053a
branches: trunk
changeset: 547447:05d69b57053a
user: martin <martin%NetBSD.org@localhost>
date: Sun May 18 22:11:31 2003 +0000
description:
Make kernels with options KGDB at least compile.
Still needs some work to make it working.
diffstat:
sys/arch/sparc64/sparc64/autoconf.c | 19 +-
sys/arch/sparc64/sparc64/db_interface.c | 8 +-
sys/arch/sparc64/sparc64/kgdb_machdep.c | 377 ++++++++++++++++++++++++++++++++
sys/arch/sparc64/sparc64/locore.s | 16 +-
4 files changed, 394 insertions(+), 26 deletions(-)
diffs (truncated from 539 to 300 lines):
diff -r c0d43e0b40e8 -r 05d69b57053a sys/arch/sparc64/sparc64/autoconf.c
--- a/sys/arch/sparc64/sparc64/autoconf.c Sun May 18 21:00:57 2003 +0000
+++ b/sys/arch/sparc64/sparc64/autoconf.c Sun May 18 22:11:31 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: autoconf.c,v 1.74 2003/05/17 01:38:39 nakayama Exp $ */
+/* $NetBSD: autoconf.c,v 1.75 2003/05/18 22:11:31 martin Exp $ */
/*
* Copyright (c) 1996
@@ -215,34 +215,21 @@
#if (NKSYMS || defined(DDB) || defined(LKM))
extern void *ssym, *esym;
#endif
-#ifndef __arch64__
+#if !defined(__arch64__) && defined(DDB)
/* Assembly glue for the PROM */
extern void OF_sym2val32 __P((void *));
extern void OF_val2sym32 __P((void *));
#endif
- /*
- * Initialize ddb first and register OBP callbacks.
- * We can do this because ksyms_init() does not allocate anything,
- * just initialze some pointers to important things
- * like the symtab.
- *
- * By doing this first and installing the OBP callbacks
- * we get to do symbolic debugging of pmap_bootstrap().
- */
-#ifdef KGDB
-/* Moved zs_kgdb_init() to dev/zs.c:consinit(). */
- zs_kgdb_init(); /* XXX */
-#endif
/* Initialize the PROM console so printf will not panic */
(*cn_tab->cn_init)(cn_tab);
#if NKSYMS || defined(DDB) || defined(LKM)
ksyms_init((int)((caddr_t)esym - (caddr_t)ssym), ssym, esym);
+#ifdef DDB
#ifdef __arch64__
/* This can only be installed on an 64-bit system cause otherwise our stack is screwed */
OF_set_symbol_lookup(OF_sym2val, OF_val2sym);
#else
-#if 1
OF_set_symbol_lookup(OF_sym2val32, OF_val2sym32);
#endif
#endif
diff -r c0d43e0b40e8 -r 05d69b57053a sys/arch/sparc64/sparc64/db_interface.c
--- a/sys/arch/sparc64/sparc64/db_interface.c Sun May 18 21:00:57 2003 +0000
+++ b/sys/arch/sparc64/sparc64/db_interface.c Sun May 18 22:11:31 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_interface.c,v 1.68 2003/05/17 01:38:40 nakayama Exp $ */
+/* $NetBSD: db_interface.c,v 1.69 2003/05/18 22:11:31 martin Exp $ */
/*
* Copyright (c) 1996-2002 Eduardo Horvath. All rights reserved.
@@ -248,10 +248,10 @@
void db_watch __P((db_expr_t, int, db_expr_t, char *));
void db_pm_extract __P((db_expr_t, int, db_expr_t, char *));
+#ifdef DDB
static void db_dump_pmap __P((struct pmap*));
static void db_print_trace_entry __P((struct traptrace *, int));
-
/*
* Received keyboard interrupt sequence.
*/
@@ -367,6 +367,7 @@
return (1);
}
+#endif /* DDB */
/*
* Read bytes from kernel address space for debugger.
@@ -417,6 +418,7 @@
}
+#ifdef DDB
void
Debugger()
{
@@ -1145,6 +1147,8 @@
{ (char *)0, }
};
+#endif /* DDB */
+
/*
* support for SOFTWARE_SSTEP:
* return the next pc if the given branch is taken.
diff -r c0d43e0b40e8 -r 05d69b57053a sys/arch/sparc64/sparc64/kgdb_machdep.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/sparc64/sparc64/kgdb_machdep.c Sun May 18 22:11:31 2003 +0000
@@ -0,0 +1,377 @@
+/* $NetBSD: kgdb_machdep.c,v 1.1 2003/05/18 22:11:32 martin Exp $ */
+/*-
+ * Copyright (c) 1997 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Paul Kranenburg.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ * Copyright (c) 1995
+ * The President and Fellows of Harvard College. All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
+ *
+ * All advertising materials mentioning features or use of this software
+ * must display the following acknowledgements:
+ * This product includes software developed by the University of
+ * California, Lawrence Berkeley Laboratory.
+ *
+ * This product includes software developed by Harvard University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)kgdb_stub.c 8.1 (Berkeley) 6/11/93
+ */
+
+/*
+ * Machine dependent routines needed by kern/kgdb_stub.c
+ */
+
+#include "opt_kgdb.h"
+#include "opt_multiprocessor.h"
+#include "opt_sparc_arch.h"
+
+#ifdef KGDB
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/buf.h>
+#include <sys/kgdb.h>
+
+#include <machine/ctlreg.h>
+#include <machine/psl.h>
+#include <machine/reg.h>
+#include <machine/trap.h>
+#include <machine/cpu.h>
+
+#include <sparc/sparc/asm.h>
+
+extern int64_t pseg_get __P((struct pmap *, vaddr_t));
+
+static __inline void kgdb_copy __P((char *, char *, int));
+static __inline void kgdb_zero __P((char *, int));
+
+/*
+ * This little routine exists simply so that bcopy() can be debugged.
+ */
+static __inline void
+kgdb_copy(src, dst, len)
+ register char *src, *dst;
+ register int len;
+{
+
+ while (--len >= 0)
+ *dst++ = *src++;
+}
+
+/* ditto for bzero */
+static __inline void
+kgdb_zero(ptr, len)
+ register char *ptr;
+ register int len;
+{
+ while (--len >= 0)
+ *ptr++ = (char) 0;
+}
+
+/*
+ * Deal with KGDB in a MP environment. XXX need to have "mach cpu" equiv.
+ */
+#ifdef MULTIPROCESSOR
+
+#define NOCPU -1
+
+static int kgdb_suspend_others(void);
+static void kgdb_resume_others(void);
+static void kgdb_suspend(void);
+
+__cpu_simple_lock_t kgdb_lock;
+int kgdb_cpu = NOCPU;
+
+static int
+kgdb_suspend_others(void)
+{
+ int cpu_me = cpu_number();
+ int win;
+
+ if (cpus == NULL)
+ return 1;
+
+ __cpu_simple_lock(&kgdb_lock);
+ if (kgdb_cpu == NOCPU)
+ kgdb_cpu = cpu_me;
+ win = (kgdb_cpu == cpu_me);
+ __cpu_simple_unlock(&kgdb_lock);
+
+ if (win)
+ mp_pause_cpus();
+
+ return win;
+}
+
+static void
+kgdb_resume_others(void)
+{
+
+ mp_resume_cpus();
+
+ __cpu_simple_lock(&kgdb_lock);
+ kgdb_cpu = NOCPU;
+ __cpu_simple_unlock(&kgdb_lock);
+}
+
+static void
+kgdb_suspend()
+{
+
+ while (cpuinfo.flags & CPUFLG_PAUSED)
+ cpuinfo.cache_flush((caddr_t)&cpuinfo.flags, sizeof(cpuinfo.flags));
+}
+#endif
+
+/*
+ * Trap into kgdb to wait for debugger to connect,
+ * noting on the console why nothing else is going on.
+ */
+void
+kgdb_connect(verbose)
+ int verbose;
+{
+
+ if (kgdb_dev < 0)
+ return;
+#if NFB > 0
+ fb_unblank();
Home |
Main Index |
Thread Index |
Old Index