diff options
author | pst <pst@FreeBSD.org> | 1996-08-30 17:03:46 +0000 |
---|---|---|
committer | pst <pst@FreeBSD.org> | 1996-08-30 17:03:46 +0000 |
commit | 68ac82d7c3bedd27f409453e8e5d4f5182fc4ff9 (patch) | |
tree | a26b4a6d62ea569c1e8f57d5b8bc16760546ff68 /sys/amd64 | |
parent | bf159f982f08ace5e153311d5379dd2dded70f35 (diff) | |
download | FreeBSD-src-68ac82d7c3bedd27f409453e8e5d4f5182fc4ff9.zip FreeBSD-src-68ac82d7c3bedd27f409453e8e5d4f5182fc4ff9.tar.gz |
Improvements from Bruce Evans
Diffstat (limited to 'sys/amd64')
-rw-r--r-- | sys/amd64/amd64/amd64-gdbstub.c | 28 | ||||
-rw-r--r-- | sys/amd64/amd64/db_interface.c | 18 |
2 files changed, 29 insertions, 17 deletions
diff --git a/sys/amd64/amd64/amd64-gdbstub.c b/sys/amd64/amd64/amd64-gdbstub.c index 41b72af..7ac17a0 100644 --- a/sys/amd64/amd64/amd64-gdbstub.c +++ b/sys/amd64/amd64/amd64-gdbstub.c @@ -90,23 +90,20 @@ * ****************************************************************************/ -#include <sys/types.h> +#include <sys/param.h> +#include <sys/systm.h> + +#include <machine/cons.h> + +#include <ddb/ddb.h> + #include <setjmp.h> -#include <stdio.h> -#include <string.h> -#include <machine/db_machdep.h> -#include <machine/trap.h> -#include <machine/psl.h> /************************************************************************/ void gdb_handle_exception (db_regs_t *, int, int); extern jmp_buf db_jmpbuf; -extern void db_read_bytes (vm_offset_t addr, int size, char *data); -extern void db_write_bytes (vm_offset_t addr, int size, char *data); -extern void siocnputc (dev_t, int c); -extern int siocngetc (dev_t); /************************************************************************/ /* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/ @@ -116,6 +113,10 @@ extern int siocngetc (dev_t); /* Create private copies of common functions used by the stub. This prevents nasty interactions between app code and the stub (for instance if user steps into strlen, etc..) */ +/* XXX this is fairly bogus. strlen() and strcpy() should be reentrant, + and are reentrant under FreeBSD. In any case, our versions should not + be named the same as the standard versions, so that the address `strlen' + is unambiguous... */ static int strlen (const char *s) @@ -137,17 +138,20 @@ strcpy (char *dst, const char *src) return retval; } +/* XXX sio always uses its major with minor 0 no matter what we specify. */ +#define REMOTE_DEV 0 + static int putDebugChar (int c) /* write a single character */ { - siocnputc (NULL, c); + siocnputc (REMOTE_DEV, c); return 1; } static int getDebugChar (void) /* read and return a single char */ { - return siocngetc (NULL); + return siocngetc (REMOTE_DEV); } static const char hexchars[]="0123456789abcdef"; diff --git a/sys/amd64/amd64/db_interface.c b/sys/amd64/amd64/db_interface.c index 284d2e9..7055d28 100644 --- a/sys/amd64/amd64/db_interface.c +++ b/sys/amd64/amd64/db_interface.c @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_interface.c,v 1.20 1996/08/27 19:45:56 pst Exp $ + * $Id: db_interface.c,v 1.21 1996/08/28 17:49:33 pst Exp $ */ /* @@ -90,7 +90,15 @@ kdb_trap(type, code, regs) break; default: - db_printf("kernel: type %d trap, code=%x\n", type, code); + /* + * XXX this is almost useless now. In most cases, + * trap_fatal() has already printed a much more verbose + * message. However, it is dangerous to print things in + * trap_fatal() - printf() might be reentered and trap. + * The debugger should be given control first. + */ + if (ddb_mode) + db_printf("kernel: type %d trap, code=%x\n", type, code); if (db_nofault) { jmp_buf *no_fault = db_nofault; @@ -105,7 +113,7 @@ kdb_trap(type, code, regs) ddb_regs = *regs; /* - * Kernel mode - esp and ss not saved, so dummy them up + * If in kernel mode, esp and ss are not saved, so dummy them up. */ if (ISPL(regs->tf_cs) == 0) { ddb_regs.tf_esp = (int)®s->tf_esp; @@ -129,7 +137,7 @@ kdb_trap(type, code, regs) regs->tf_ebx = ddb_regs.tf_ebx; /* - * If in user mode, the saved ESP and SS were valid, restore them + * If in user mode, the saved ESP and SS were valid, restore them. */ if (ISPL(regs->tf_cs)) { regs->tf_esp = ddb_regs.tf_esp; @@ -192,7 +200,7 @@ db_write_bytes(addr, size, data) addr1 = trunc_page(addr + size - 1); - /* data crosses a page boundary */ + /* Map another page if the data crosses a page boundary. */ if (trunc_page(addr) != addr1) { ptep1 = pmap_pte(kernel_pmap, addr1); oldmap1 = *ptep1; |