diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2017-04-30 13:04:50 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2017-04-30 13:04:50 +0000 |
commit | 9677cd160068c81899802ad8c77c0879d451b880 (patch) | |
tree | 5cddb69b1b72c888c26085e12b2d6cfd4c026daf /sys/arch | |
parent | 22d14bd3c139dd25c22669e4e75a1ac94d35f79e (diff) |
Unifdef KGDB.
It doesn't compile und hasn't been working during the last decade.
ok kettenis@, deraadt@
Diffstat (limited to 'sys/arch')
29 files changed, 46 insertions, 578 deletions
diff --git a/sys/arch/alpha/alpha/dec_1000a.c b/sys/arch/alpha/alpha/dec_1000a.c index 0e2f5d76930..4e5e9b0e82d 100644 --- a/sys/arch/alpha/alpha/dec_1000a.c +++ b/sys/arch/alpha/alpha/dec_1000a.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dec_1000a.c,v 1.8 2014/05/08 20:46:49 miod Exp $ */ +/* $OpenBSD: dec_1000a.c,v 1.9 2017/04/30 13:04:49 mpi Exp $ */ /* $NetBSD: dec_1000a.c,v 1.14 2001/06/05 04:53:11 thorpej Exp $ */ /* @@ -103,15 +103,6 @@ void _dec_1000a_init(void); void dec_1000a_cons_init(void); void dec_1000a_device_register(struct device *, void *); -#ifdef KGDB -#include <machine/db_machdep.h> - -const char *kgdb_devlist[] = { - "com", - NULL, -}; -#endif /* KGDB */ - const struct alpha_variation_table dec_1000_variations[] = { { 0, "AlphaServer 1000" }, { 0, NULL }, @@ -233,10 +224,6 @@ dec_1000a_cons_init() panic("consinit: unknown console type %lu", (unsigned long)ctb->ctb_term_type); } -#ifdef KGDB - /* Attach the KGDB device. */ - alpha_kgdb_init(kgdb_devlist, iot); -#endif /* KGDB */ } void diff --git a/sys/arch/alpha/alpha/dec_kn300.c b/sys/arch/alpha/alpha/dec_kn300.c index fcce293235d..4ebbb5fa034 100644 --- a/sys/arch/alpha/alpha/dec_kn300.c +++ b/sys/arch/alpha/alpha/dec_kn300.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dec_kn300.c,v 1.8 2014/05/08 20:46:49 miod Exp $ */ +/* $OpenBSD: dec_kn300.c,v 1.9 2017/04/30 13:04:49 mpi Exp $ */ /* $NetBSD: dec_kn300.c,v 1.34 2007/03/04 15:18:10 yamt Exp $ */ /* @@ -80,15 +80,6 @@ void dec_kn300_init (void); void dec_kn300_cons_init (void); static void dec_kn300_device_register (struct device *, void *); -#ifdef KGDB -#include <machine/db_machdep.h> - -static const char *kgdb_devlist[] = { - "com", - NULL, -}; -#endif /* KGDB */ - #define ALPHASERVER_4100 "AlphaServer 4100" const struct alpha_variation_table dec_kn300_variations[] = { @@ -202,10 +193,6 @@ dec_kn300_cons_init() panic("consinit: unknown console type %lu", (unsigned long)ctb->ctb_term_type); } -#ifdef KGDB - /* Attach the KGDB device. */ - alpha_kgdb_init(kgdb_devlist, &ccp->cc_iot); -#endif /* KGDB */ } static void diff --git a/sys/arch/alpha/alpha/machdep.c b/sys/arch/alpha/alpha/machdep.c index 56ee777d1b2..8a22b6bcb71 100644 --- a/sys/arch/alpha/alpha/machdep.c +++ b/sys/arch/alpha/alpha/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.178 2017/04/27 11:48:08 mpi Exp $ */ +/* $OpenBSD: machdep.c,v 1.179 2017/04/30 13:04:49 mpi Exp $ */ /* $NetBSD: machdep.c,v 1.210 2000/06/01 17:12:38 thorpej Exp $ */ /*- @@ -764,10 +764,6 @@ nobootinfo: if (boothowto & RB_KDB) Debugger(); #endif -#ifdef KGDB - if (boothowto & RB_KDB) - kgdb_connect(0); -#endif /* * Figure out our clock frequency, from RPB fields. */ diff --git a/sys/arch/amd64/amd64/db_memrw.c b/sys/arch/amd64/amd64/db_memrw.c index 7c4a6540a05..8d75cc3baf4 100644 --- a/sys/arch/amd64/amd64/db_memrw.c +++ b/sys/arch/amd64/amd64/db_memrw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_memrw.c,v 1.7 2015/03/14 03:38:46 jsg Exp $ */ +/* $OpenBSD: db_memrw.c,v 1.8 2017/04/30 13:04:49 mpi Exp $ */ /* $NetBSD: db_memrw.c,v 1.1 2003/04/26 18:39:27 fvdl Exp $ */ /*- @@ -32,8 +32,6 @@ /* * Interface to the debugger for virtual memory read/write. - * This file is shared by DDB and KGDB, and must work even - * when only KGDB is included (thus no db_printf calls). * * To write in the text segment, we have to first make * the page writable, do the write, then restore the PTE. diff --git a/sys/arch/amd64/amd64/kgdb_machdep.c b/sys/arch/amd64/amd64/kgdb_machdep.c deleted file mode 100644 index b510b1890f4..00000000000 --- a/sys/arch/amd64/amd64/kgdb_machdep.c +++ /dev/null @@ -1,107 +0,0 @@ -/* $OpenBSD: kgdb_machdep.c,v 1.1 2005/11/13 17:51:52 fgsch Exp $ */ -/* - * Copyright (c) 2005 Federico G. Schwindt - * - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE OPENBSD PROJECT 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 OPENBSD - * PROJECT 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. - */ - -#include <sys/kgdb.h> - -int -kgdb_acc(vaddr_t va, size_t len) -{ - vaddr_t last_va; - pt_entry_t *pte; - - last_va = va + len; - va &= ~PGOFSET; - last_va &= PGOFSET; - - do { - pte = kvtopte(va); - if ((*pte & PG_V) == 0) - return (0); - va += NBPG; - } while (va < last_va); - - return (1); -} - -int -kgdb_signal(int type) -{ - switch (type) { - default: - return (SIGEMT); - } -} - -void -kgdb_getregs(db_regs_t *regs, kgdb_reg_t *gdb_regs) -{ - gdb_regs[ 0] = regs->tf_rax; - gdb_regs[ 1] = regs->tf_rbx; - gdb_regs[ 2] = regs->tf_rcx; - gdb_regs[ 3] = regs->tf_rdx; - gdb_regs[ 4] = regs->tf_rsi; - gdb_regs[ 5] = regs->tf_rdi; - gdb_regs[ 6] = regs->tf_rbp; - gdb_regs[ 7] = regs->tf_rsp; - gdb_regs[ 8] = regs->tf_r8; - gdb_regs[ 9] = regs->tf_r9; - gdb_regs[10] = regs->tf_r10; - gdb_regs[11] = regs->tf_r11; - gdb_regs[12] = regs->tf_r12; - gdb_regs[13] = regs->tf_r13; - gdb_regs[14] = regs->tf_r14; - gdb_regs[15] = regs->tf_r15; - gdb_regs[16] = regs->tf_rip; - /* XXX: 32bits but defined as 64 */ - gdb_regs[17] = regs->tf_rflags; - gdb_regs[18] = regs->tf_cs; - gdb_regs[19] = regs->tf_ss; -} - -void -kgdb_setregs(db_regs_t *regs, kgdb_reg_t *gdb_regs) -{ - regs->tf_rax = gdb_regs[ 0]; - regs->tf_rbx = gdb_regs[ 1]; - regs->tf_rcx = gdb_regs[ 2]; - regs->tf_rdx = gdb_regs[ 3]; - regs->tf_rsi = gdb_regs[ 4]; - regs->tf_rdi = gdb_regs[ 5]; - regs->tf_rbp = gdb_regs[ 6]; - regs->tf_rsp = gdb_regs[ 7]; - regs->tf_r8 = gdb_regs[ 8]; - regs->tf_r9 = gdb_regs[ 9]; - regs->tf_r10 = gdb_regs[10]; - regs->tf_r11 = gdb_regs[11]; - regs->tf_r12 = gdb_regs[12]; - regs->tf_r13 = gdb_regs[13]; - regs->tf_r14 = gdb_regs[14]; - regs->tf_r15 = gdb_regs[15]; - regs->tf_rip = gdb_regs[16]; - regs->tf_rflags = gdb_regs[17]; - regs->tf_cs = gdb_regs[18]; - regs->tf_ss = gdb_regs[19]; -} diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c index 09b16d93546..e8289c206f4 100644 --- a/sys/arch/amd64/amd64/machdep.c +++ b/sys/arch/amd64/amd64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.226 2017/03/11 11:55:03 mpi Exp $ */ +/* $OpenBSD: machdep.c,v 1.227 2017/04/30 13:04:49 mpi Exp $ */ /* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */ /*- @@ -87,10 +87,6 @@ #include <sys/kcore.h> #include <sys/syscallargs.h> -#ifdef KGDB -#include <sys/kgdb.h> -#endif - #include <dev/cons.h> #include <stand/boot/bootarg.h> @@ -268,28 +264,6 @@ void map_tramps(void); void init_x86_64(paddr_t); void (*cpuresetfn)(void); -#ifdef KGDB -#ifndef KGDB_DEVNAME -#define KGDB_DEVNAME "com" -#endif /* KGDB_DEVNAME */ -char kgdb_devname[] = KGDB_DEVNAME; -#if NCOM > 0 -#ifndef KGDBADDR -#define KGDBADDR 0x3f8 -#endif /* KGDBADDR */ -int comkgdbaddr = KGDBADDR; -#ifndef KGDBRATE -#define KGDBRATE TTYDEF_SPEED -#endif /* KGDBRATE */ -int comkgdbrate = KGDBRATE; -#ifndef KGDBMODE -#define KGDBMODE ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8) -#endif /* KGDBMODE */ -int comkgdbmode = KGDBMODE; -#endif /* NCOM */ -void kgdb_port_init(void); -#endif /* KGDB */ - #ifdef APERTURE int allowaperture = 0; #endif @@ -1630,29 +1604,8 @@ init_x86_64(paddr_t first_avail) if (boothowto & RB_KDB) Debugger(); #endif -#ifdef KGDB - kgdb_port_init(); - if (boothowto & RB_KDB) { - kgdb_debug_init = 1; - kgdb_connect(1); - } -#endif } -#ifdef KGDB -void -kgdb_port_init(void) -{ -#if NCOM > 0 - if (!strcmp(kgdb_devname, "com")) { - bus_space_tag_t tag = X86_BUS_SPACE_IO; - com_kgdb_attach(tag, comkgdbaddr, comkgdbrate, COM_FREQ, - comkgdbmode); - } -#endif -} -#endif /* KGDB */ - void cpu_reset(void) { diff --git a/sys/arch/amd64/amd64/trap.c b/sys/arch/amd64/amd64/trap.c index 771a1e8ae14..d57493248ab 100644 --- a/sys/arch/amd64/amd64/trap.c +++ b/sys/arch/amd64/amd64/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.53 2017/03/03 20:49:47 bluhm Exp $ */ +/* $OpenBSD: trap.c,v 1.54 2017/04/30 13:04:49 mpi Exp $ */ /* $NetBSD: trap.c,v 1.2 2003/05/04 23:51:56 fvdl Exp $ */ /*- @@ -93,10 +93,6 @@ #include "isa.h" -#ifdef KGDB -#include <sys/kgdb.h> -#endif - void trap(struct trapframe *); void ast(struct trapframe *); void syscall(struct trapframe *); @@ -180,20 +176,6 @@ trap(struct trapframe *frame) default: we_re_toast: -#ifdef KGDB - if (kgdb_trap(type, frame)) - return; - else { - /* - * If this is a breakpoint, don't panic - * if we're not connected. - */ - if (type == T_BPTFLT) { - printf("kgdb: ignored %s\n", trap_type[type]); - return; - } - } -#endif #ifdef DDB if (db_ktrap(type, 0, frame)) return; @@ -427,19 +409,12 @@ faultcommon: #if NISA > 0 case T_NMI: case T_NMI|T_USER: -#if defined(KGDB) || defined(DDB) +#ifdef DDB /* NMI can be hooked up to a pushbutton for debugging */ printf ("NMI ... going to debugger\n"); -#ifdef KGDB - - if (kgdb_trap(type, frame)) - return; -#endif -#ifdef DDB if (db_ktrap(type, 0, frame)) return; #endif -#endif /* KGDB || DDB */ /* machine/parity/power fail/"kitchen sink" faults */ if (x86_nmi() != 0) diff --git a/sys/arch/amd64/conf/files.amd64 b/sys/arch/amd64/conf/files.amd64 index ab744edcbde..2700c7c7158 100644 --- a/sys/arch/amd64/conf/files.amd64 +++ b/sys/arch/amd64/conf/files.amd64 @@ -1,4 +1,4 @@ -# $OpenBSD: files.amd64,v 1.87 2017/01/21 10:58:15 reyk Exp $ +# $OpenBSD: files.amd64,v 1.88 2017/04/30 13:04:49 mpi Exp $ maxpartitions 16 maxusers 2 16 128 @@ -50,14 +50,12 @@ file arch/amd64/amd64/dkcsum.c bios file arch/amd64/amd64/db_disasm.c ddb file arch/amd64/amd64/db_interface.c ddb -file arch/amd64/amd64/db_memrw.c ddb | kgdb +file arch/amd64/amd64/db_memrw.c ddb file arch/amd64/amd64/db_trace.c ddb file netinet/in_cksum.c file netinet/in4_cksum.c -file arch/amd64/amd64/kgdb_machdep.c kgdb - # Basic clock - required file arch/amd64/isa/clock.c diff --git a/sys/arch/amd64/include/cpufunc.h b/sys/arch/amd64/include/cpufunc.h index bda18a00287..0063241a4f9 100644 --- a/sys/arch/amd64/include/cpufunc.h +++ b/sys/arch/amd64/include/cpufunc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpufunc.h,v 1.14 2017/04/27 06:16:39 mlarkin Exp $ */ +/* $OpenBSD: cpufunc.h,v 1.15 2017/04/30 13:04:49 mpi Exp $ */ /* $NetBSD: cpufunc.h,v 1.3 2003/05/08 10:27:43 fvdl Exp $ */ /*- @@ -345,7 +345,7 @@ xgetbv(uint32_t reg) return (((uint64_t)hi << 32) | (uint64_t)lo); } -/* Break into DDB/KGDB. */ +/* Break into DDB. */ static __inline void breakpoint(void) { diff --git a/sys/arch/amd64/include/db_machdep.h b/sys/arch/amd64/include/db_machdep.h index 6d554ebc9e3..643b1d43780 100644 --- a/sys/arch/amd64/include/db_machdep.h +++ b/sys/arch/amd64/include/db_machdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: db_machdep.h,v 1.15 2016/09/04 09:22:28 mpi Exp $ */ +/* $OpenBSD: db_machdep.h,v 1.16 2017/04/30 13:04:49 mpi Exp $ */ /* $NetBSD: db_machdep.h,v 1.2 2003/04/29 17:06:04 scw Exp $ */ /* @@ -76,15 +76,6 @@ extern db_regs_t ddb_regs; /* register state */ (((ins)&0xff) == I_CALLI && \ ((ins)&0x3800) == 0x1000)) -/* - * Constants for KGDB. - */ -typedef long kgdb_reg_t; -#define KGDB_NUMREGS 20 -#define KGDB_BUFLEN 512 - -#define KGDB_ENTER breakpoint() - /* macro for checking if a thread has used floating-point */ int db_ktrap(int, int, db_regs_t *); diff --git a/sys/arch/arm/arm/fault.c b/sys/arch/arm/arm/fault.c index 9ff47c590ba..7ed4ce466b3 100644 --- a/sys/arch/arm/arm/fault.c +++ b/sys/arch/arm/arm/fault.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fault.c,v 1.27 2017/01/21 05:42:03 guenther Exp $ */ +/* $OpenBSD: fault.c,v 1.28 2017/04/30 13:04:49 mpi Exp $ */ /* $NetBSD: fault.c,v 1.46 2004/01/21 15:39:21 skrll Exp $ */ /* @@ -94,14 +94,8 @@ #include <machine/frame.h> #include <machine/cpu.h> #include <machine/intr.h> -#if defined(DDB) || defined(KGDB) +#ifdef DDB #include <machine/db_machdep.h> -#ifdef KGDB -#include <sys/kgdb.h> -#endif -#if !defined(DDB) -#define db_ktrap kgdb_trap -#endif #endif #include <arm/db_machdep.h> @@ -417,7 +411,7 @@ dab_fatal(trapframe_t *tf, u_int fsr, u_int far, struct proc *p, tf->tf_svc_sp, tf->tf_svc_lr); printf(", pc =%08lx\n\n", tf->tf_pc); -#if defined(DDB) || defined(KGDB) +#ifdef DDB db_ktrap(T_FAULT, tf); #endif panic("Fatal abort"); diff --git a/sys/arch/arm/arm/undefined.c b/sys/arch/arm/arm/undefined.c index 4fb64cbff99..95a9d451b4c 100644 --- a/sys/arch/arm/arm/undefined.c +++ b/sys/arch/arm/arm/undefined.c @@ -1,4 +1,4 @@ -/* $OpenBSD: undefined.c,v 1.8 2016/06/10 06:32:36 jsg Exp $ */ +/* $OpenBSD: undefined.c,v 1.9 2017/04/30 13:04:49 mpi Exp $ */ /* $NetBSD: undefined.c,v 1.22 2003/11/29 22:21:29 bjh21 Exp $ */ /* @@ -115,9 +115,6 @@ gdb_trapper(u_int addr, u_int insn, struct trapframe *frame, int code) trapsignal(p, SIGTRAP, 0, TRAP_BRKPT, sv); return 0; } -#ifdef KGDB - return !kgdb_trap(T_BREAKPOINT, frame); -#endif } return 1; } diff --git a/sys/arch/arm/conf/files.arm b/sys/arch/arm/conf/files.arm index 671bc3fbed6..9dae5a17689 100644 --- a/sys/arch/arm/conf/files.arm +++ b/sys/arch/arm/conf/files.arm @@ -1,4 +1,4 @@ -# $OpenBSD: files.arm,v 1.45 2017/04/27 22:41:46 kettenis Exp $ +# $OpenBSD: files.arm,v 1.46 2017/04/30 13:04:49 mpi Exp $ # $NetBSD: files.arm,v 1.76 2003/11/05 12:53:15 scw Exp $ # generic networking files @@ -6,10 +6,9 @@ file arch/arm/arm/in_cksum_arm.S # DDB file arch/arm/arm/db_disasm.c ddb -file arch/arm/arm/db_interface.c (ddb|kgdb) +file arch/arm/arm/db_interface.c ddb file arch/arm/arm/db_trace.c ddb file arch/arm/arm/db_machdep.c ddb -file arch/arm/arm/kgdb_machdep.c kgdb file arch/arm/arm/disassem.c ddb # FIQ support diff --git a/sys/arch/arm64/dev/pluart.c b/sys/arch/arm64/dev/pluart.c index 3d468709044..f61b4e61ce2 100644 --- a/sys/arch/arm64/dev/pluart.c +++ b/sys/arch/arm64/dev/pluart.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pluart.c,v 1.3 2017/04/11 15:16:14 kettenis Exp $ */ +/* $OpenBSD: pluart.c,v 1.4 2017/04/30 13:04:49 mpi Exp $ */ /* * Copyright (c) 2014 Patrick Wildt <patrick@blueri.se> @@ -145,7 +145,6 @@ struct pluart_softc { #define COM_HW_FIFO 0x02 #define COM_HW_SIR 0x20 #define COM_HW_CONSOLE 0x40 -#define COM_HW_KGDB 0x80 u_int8_t sc_swflags; #define COM_SW_SOFTCAR 0x01 #define COM_SW_CLOCAL 0x02 diff --git a/sys/arch/arm64/include/machine_reg.h b/sys/arch/arm64/include/machine_reg.h index 033d6603cdc..114a7529a2a 100644 --- a/sys/arch/arm64/include/machine_reg.h +++ b/sys/arch/arm64/include/machine_reg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: machine_reg.h,v 1.1 2016/12/17 23:38:33 patrick Exp $ */ +/* $OpenBSD: machine_reg.h,v 1.2 2017/04/30 13:04:49 mpi Exp $ */ /* * Copyright (c) 2002, 2003 Genetec Corporation. All rights reserved. @@ -43,7 +43,7 @@ #define MACHINE_AGPIO_VBASE 0xfd300000 #define MACHINE_VBASE_FREE 0xfd400000 /* FFUART and/or BTUART are mapped to this area when - used for console or kgdb port */ + used for console */ #define ioreg_read(a) (*(volatile unsigned *)(a)) #define ioreg_write(a,v) (*(volatile unsigned *)(a)=(v)) diff --git a/sys/arch/armv7/dev/pluart.c b/sys/arch/armv7/dev/pluart.c index 5374438c2c6..af078552f2f 100644 --- a/sys/arch/armv7/dev/pluart.c +++ b/sys/arch/armv7/dev/pluart.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pluart.c,v 1.2 2017/04/11 15:16:14 kettenis Exp $ */ +/* $OpenBSD: pluart.c,v 1.3 2017/04/30 13:04:49 mpi Exp $ */ /* * Copyright (c) 2014 Patrick Wildt <patrick@blueri.se> @@ -146,7 +146,6 @@ struct pluart_softc { #define COM_HW_FIFO 0x02 #define COM_HW_SIR 0x20 #define COM_HW_CONSOLE 0x40 -#define COM_HW_KGDB 0x80 u_int8_t sc_swflags; #define COM_SW_SOFTCAR 0x01 #define COM_SW_CLOCAL 0x02 diff --git a/sys/arch/armv7/exynos/exuart.c b/sys/arch/armv7/exynos/exuart.c index fc66293a774..aaea9a7cca3 100644 --- a/sys/arch/armv7/exynos/exuart.c +++ b/sys/arch/armv7/exynos/exuart.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exuart.c,v 1.10 2017/03/07 20:14:20 kettenis Exp $ */ +/* $OpenBSD: exuart.c,v 1.11 2017/04/30 13:04:49 mpi Exp $ */ /* * Copyright (c) 2005 Dale Rahn <drahn@motorola.com> * @@ -74,7 +74,6 @@ struct exuart_softc { #define COM_HW_FIFO 0x02 #define COM_HW_SIR 0x20 #define COM_HW_CONSOLE 0x40 -#define COM_HW_KGDB 0x80 u_int8_t sc_swflags; #define COM_SW_SOFTCAR 0x01 #define COM_SW_CLOCAL 0x02 diff --git a/sys/arch/armv7/imx/imxuart.c b/sys/arch/armv7/imx/imxuart.c index e4e0b1d2cae..1b460568b06 100644 --- a/sys/arch/armv7/imx/imxuart.c +++ b/sys/arch/armv7/imx/imxuart.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imxuart.c,v 1.13 2016/12/28 22:45:24 kettenis Exp $ */ +/* $OpenBSD: imxuart.c,v 1.14 2017/04/30 13:04:49 mpi Exp $ */ /* * Copyright (c) 2005 Dale Rahn <drahn@motorola.com> * @@ -74,7 +74,6 @@ struct imxuart_softc { #define COM_HW_FIFO 0x02 #define COM_HW_SIR 0x20 #define COM_HW_CONSOLE 0x40 -#define COM_HW_KGDB 0x80 u_int8_t sc_swflags; #define COM_SW_SOFTCAR 0x01 #define COM_SW_CLOCAL 0x02 diff --git a/sys/arch/armv7/include/machine_reg.h b/sys/arch/armv7/include/machine_reg.h index 5b0fd83d8b9..645c045091b 100644 --- a/sys/arch/armv7/include/machine_reg.h +++ b/sys/arch/armv7/include/machine_reg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: machine_reg.h,v 1.1 2013/09/04 14:38:28 patrick Exp $ */ +/* $OpenBSD: machine_reg.h,v 1.2 2017/04/30 13:04:49 mpi Exp $ */ /* * Copyright (c) 2002, 2003 Genetec Corporation. All rights reserved. @@ -43,7 +43,7 @@ #define MACHINE_AGPIO_VBASE 0xfd300000 #define MACHINE_VBASE_FREE 0xfd400000 /* FFUART and/or BTUART are mapped to this area when - used for console or kgdb port */ + used for console */ #define ioreg_read(a) (*(volatile unsigned *)(a)) #define ioreg_write(a,v) (*(volatile unsigned *)(a)=(v)) diff --git a/sys/arch/i386/conf/files.i386 b/sys/arch/i386/conf/files.i386 index a170dd10547..2ca9e1264fd 100644 --- a/sys/arch/i386/conf/files.i386 +++ b/sys/arch/i386/conf/files.i386 @@ -1,4 +1,4 @@ -# $OpenBSD: files.i386,v 1.231 2017/01/21 10:58:15 reyk Exp $ +# $OpenBSD: files.i386,v 1.232 2017/04/30 13:04:49 mpi Exp $ # # new style config file for i386 architecture # @@ -14,7 +14,7 @@ file arch/i386/i386/bus_dma.c file arch/i386/i386/conf.c file arch/i386/i386/db_disasm.c ddb file arch/i386/i386/db_interface.c ddb -file arch/i386/i386/db_memrw.c ddb | kgdb +file arch/i386/i386/db_memrw.c ddb file arch/i386/i386/db_trace.c ddb file arch/i386/i386/disksubr.c disk file arch/i386/i386/est.c !small_kernel @@ -24,7 +24,6 @@ file arch/i386/i386/machdep.c file arch/i386/i386/hibernate_machdep.c hibernate file arch/i386/i386/via.c file arch/i386/i386/amd64errata.c !small_kernel -file arch/i386/i386/kgdb_machdep.c kgdb file arch/i386/i386/longrun.c !small_kernel file arch/i386/i386/mem.c file arch/i386/i386/i686_mem.c mtrr diff --git a/sys/arch/i386/i386/db_memrw.c b/sys/arch/i386/i386/db_memrw.c index cc28763301f..39b72c99a3d 100644 --- a/sys/arch/i386/i386/db_memrw.c +++ b/sys/arch/i386/i386/db_memrw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_memrw.c,v 1.16 2015/12/18 08:15:09 gerhard Exp $ */ +/* $OpenBSD: db_memrw.c,v 1.17 2017/04/30 13:04:49 mpi Exp $ */ /* $NetBSD: db_memrw.c,v 1.6 1999/04/12 20:38:19 pk Exp $ */ /* @@ -31,7 +31,7 @@ /* * Routines to read and write memory on behalf of the debugger, used - * by DDB and KGDB. + * by DDB. */ #include <sys/param.h> diff --git a/sys/arch/i386/i386/kgdb_machdep.c b/sys/arch/i386/i386/kgdb_machdep.c deleted file mode 100644 index 1a46515fd7c..00000000000 --- a/sys/arch/i386/i386/kgdb_machdep.c +++ /dev/null @@ -1,204 +0,0 @@ -/* $OpenBSD: kgdb_machdep.c,v 1.13 2015/06/28 01:11:27 guenther Exp $ */ -/* $NetBSD: kgdb_machdep.c,v 1.6 1998/08/13 21:36:03 thorpej Exp $ */ - -/*- - * Copyright (c) 1997 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, - * NASA Ames Research Center. - * - * 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. - * - * 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) 1996 Matthias Pfaller. - * All rights reserved. - * - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. - */ - -#if defined(DDB) -#error "Can't build DDB and KGDB together." -#endif - -/* - * Machine-dependent functions for remote KGDB. Originally written - * for NetBSD/pc532 by Matthias Pfaller. Modified for NetBSD/i386 - * by Jason R. Thorpe. - */ - -#include <sys/param.h> -#include <sys/kgdb.h> -#include <sys/systm.h> - -#include <uvm/uvm_extern.h> - -#include <machine/pte.h> -#include <machine/reg.h> -#include <machine/trap.h> - -/* - * Determine if the memory at va..(va+len) is valid. - */ -int -kgdb_acc(vaddr_t va, size_t len) -{ - vaddr_t last_va; - - last_va = va + len; - va &= ~PGOFSET; - last_va &= ~PGOFSET; - - do { - if ((pmap_pte_bits(va) & PG_V) == 0) - return (0); - va += NBPG; - } while (va < last_va); - - return (1); -} - -/* - * Translate a trap number into a unix compatible signal value. - * (gdb only understands unix signal numbers). - */ -int -kgdb_signal(int type) -{ - switch (type) { - case T_NMI: - return (SIGINT); - - case T_ALIGNFLT: - return (SIGILL); - - case T_BPTFLT: - case T_TRCTRAP: - return (SIGTRAP); - - case T_DOUBLEFLT: - return (SIGEMT); - - case T_ARITHTRAP: - case T_DIVIDE: - case T_OFLOW: - case T_DNA: - case T_FPOPFLT: - return (SIGFPE); - - case T_PRIVINFLT: - case T_PROTFLT: - case T_PAGEFLT: - case T_TSSFLT: - case T_SEGNPFLT: - case T_STKFLT: - return (SIGSEGV); - - case T_BOUND: - return (SIGURG); - - default: - return (SIGEMT); - } -} - -/* - * Translate the values stored in the kernel regs struct to the format - * understood by gdb. - */ -void -kgdb_getregs(db_regs_t *regs, kgdb_reg_t *gdb_regs) -{ - - gdb_regs[ 0] = regs->tf_eax; - gdb_regs[ 1] = regs->tf_ecx; - gdb_regs[ 2] = regs->tf_edx; - gdb_regs[ 3] = regs->tf_ebx; - gdb_regs[ 5] = regs->tf_ebp; - gdb_regs[ 6] = regs->tf_esi; - gdb_regs[ 7] = regs->tf_edi; - gdb_regs[ 8] = regs->tf_eip; - gdb_regs[ 9] = regs->tf_eflags; - gdb_regs[10] = regs->tf_cs; - gdb_regs[12] = regs->tf_ds; - gdb_regs[13] = regs->tf_es; - gdb_regs[14] = regs->tf_fs; - gdb_regs[15] = regs->tf_gs; - - if (KERNELMODE(regs->tf_cs, regs->tf_eflags)) { - /* - * Kernel mode - esp and ss not saved. - */ - gdb_regs[ 4] = (kgdb_reg_t)®s->tf_esp; /* kernel stack - pointer */ - __asm volatile("movw %%ss,%w0" : "=r" (gdb_regs[11])); - } -} - -/* - * Reverse the above. - */ -void -kgdb_setregs(db_regs_t *regs, kgdb_reg_t *gdb_regs) -{ - - regs->tf_eax = gdb_regs[ 0]; - regs->tf_ecx = gdb_regs[ 1]; - regs->tf_edx = gdb_regs[ 2]; - regs->tf_ebx = gdb_regs[ 3]; - regs->tf_ebp = gdb_regs[ 5]; - regs->tf_esi = gdb_regs[ 6]; - regs->tf_edi = gdb_regs[ 7]; - regs->tf_eip = gdb_regs[ 8]; - regs->tf_eflags = gdb_regs[ 9]; - regs->tf_cs = gdb_regs[10]; - regs->tf_ds = gdb_regs[12]; - regs->tf_es = gdb_regs[13]; - - if (KERNELMODE(regs->tf_cs, regs->tf_eflags) == 0) { - /* - * Trapped in user mode - restore esp and ss. - */ - regs->tf_esp = gdb_regs[ 4]; - regs->tf_ss = gdb_regs[11]; - } -} diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index 5c0fa2f6dd1..b66741c801e 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.598 2017/03/11 11:55:03 mpi Exp $ */ +/* $OpenBSD: machdep.c,v 1.599 2017/04/30 13:04:49 mpi Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -92,10 +92,6 @@ #include <sys/kcore.h> #include <sys/sensors.h> -#ifdef KGDB -#include <sys/kgdb.h> -#endif - #include <dev/cons.h> #include <stand/boot/bootarg.h> @@ -287,28 +283,6 @@ void (*cpuresetfn)(void); int bus_mem_add_mapping(bus_addr_t, bus_size_t, int, bus_space_handle_t *); -#ifdef KGDB -#ifndef KGDB_DEVNAME -#define KGDB_DEVNAME "com" -#endif /* KGDB_DEVNAME */ -char kgdb_devname[] = KGDB_DEVNAME; -#if NCOM > 0 -#ifndef KGDBADDR -#define KGDBADDR 0x3f8 -#endif -int comkgdbaddr = KGDBADDR; -#ifndef KGDBRATE -#define KGDBRATE TTYDEF_SPEED -#endif -int comkgdbrate = KGDBRATE; -#ifndef KGDBMODE -#define KGDBMODE ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8) /* 8N1 */ -#endif -int comkgdbmode = KGDBMODE; -#endif /* NCOM > 0 */ -void kgdb_port_init(void); -#endif /* KGDB */ - #ifdef APERTURE int allowaperture = 0; #endif @@ -3405,13 +3379,6 @@ init386(paddr_t first_avail) if (boothowto & RB_KDB) Debugger(); #endif -#ifdef KGDB - kgdb_port_init(); - if (boothowto & RB_KDB) { - kgdb_debug_init = 1; - kgdb_connect(1); - } -#endif /* KGDB */ softintr_init(); } @@ -3426,21 +3393,6 @@ consinit(void) /* Already done in init386(). */ } -#ifdef KGDB -void -kgdb_port_init(void) -{ - -#if NCOM > 0 - if (!strcmp(kgdb_devname, "com")) { - bus_space_tag_t tag = I386_BUS_SPACE_IO; - com_kgdb_attach(tag, comkgdbaddr, comkgdbrate, COM_FREQ, - comkgdbmode); - } -#endif -} -#endif /* KGDB */ - void cpu_reset(void) { diff --git a/sys/arch/i386/i386/trap.c b/sys/arch/i386/i386/trap.c index c2a036b9425..018c17afd11 100644 --- a/sys/arch/i386/i386/trap.c +++ b/sys/arch/i386/i386/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.129 2017/04/08 03:29:13 mlarkin Exp $ */ +/* $OpenBSD: trap.c,v 1.130 2017/04/30 13:04:49 mpi Exp $ */ /* $NetBSD: trap.c,v 1.95 1996/05/05 06:50:02 mycroft Exp $ */ /*- @@ -62,10 +62,6 @@ #include <machine/db_machdep.h> #endif -#ifdef KGDB -#include <sys/kgdb.h> -#endif - #include <sys/exec.h> #ifdef KVM86 #include <machine/kvm86.h> @@ -159,28 +155,13 @@ trap(struct trapframe *frame) /* trace trap */ case T_TRCTRAP: -#if !(defined(DDB) || defined(KGDB)) +#ifndef DDB return; /* Just return if no kernel debugger */ #endif /* FALLTHROUGH */ default: we_re_toast: -#ifdef KGDB - if (kgdb_trap(type, frame)) - return; - else { - /* - * If this is a breakpoint, don't panic - * if we're not connected. - */ - if (type == T_BPTFLT) { - printf("kgdb: ignored %s\n", trap_type[type]); - return; - } - } -#endif - #ifdef DDB if (db_ktrap(type, 0, frame)) return; @@ -457,7 +438,7 @@ trap(struct trapframe *frame) } #if 0 /* Should this be left out? */ -#if !defined(DDB) && !defined(KGDB) +#if !defined(DDB) /* XXX need to deal with this when DDB is present, too */ case T_TRCTRAP: /* kernel trace trap; someone single stepping lcall's */ /* syscall has to turn off the trace bit itself */ @@ -481,18 +462,12 @@ trap(struct trapframe *frame) #if NISA > 0 case T_NMI: case T_NMI|T_USER: -#if defined(DDB) || defined(KGDB) +#ifdef DDB /* NMI can be hooked up to a pushbutton for debugging */ printf ("NMI ... going to debugger\n"); -#ifdef KGDB - if (kgdb_trap(type, frame)) - return; -#endif -#ifdef DDB if (db_ktrap(type, 0, frame)) return; #endif -#endif /* DDB || KGDB */ /* machine/parity/power fail/"kitchen sink" faults */ if (isa_nmi() == 0) return; diff --git a/sys/arch/i386/include/cpufunc.h b/sys/arch/i386/include/cpufunc.h index 2262237c229..3bcd61ab84f 100644 --- a/sys/arch/i386/include/cpufunc.h +++ b/sys/arch/i386/include/cpufunc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpufunc.h,v 1.23 2017/02/06 09:13:41 mpi Exp $ */ +/* $OpenBSD: cpufunc.h,v 1.24 2017/04/30 13:04:49 mpi Exp $ */ /* $NetBSD: cpufunc.h,v 1.8 1994/10/27 04:15:59 cgd Exp $ */ /* @@ -303,7 +303,7 @@ wrmsr_locked(u_int msr, u_int code, u_int64_t newval) : "A" (newval), "c" (msr), "D" (code)); } -/* Break into DDB/KGDB. */ +/* Break into DDB. */ static __inline void breakpoint(void) { diff --git a/sys/arch/i386/include/db_machdep.h b/sys/arch/i386/include/db_machdep.h index 5d9fb9bd5e8..2654c691e23 100644 --- a/sys/arch/i386/include/db_machdep.h +++ b/sys/arch/i386/include/db_machdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: db_machdep.h,v 1.26 2017/02/06 09:13:41 mpi Exp $ */ +/* $OpenBSD: db_machdep.h,v 1.27 2017/04/30 13:04:49 mpi Exp $ */ /* $NetBSD: db_machdep.h,v 1.9 1996/05/03 19:23:59 christos Exp $ */ /* @@ -75,15 +75,6 @@ extern db_regs_t ddb_regs; /* register state */ #define DB_MACHINE_COMMANDS -/* - * Constants for KGDB. - */ -typedef long kgdb_reg_t; -#define KGDB_NUMREGS 16 -#define KGDB_BUFLEN 512 - -#define KGDB_ENTER breakpoint() - /* macro for checking if a thread has used floating-point */ int db_ktrap(int, int, db_regs_t *); diff --git a/sys/arch/sgi/hpc/zs.c b/sys/arch/sgi/hpc/zs.c index 1f452b0a70a..cc52bb13a0f 100644 --- a/sys/arch/sgi/hpc/zs.c +++ b/sys/arch/sgi/hpc/zs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: zs.c,v 1.13 2014/12/07 13:12:05 miod Exp $ */ +/* $OpenBSD: zs.c,v 1.14 2017/04/30 13:04:49 mpi Exp $ */ /* $NetBSD: zs.c,v 1.37 2011/02/20 07:59:50 matt Exp $ */ /*- @@ -558,17 +558,15 @@ zs_write_data(struct zs_chanstate *cs, uint8_t val) void zs_abort(struct zs_chanstate *cs) { -#if defined(KGDB) - zskgdb(cs); -#elif defined(DDB) +#if defined(DDB) Debugger(); #endif } -/*********************************************************/ -/* Polled character I/O functions for console and KGDB */ -/*********************************************************/ +/*****************************************************/ +/* Polled character I/O functions for console KGDB */ +/*****************************************************/ struct zschan * zs_get_chan_addr(int zs_unit, int channel) diff --git a/sys/arch/sparc64/dev/cons.h b/sys/arch/sparc64/dev/cons.h index 0419815fbe7..71a1b9d382c 100644 --- a/sys/arch/sparc64/dev/cons.h +++ b/sys/arch/sparc64/dev/cons.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cons.h,v 1.3 2007/03/07 06:23:04 miod Exp $ */ +/* $OpenBSD: cons.h,v 1.4 2017/04/30 13:04:49 mpi Exp $ */ /* $NetBSD: cons.h,v 1.3 2000/05/19 05:26:17 eeh Exp $ */ /*- @@ -45,8 +45,3 @@ extern void zs_putc(void *arg, int c); struct zschan * zs_get_chan_addr(int zsc_unit, int channel); - -#ifdef KGDB -void zs_kgdb_init(void); -void zskgdb(struct zs_chanstate *); -#endif diff --git a/sys/arch/sparc64/dev/zs.c b/sys/arch/sparc64/dev/zs.c index 3e6c99b6fa6..5c2668a09b8 100644 --- a/sys/arch/sparc64/dev/zs.c +++ b/sys/arch/sparc64/dev/zs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: zs.c,v 1.27 2015/02/05 12:04:58 miod Exp $ */ +/* $OpenBSD: zs.c,v 1.28 2017/04/30 13:04:49 mpi Exp $ */ /* $NetBSD: zs.c,v 1.29 2001/05/30 15:24:24 lukem Exp $ */ /*- @@ -689,9 +689,7 @@ zs_abort(cs) ZS_DELAY(); } while (rr0 & ZSRR0_BREAK); -#if defined(KGDB) - zskgdb(cs); -#elif defined(DDB) +#if defined(DDB) { extern int db_active; |