Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Mar 2004 21:15:54 -0800 (PST)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 49512 for review
Message-ID:  <200403220515.i2M5FsCe024279@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=49512

Change 49512 by marcel@marcel_nfs on 2004/03/21 21:14:57

	Make alpha compile.
	
	With this commit we have a kdb frontend and ddb and gdb backends.
	The structure seems to be right, but things don't work. Some but
	not all of the "#ifdef DDB" have been replaced, so we need to
	clean that up further. In short: in between the mess, there's
	something that looks like a structure.
	
	Note that amd64 has been put on the side for now. Once I have
	alpha, i386, ia64 and sparc64 in a fairly good shape, code will
	be stabilized. This means that I can more effectively work on
	amd64, because I need someone to help with testing.
	
	I think it's about time I'll make the debuggers thread aware.
	The approach I'm going to go for is to create a kdb_thread
	variable and use that as as the context. MD code can get to
	the trapframe and PCB by dereferencing kdb_thread. On SMP
	machines this also works well, because stopped CPUs only have
	to save the current context in the PCB. Once I've got that
	working with gdb(1), I should have a better picture of what
	we need from the MD code. This is also the time to flesh out
	the MD code and get to a point where the debugger is actually
	working. From there is all about the details...

Affected files ...

.. //depot/projects/gdb/sys/alpha/alpha/db_interface.c#4 edit
.. //depot/projects/gdb/sys/alpha/alpha/machdep.c#5 edit

Differences ...

==== //depot/projects/gdb/sys/alpha/alpha/db_interface.c#4 (text+ko) ====

@@ -78,18 +78,6 @@
 static jmp_buf *db_nofault = 0;
 extern jmp_buf	db_jmpbuf;
 
-extern void	gdb_handle_exception(db_regs_t *, int, int);
-
-#if 0
-extern char *trap_type[];
-extern int trap_types;
-#endif
-
-int	db_active;
-
-void	ddbprinttrap(unsigned long, unsigned long, unsigned long,
-	    unsigned long);
-
 struct db_variable db_regs[] = {
 	{	"v0",	&ddb_regs.tf_regs[FRAME_V0],	FCN_NULL	},
 	{	"t0",	&ddb_regs.tf_regs[FRAME_T0],	FCN_NULL	},
@@ -129,104 +117,10 @@
 };
 struct db_variable *db_eregs = db_regs + sizeof(db_regs)/sizeof(db_regs[0]);
 
-/*
- * Print trap reason.
- */
 void
-ddbprinttrap(a0, a1, a2, entry)
-	unsigned long a0, a1, a2, entry;
-{
-
-	/* XXX Implement. */
-
-	printf("ddbprinttrap(0x%lx, 0x%lx, 0x%lx, 0x%lx)\n", a0, a1, a2,
-	    entry);
-}
-
-#if 0
-/*
- *  ddb_trap - field a kernel trap
- */
-int
-ddb_trap(a0, a1, a2, entry, regs)
-	unsigned long a0, a1, a2, entry;
-	db_regs_t *regs;
+db_cpu_trap(int entry, int code, struct trapframe *tf)
 {
-	int ddb_mode = !(boothowto & RB_GDB);
-	register_t s;
-
-	/*
-	 * Don't bother checking for usermode, since a benign entry
-	 * by the kernel (call to kdb_enter() or a breakpoint) has
-	 * already checked for usermode.  If neither of those
-	 * conditions exist, something Bad has happened.
-	 */
-
-	if (entry != ALPHA_KENTRY_IF ||
-	    (a0 != ALPHA_IF_CODE_BUGCHK && a0 != ALPHA_IF_CODE_BPT
-		&& a0 != ALPHA_IF_CODE_GENTRAP)) {
-#if 0
-		if (ddb_mode) {
-			db_printf("ddbprinttrap from 0x%lx\n",	/* XXX */
-				  regs->tf_regs[FRAME_PC]);
-			ddbprinttrap(a0, a1, a2, entry);
-			/*
-			 * Tell caller "We did NOT handle the trap."
-			 * Caller should panic, or whatever.
-			 */
-			return (0);
-		}
-#endif
-		if (db_nofault) {
-			jmp_buf *no_fault = db_nofault;
-			db_nofault = 0;
-			longjmp(*no_fault, 1);
-		}
-	}
-
-	/*
-	 * XXX Should switch to DDB's own stack, here.
-	 */
-
-	ddb_regs = *regs;
-
-	s = intr_disable();
-
-#ifdef SMP
-#ifdef DIAGNOSTIC
-	db_printf("stopping %x\n", PCPU_GET(other_cpus));
-#endif
-	stop_cpus(PCPU_GET(other_cpus));
-#ifdef DIAGNOSTIC
-	db_printf("stopped_cpus=%x\n", stopped_cpus);
-#endif
-#endif
-
-	db_active++;
-
-	if (ddb_mode) {
-	    cndbctl(TRUE);	/* DDB active, unblank video */
-	    db_trap(entry, a0);	/* Where the work happens */
-	    cndbctl(FALSE);	/* DDB inactive */
-	} else
-	    gdb_handle_exception(&ddb_regs, entry, a0);
-
-	db_active--;
-
-#ifdef SMP 
-	restart_cpus(stopped_cpus);
-#endif
-
-	intr_restore(s);
-
-	*regs = ddb_regs;
-
-	/*
-	 * Tell caller "We HAVE handled the trap."
-	 */
-	return (1);
 }
-#endif
 
 /*
  * Read bytes from kernel address space for debugger.

==== //depot/projects/gdb/sys/alpha/alpha/machdep.c#5 (text+ko) ====

@@ -91,7 +91,6 @@
 __FBSDID("$FreeBSD: src/sys/alpha/alpha/machdep.c,v 1.218 2004/03/01 19:19:15 kensmith Exp $");
 
 #include "opt_compat.h"
-#include "opt_ddb.h"
 #include "opt_kstack_pages.h"
 #include "opt_msgbuf.h"
 #include "opt_maxmem.h"
@@ -146,7 +145,6 @@
 #include <machine/chipset.h>
 #include <machine/vmparam.h>
 #include <machine/elf.h>
-#include <ddb/ddb.h>
 #include <alpha/alpha/db_instruction.h>
 #include <sys/vnode.h>
 #include <machine/sigframe.h>
@@ -170,10 +168,9 @@
 static char cpu_model[128];
 SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD, cpu_model, 0, "");
 
-#ifdef DDB
+#ifdef KDB
 /* start and end of kernel symbol table */
 void	*ksym_start, *ksym_end;
-db_regs_t	ddb_regs;
 #endif
 
 int	alpha_unaligned_print = 1;	/* warn about unaligned accesses */
@@ -607,7 +604,7 @@
 	 * stack).
 	 */
 	kernstart = trunc_page(kernel_text) - 2 * PAGE_SIZE;
-#ifdef DDB
+#ifdef KDB
 	ksym_start = (void *)bootinfo.ssym;
 	ksym_end   = (void *)bootinfo.esym;
 	kernend = (vm_offset_t)round_page(ksym_end);
@@ -957,7 +954,6 @@
 			break;
 #endif
 
-#if defined(DDB)
 		case 'd': /* break into the kernel debugger ASAP */
 		case 'D':
 			boothowto |= RB_KDB;
@@ -966,7 +962,6 @@
 		case 'G':
 			boothowto |= RB_GDB;
 			break;
-#endif
 
 		case 'h': /* always halt, never reboot */
 		case 'H':



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200403220515.i2M5FsCe024279>