It doesn't compile und hasn't been working during the last decade.
ok kettenis@, deraadt@
-/* $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 $ */
/*
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 },
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
-/* $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 $ */
/*
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[] = {
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
-/* $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 $ */
/*-
if (boothowto & RB_KDB)
Debugger();
-#endif
-#ifdef KGDB
- if (boothowto & RB_KDB)
- kgdb_connect(0);
#endif
/*
* Figure out our clock frequency, from RPB fields.
-/* $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 $ */
/*-
/*
* 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.
+++ /dev/null
-/* $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];
-}
-/* $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 $ */
/*-
#include <sys/kcore.h>
#include <sys/syscallargs.h>
-#ifdef KGDB
-#include <sys/kgdb.h>
-#endif
-
#include <dev/cons.h>
#include <stand/boot/bootarg.h>
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
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)
{
-/* $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 $ */
/*-
#include "isa.h"
-#ifdef KGDB
-#include <sys/kgdb.h>
-#endif
-
void trap(struct trapframe *);
void ast(struct trapframe *);
void syscall(struct trapframe *);
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;
#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)
-# $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
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
-/* $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 $ */
/*-
return (((uint64_t)hi << 32) | (uint64_t)lo);
}
-/* Break into DDB/KGDB. */
+/* Break into DDB. */
static __inline void
breakpoint(void)
{
-/* $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 $ */
/*
(((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 *);
-/* $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 $ */
/*
#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>
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");
-/* $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 $ */
/*
trapsignal(p, SIGTRAP, 0, TRAP_BRKPT, sv);
return 0;
}
-#ifdef KGDB
- return !kgdb_trap(T_BREAKPOINT, frame);
-#endif
}
return 1;
}
-# $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
# 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
-/* $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>
#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
-/* $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.
#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))
-/* $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>
#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
-/* $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>
*
#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
-/* $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>
*
#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
-/* $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.
#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))
-# $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
#
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
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
-/* $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 $ */
/*
/*
* Routines to read and write memory on behalf of the debugger, used
- * by DDB and KGDB.
+ * by DDB.
*/
#include <sys/param.h>
+++ /dev/null
-/* $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];
- }
-}
-/* $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 $ */
/*-
#include <sys/kcore.h>
#include <sys/sensors.h>
-#ifdef KGDB
-#include <sys/kgdb.h>
-#endif
-
#include <dev/cons.h>
#include <stand/boot/bootarg.h>
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
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();
}
/* 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)
{
-/* $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 $ */
/*-
#include <machine/db_machdep.h>
#endif
-#ifdef KGDB
-#include <sys/kgdb.h>
-#endif
-
#include <sys/exec.h>
#ifdef KVM86
#include <machine/kvm86.h>
/* 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;
}
#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 */
#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;
-/* $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 $ */
/*
: "A" (newval), "c" (msr), "D" (code));
}
-/* Break into DDB/KGDB. */
+/* Break into DDB. */
static __inline void
breakpoint(void)
{
-/* $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 $ */
/*
#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 *);
-/* $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 $ */
/*-
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)
-/* $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 $ */
/*-
struct zschan *
zs_get_chan_addr(int zsc_unit, int channel);
-
-#ifdef KGDB
-void zs_kgdb_init(void);
-void zskgdb(struct zs_chanstate *);
-#endif
-/* $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 $ */
/*-
ZS_DELAY();
} while (rr0 & ZSRR0_BREAK);
-#if defined(KGDB)
- zskgdb(cs);
-#elif defined(DDB)
+#if defined(DDB)
{
extern int db_active;
-# $OpenBSD: files,v 1.642 2017/04/28 13:50:54 mpi Exp $
+# $OpenBSD: files,v 1.643 2017/04/30 13:04:49 mpi Exp $
# $NetBSD: files,v 1.87 1996/05/19 17:17:50 jonathan Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
# XXX machine-independent SCSI files should live somewhere here, maybe
# kernel sources
-file ddb/db_access.c ddb | kgdb
+file ddb/db_access.c ddb
file ddb/db_break.c ddb
file ddb/db_command.c ddb
file ddb/db_ctf.c ddb & ddbctf
file ddb/db_lex.c ddb
file ddb/db_output.c ddb
file ddb/db_prof.c ddb & ddbprof & !gprof
-file ddb/db_run.c ddb | kgdb
+file ddb/db_run.c ddb
file ddb/db_struct.c ddb & ddb_struct
file ddb/db_sym.c ddb
file ddb/db_trap.c ddb
file kern/kern_task.c
file kern/kern_srp.c
file kern/kern_xxx.c
-file kern/kgdb_stub.c kgdb
file kern/sched_bsd.c
file kern/subr_autoconf.c
file kern/subr_disk.c
-/* $OpenBSD: db_run.c,v 1.26 2016/01/25 14:30:30 mpi Exp $ */
+/* $OpenBSD: db_run.c,v 1.27 2017/04/30 13:04:49 mpi Exp $ */
/* $NetBSD: db_run.c,v 1.8 1996/02/05 01:57:12 christos Exp $ */
/*
int db_inst_count;
-#ifndef KGDB
-
#include <ddb/db_watch.h>
#include <ddb/db_output.h>
#include <ddb/db_sym.h>
db_cmd_loop_done = 1;
}
-#endif /* NO KGDB */
#ifdef SOFTWARE_SSTEP
/*
-/* $OpenBSD: com.c,v 1.161 2016/09/04 18:20:34 tedu Exp $ */
+/* $OpenBSD: com.c,v 1.162 2017/04/30 13:04:49 mpi Exp $ */
/* $NetBSD: com.c,v 1.82.4.1 1996/06/02 09:08:00 mrg Exp $ */
/*
int commajor;
-#ifdef KGDB
-#include <sys/kgdb.h>
-
-bus_addr_t com_kgdb_addr;
-bus_space_tag_t com_kgdb_iot;
-bus_space_handle_t com_kgdb_ioh;
-
-int com_kgdb_getc(void *);
-void com_kgdb_putc(void *, int);
-#endif /* KGDB */
-
#define DEVUNIT(x) (minor(x) & 0x7f)
#define DEVCUA(x) (minor(x) & 0x80)
com_resume(sc);
break;
case DVACT_DEACTIVATE:
-#ifdef KGDB
- if (sc->sc_hwflags & (COM_HW_CONSOLE|COM_HW_KGDB)) {
-#else
if (sc->sc_hwflags & COM_HW_CONSOLE) {
-#endif /* KGDB */
rv = EBUSY;
break;
}
if (!sc)
return ENXIO;
-#ifdef KGDB
- /*
- * If this is the kgdb port, no other use is permitted.
- */
- if (ISSET(sc->sc_hwflags, COM_HW_KGDB))
- return (EBUSY);
-#endif /* KGDB */
-
s = spltty();
if (!sc->sc_tty) {
tp = sc->sc_tty = ttymalloc(1000000);
}
}
-#ifdef KGDB
-
-/*
- * If a line break is set, or data matches one of the characters
- * gdb uses to signal a connection, then start up kgdb. Just gobble
- * any other data. Done in a stand alone function because comintr
- * does tty stuff and we don't have one.
- */
-
-int
-kgdbintr(void *arg)
-{
- struct com_softc *sc = arg;
- bus_space_tag_t iot = sc->sc_iot;
- bus_space_handle_t ioh = sc->sc_ioh;
- u_char lsr, data, msr, delta;
-
- if (!ISSET(sc->sc_hwflags, COM_HW_KGDB))
- return(0);
-
- for (;;) {
- lsr = bus_space_read_1(iot, ioh, com_lsr);
- if (ISSET(lsr, LSR_RXRDY)) {
- do {
- data = bus_space_read_1(iot, ioh, com_data);
- if (data == 3 || data == '$' || data == '+' ||
- ISSET(lsr, LSR_BI)) {
- kgdb_connect(1);
- data = 0;
- }
- lsr = bus_space_read_1(iot, ioh, com_lsr);
- } while (ISSET(lsr, LSR_RXRDY));
-
- }
- if (ISSET(lsr, LSR_BI|LSR_FE|LSR_PE|LSR_OE))
- printf("weird lsr %02x\n", lsr);
-
- msr = bus_space_read_1(iot, ioh, com_msr);
-
- if (msr != sc->sc_msr) {
- delta = msr ^ sc->sc_msr;
- sc->sc_msr = msr;
- if (ISSET(delta, MSR_DCD)) {
- if (!ISSET(sc->sc_swflags, COM_SW_SOFTCAR)) {
- CLR(sc->sc_mcr, sc->sc_dtr);
- bus_space_write_1(iot, ioh, com_mcr, sc->sc_mcr);
- }
- }
- }
- if (ISSET(bus_space_read_1(iot, ioh, com_iir), IIR_NOPEND))
- return (1);
- }
-}
-#endif /* KGDB */
-
int
comintr(void *arg)
{
}
/*
- * The following functions are polled getc and putc routines, shared
- * by the console and kgdb glue.
+ * The following functions are polled getc and putc routines, used
+ * by the console glue.
*/
int
}
#endif /* COM_CONSOLE */
-#ifdef KGDB
-int
-com_kgdb_attach(bus_space_tag_t iot, bus_addr_t iobase, int rate,
- int frequency, tcflag_t cflag)
-{
-#ifdef COM_CONSOLE
- if (iot == comconsiot && iobase == comconsaddr) {
- return (EBUSY); /* cannot share with console */
- }
-#endif
-
- com_kgdb_iot = iot;
- com_kgdb_addr = iobase;
-
- if (bus_space_map(com_kgdb_iot, com_kgdb_addr, COM_NPORTS, 0,
- &com_kgdb_ioh))
- panic("com_kgdb_attach: mapping failed");
-
- /* XXX We currently don't respect KGDBMODE? */
- cominit(com_kgdb_iot, com_kgdb_ioh, rate, frequency);
-
- kgdb_attach(com_kgdb_getc, com_kgdb_putc, NULL);
- kgdb_dev = 123; /* unneeded, only to satisfy some tests */
-
- return (0);
-}
-
-/* ARGSUSED */
-int
-com_kgdb_getc(void *arg)
-{
-
- return (com_common_getc(com_kgdb_iot, com_kgdb_ioh));
-}
-
-/* ARGSUSED */
-void
-com_kgdb_putc(void *arg, int c)
-{
-
- return (com_common_putc(com_kgdb_iot, com_kgdb_ioh, c));
-}
-#endif /* KGDB */
-
void com_enable_debugport(struct com_softc *);
void com_fifo_probe(struct com_softc *);
-#if defined(COM_CONSOLE) || defined(KGDB)
+#ifdef COM_CONSOLE
void
com_enable_debugport(struct com_softc *sc)
{
/* Turn on line break interrupt, set carrier. */
s = splhigh();
-#ifdef KGDB
- SET(sc->sc_ier, IER_ERXRDY);
- bus_space_write_1(sc->sc_iot, sc->sc_ioh, com_ier, sc->sc_ier);
-#endif
SET(sc->sc_mcr, MCR_DTR | MCR_RTS | MCR_IENABLE);
bus_space_write_1(sc->sc_iot, sc->sc_ioh, com_mcr, sc->sc_mcr);
splx(s);
}
-#endif /* COM_CONSOLE || KGDB */
+#endif /* COM_CONSOLE */
void
com_attach_subr(struct com_softc *sc)
panic("comattach: bad fifo type");
}
-#ifdef KGDB
- /*
- * Allow kgdb to "take over" this port. If this is
- * the kgdb device, it has exclusive use.
- */
-
- if (iot == com_kgdb_iot && sc->sc_iobase == com_kgdb_addr &&
- !ISSET(sc->sc_hwflags, COM_HW_CONSOLE)) {
- printf("%s: kgdb\n", sc->sc_dev.dv_xname);
- SET(sc->sc_hwflags, COM_HW_KGDB);
- }
-#endif /* KGDB */
-
-#if defined(COM_CONSOLE) || defined(KGDB)
- if (!ISSET(sc->sc_hwflags, COM_HW_CONSOLE|COM_HW_KGDB))
+#ifdef COM_CONSOLE
+ if (!ISSET(sc->sc_hwflags, COM_HW_CONSOLE))
#endif
com_fifo_probe(sc);
if (!sc->enable)
sc->enabled = 1;
-#if defined(COM_CONSOLE) || defined(KGDB)
- if (ISSET(sc->sc_hwflags, COM_HW_CONSOLE|COM_HW_KGDB))
+#ifdef COM_CONSOLE
+ if (ISSET(sc->sc_hwflags, COM_HW_CONSOLE))
com_enable_debugport(sc);
#endif
}
-/* $OpenBSD: comvar.h,v 1.52 2016/09/03 14:43:37 jsg Exp $ */
+/* $OpenBSD: comvar.h,v 1.53 2017/04/30 13:04:49 mpi Exp $ */
/* $NetBSD: comvar.h,v 1.5 1996/05/05 19:50:47 christos Exp $ */
/*
#define COM_HW_FIFO 0x02
#define COM_HW_SIR 0x20
#define COM_HW_CONSOLE 0x40
-#define COM_HW_KGDB 0x80
u_char sc_swflags;
#define COM_SW_SOFTCAR 0x01
#define COM_SW_CLOCAL 0x02
void com_common_putc(bus_space_tag_t, bus_space_handle_t, int);
void com_raisedtr(void *);
-#ifdef KGDB
-extern bus_addr_t com_kgdb_addr;
-extern bus_space_tag_t com_kgdb_iot;
-extern bus_space_handle_t com_kgdb_ioh;
-
-int com_kgdb_attach(bus_space_tag_t, bus_addr_t, int, int, tcflag_t);
-int kgdbintr(void *);
-#endif
-
void com_attach_subr(struct com_softc *);
extern int comdefaultrate;
-/* $OpenBSD: z8530sc.h,v 1.11 2013/04/21 14:44:16 sebastia Exp $ */
+/* $OpenBSD: z8530sc.h,v 1.12 2017/04/30 13:04:49 mpi Exp $ */
/* $NetBSD: z8530sc.h,v 1.15 2001/05/11 01:40:48 thorpej Exp $ */
/*
int zs_set_modes(struct zs_chanstate *, int);
extern int zs_major;
-
-int zs_check_kgdb(struct zs_chanstate *, int);
-/* $OpenBSD: z8530tty.c,v 1.27 2016/09/04 18:20:34 tedu Exp $ */
+/* $OpenBSD: z8530tty.c,v 1.28 2017/04/30 13:04:49 mpi Exp $ */
/* $NetBSD: z8530tty.c,v 1.77 2001/05/30 15:24:24 lukem Exp $ */
/*-
printf(": console%s", i ? (o ? "" : i) : o);
}
-#ifdef KGDB
- if (zs_check_kgdb(cs, dev)) {
- /*
- * Allow kgdb to "take over" this port. Returns true
- * if this serial port is in-use by kgdb.
- */
- printf(": kgdb\n");
- /*
- * This is the kgdb port (exclusive use)
- * so skip the normal attach code.
- */
- return;
- }
-#endif
-
#if defined(__sparc64__)
if (strcmp(args->type, "keyboard") == 0 ||
strcmp(args->type, "mouse") == 0)
-/* $OpenBSD: com_commulti.c,v 1.4 2008/04/27 09:25:26 kettenis Exp $ */
+/* $OpenBSD: com_commulti.c,v 1.5 2017/04/30 13:04:49 mpi Exp $ */
/*
* Copyright (c) 1997 - 1999, Jason Downs. All rights reserved.
*
iobase = ca->ca_iobase;
ioh = ca->ca_ioh;
-#ifdef KGDB
- if (iobase == com_kgdb_addr)
- return (1);
-#endif
/* if it's in use as console, it's there. */
if (iobase == comconsaddr && !comconsattached)
return (1);
-/* $OpenBSD: com_isa.c,v 1.8 2015/03/14 03:38:47 jsg Exp $ */
+/* $OpenBSD: com_isa.c,v 1.9 2017/04/30 13:04:49 mpi Exp $ */
/*
* Copyright (c) 1997 - 1999, Jason Downs. All rights reserved.
*
iot = ia->ia_iot;
iobase = ia->ia_iobase;
-#ifdef KGDB
- if (iobase == com_kgdb_addr)
- goto out;
-#endif
if (iobase == comconsaddr && !comconsattached)
goto out;
iobase = ia->ia_iobase;
iot = ia->ia_iot;
-#ifdef KGDB
- if ((iobase != comconsaddr) &&
- (iobase != com_kgdb_addr)) {
-#else
if (iobase != comconsaddr) {
-#endif
if (bus_space_map(iot, iobase, COM_NPORTS, 0, &ioh))
panic("com_isa_attach: mapping failed");
} else {
-#ifdef KGDB
- if (iobase == comconsaddr)
- ioh = comconsioh;
- else
- ioh = com_kgdb_ioh;
-#else
ioh = comconsioh;
-#endif
}
sc->sc_iot = iot;
irq = ia->ia_irq;
if (irq != IRQUNK) {
-#ifdef KGDB
- if (iobase == com_kgdb_addr) {
- sc->sc_ih = isa_intr_establish(ia->ia_ic, irq,
- IST_EDGE, IPL_HIGH, kgdbintr, sc,
- sc->sc_dev.dv_xname);
- } else {
- sc->sc_ih = isa_intr_establish(ia->ia_ic, irq,
- IST_EDGE, IPL_TTY, comintr, sc,
- sc->sc_dev.dv_xname);
- }
-#else
sc->sc_ih = isa_intr_establish(ia->ia_ic, irq,
IST_EDGE, IPL_TTY, comintr, sc,
sc->sc_dev.dv_xname);
-#endif /* KGDB */
}
}
-/* $OpenBSD: com_isapnp.c,v 1.4 2008/04/27 09:29:40 kettenis Exp $ */
+/* $OpenBSD: com_isapnp.c,v 1.5 2017/04/30 13:04:49 mpi Exp $ */
/*
* Copyright (c) 1997 - 1999, Jason Downs. All rights reserved.
*
iobase = ia->ia_iobase;
ioh = ia->ia_ioh;
-#ifdef KGDB
- if (iobase == com_kgdb_addr)
- return (1);
-#endif
/* if it's in use as console, it's there. */
if (iobase == comconsaddr && !comconsattached)
return (1);
irq = ia->ia_irq;
if (irq != IRQUNK) {
-#ifdef KGDB
- if (iobase == com_kgdb_addr) {
- sc->sc_ih = isa_intr_establish(ia->ia_ic, irq,
- IST_EDGE, IPL_HIGH, kgdbintr, sc,
- sc->sc_dev.dv_xname);
- } else {
- sc->sc_ih = isa_intr_establish(ia->ia_ic, irq,
- IST_EDGE, IPL_TTY, comintr, sc,
- sc->sc_dev.dv_xname);
- }
-#else
sc->sc_ih = isa_intr_establish(ia->ia_ic, irq,
IST_EDGE, IPL_TTY, comintr, sc,
sc->sc_dev.dv_xname);
-#endif /* KGDB */
}
}
+++ /dev/null
-/* $OpenBSD: kgdb_stub.c,v 1.11 2016/06/07 01:31:54 tedu Exp $ */
-/* $NetBSD: kgdb_stub.c,v 1.6 1998/08/30 20:30:57 scottr Exp $ */
-
-/*
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. 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 acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratories.
- *
- * 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. 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.4 (Berkeley) 1/12/94
- */
-
-/*
- * "Stub" to allow remote cpu to debug over a serial line using gdb.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kgdb.h>
-
-/* #define DEBUG_KGDB XXX */
-
-/* XXX: Maybe these should be in the MD files? */
-#ifndef KGDBDEV
-#define KGDBDEV -1
-#endif
-#ifndef KGDBRATE
-#define KGDBRATE 19200
-#endif
-
-int kgdb_dev = KGDBDEV; /* remote debugging device (-1 if none) */
-int kgdb_rate = KGDBRATE; /* remote debugging baud rate */
-int kgdb_active = 0; /* remote debugging active if != 0 */
-int kgdb_debug_init = 0; /* != 0 waits for remote at system init */
-int kgdb_debug_panic = 0; /* != 0 waits for remote on panic */
-label_t *kgdb_recover = 0;
-
-static void kgdb_copy(void *, void *, int);
-/* static void kgdb_zero(void *, int); */
-static void kgdb_send(u_char *);
-static int kgdb_recv(u_char *, int);
-static int digit2i(u_char);
-static u_char i2digit(int);
-static void mem2hex(void *, void *, int);
-static u_char *hex2mem(void *, u_char *, int);
-static vaddr_t hex2i(u_char **);
-
-static int (*kgdb_getc)(void *);
-static void (*kgdb_putc)(void *, int);
-static void *kgdb_ioarg;
-
-static u_char buffer[KGDB_BUFLEN];
-static kgdb_reg_t gdb_regs[KGDB_NUMREGS];
-
-#define GETC() ((*kgdb_getc)(kgdb_ioarg))
-#define PUTC(c) ((*kgdb_putc)(kgdb_ioarg, c))
-
-/*
- * This little routine exists simply so that bcopy() can be debugged.
- */
-static void
-kgdb_copy(void *vsrc, void *vdst, int len)
-{
- char *src = vsrc;
- char *dst = vdst;
-
- while (--len >= 0)
- *dst++ = *src++;
-}
-
-#if 0
-/* ditto for bzero */
-static void
-kgdb_zero(void *vptr, int len)
-{
- char *ptr = vptr;
-
- while (--len >= 0)
- *ptr++ = (char) 0;
-}
-#endif
-
-/*
- * Convert a hex digit into an integer.
- * This returns -1 if the argument passed is no
- * valid hex digit.
- */
-static int
-digit2i(u_char c)
-{
- if (c >= '0' && c <= '9')
- return (c - '0');
- else if (c >= 'a' && c <= 'f')
- return (c - 'a' + 10);
- else if (c >= 'A' && c <= 'F')
-
- return (c - 'A' + 10);
- else
- return (-1);
-}
-
-/*
- * Convert the low 4 bits of an integer into
- * an hex digit.
- */
-static u_char
-i2digit(int n)
-{
- return ("0123456789abcdef"[n & 0x0f]);
-}
-
-/*
- * Convert a byte array into an hex string.
- */
-static void
-mem2hex(void *vdst, void *vsrc, int len)
-{
- u_char *dst = vdst;
- u_char *src = vsrc;
-
- while (len--) {
- *dst++ = i2digit(*src >> 4);
- *dst++ = i2digit(*src++);
- }
- *dst = '\0';
-}
-
-/*
- * Convert an hex string into a byte array.
- * This returns a pointer to the character following
- * the last valid hex digit. If the string ends in
- * the middle of a byte, NULL is returned.
- */
-static u_char *
-hex2mem(void *vdst, u_char *src, int maxlen)
-{
- u_char *dst = vdst;
- int msb, lsb;
-
- while (*src && maxlen--) {
- msb = digit2i(*src++);
- if (msb < 0)
- return (src - 1);
- lsb = digit2i(*src++);
- if (lsb < 0)
- return (NULL);
- *dst++ = (msb << 4) | lsb;
- }
- return (src);
-}
-
-/*
- * Convert an hex string into an integer.
- * This returns a pointer to the character following
- * the last valid hex digit.
- */
-static vaddr_t
-hex2i(u_char **srcp)
-{
- char *src = *srcp;
- vaddr_t r = 0;
- int nibble;
-
- while ((nibble = digit2i(*src)) >= 0) {
- r *= 16;
- r += nibble;
- src++;
- }
- *srcp = src;
- return (r);
-}
-
-/*
- * Send a packet.
- */
-static void
-kgdb_send(u_char *bp)
-{
- u_char *p;
- u_char csum, c;
-
-#ifdef DEBUG_KGDB
- printf("kgdb_send: %s\n", bp);
-#endif
- do {
- p = bp;
- PUTC(KGDB_START);
- for (csum = 0; (c = *p); p++) {
- PUTC(c);
- csum += c;
- }
- PUTC(KGDB_END);
- PUTC(i2digit(csum >> 4));
- PUTC(i2digit(csum));
- } while ((c = GETC() & 0x7f) == KGDB_BADP);
-}
-
-/*
- * Receive a packet.
- */
-static int
-kgdb_recv(u_char *bp, int maxlen)
-{
- u_char *p;
- int c, csum;
- int len;
-
- do {
- p = bp;
- csum = len = 0;
- while ((c = GETC()) != KGDB_START)
- continue;
-
- while ((c = GETC()) != KGDB_END && len < maxlen) {
- c &= 0x7f;
- csum += c;
- *p++ = c;
- len++;
- }
- csum &= 0xff;
- *p = '\0';
-
- if (len >= maxlen) {
- PUTC(KGDB_BADP);
- continue;
- }
-
- csum -= digit2i(GETC()) * 16;
- csum -= digit2i(GETC());
-
- if (csum == 0) {
- PUTC(KGDB_GOODP);
- /* Sequence present? */
- if (bp[2] == ':') {
- PUTC(bp[0]);
- PUTC(bp[1]);
- len -= 3;
- kgdb_copy(bp + 3, bp, len);
- }
- break;
- }
- PUTC(KGDB_BADP);
- } while (1);
-#ifdef DEBUG_KGDB
- printf("kgdb_recv: %s\n", bp);
-#endif
- return (len);
-}
-
-/*
- * This is called by the appropriate tty driver.
- */
-void
-kgdb_attach(int (*getfn)(void *), void (*putfn)(void *, int), void *ioarg)
-{
- kgdb_getc = getfn;
- kgdb_putc = putfn;
- kgdb_ioarg = ioarg;
-}
-
-/*
- * This function does all command processing for interfacing to
- * a remote gdb. Note that the error codes are ignored by gdb
- * at present, but might eventually become meaningful. (XXX)
- * It might makes sense to use POSIX errno values, because
- * that is what the gdb/remote.c functions want to return.
- */
-int
-kgdb_trap(int type, db_regs_t *regs)
-{
- label_t jmpbuf;
- vaddr_t addr;
- size_t len;
- u_char *p;
-
- if (kgdb_dev < 0 || kgdb_getc == NULL) {
- /* not debugging */
- return (0);
- }
-
- /* Detect and recover from unexpected traps. */
- if (kgdb_recover != 0) {
- printf("kgdb: caught trap 0x%x at %p\n",
- type, (void *)PC_REGS(regs));
- kgdb_send("E0E"); /* 14==EFAULT */
- longjmp(kgdb_recover);
- }
-
- /*
- * The first entry to this function is normally through
- * a breakpoint trap in kgdb_connect(), in which case we
- * must advance past the breakpoint because gdb will not.
- *
- * Machines vary as to where they leave the PC after a
- * breakpoint trap. Those that leave the PC set to the
- * address of the trap instruction (i.e. pc532) will not
- * define FIXUP_PC_AFTER_BREAK(), and therefore will just
- * advance the PC. On machines that leave the PC set to
- * the instruction after the trap, FIXUP_PC_AFTER_BREAK
- * will be defined to back-up the PC, so that after the
- * "first-time" part of the if statement below has run,
- * the PC will be the same as it was on entry.
- *
- * On the first entry here, we expect that gdb is not yet
- * listening to us, so just enter the interaction loop.
- * After the debugger is "active" (connected) it will be
- * waiting for a "signaled" message from us.
- */
- if (kgdb_active == 0) {
- if (!IS_BREAKPOINT_TRAP(type, 0)) {
- /* No debugger active -- let trap handle this. */
- return (0);
- }
- /* Make the PC point at the breakpoint... */
-#ifdef FIXUP_PC_AFTER_BREAK
- FIXUP_PC_AFTER_BREAK(regs);
-#endif
- /* ... and then advance past it. */
-#ifdef PC_ADVANCE
- PC_ADVANCE(regs);
-#else
- SET_PC_REGS(regs, PC_REGS(regs) + BKPT_SIZE);
-#endif
- kgdb_active = 1;
- } else {
- /* Tell remote host that an exception has occurred. */
- snprintf(buffer, sizeof buffer, "S%02x", kgdb_signal(type));
- kgdb_send(buffer);
- }
-
- /* Stick frame regs into our reg cache. */
- kgdb_getregs(regs, gdb_regs);
-
- /*
- * Interact with gdb until it lets us go.
- * If we cause a trap, resume here.
- */
- (void)setjmp((kgdb_recover = &jmpbuf));
- for (;;) {
- kgdb_recv(buffer, sizeof(buffer));
- switch (buffer[0]) {
-
- default:
- /* Unknown command. */
- kgdb_send("");
- continue;
-
- case KGDB_SIGNAL:
- /*
- * if this command came from a running gdb,
- * answer it -- the other guy has no way of
- * knowing if we're in or out of this loop
- * when he issues a "remote-signal".
- */
- snprintf(buffer, sizeof buffer, "S%02x",
- kgdb_signal(type));
- kgdb_send(buffer);
- continue;
-
- case KGDB_REG_R:
- mem2hex(buffer, gdb_regs, sizeof(gdb_regs));
- kgdb_send(buffer);
- continue;
-
- case KGDB_REG_W:
- p = hex2mem(gdb_regs, buffer + 1, sizeof(gdb_regs));
- if (p == NULL || *p != '\0')
- kgdb_send("E01");
- else {
- kgdb_setregs(regs, gdb_regs);
- kgdb_send("OK");
- }
- continue;
-
- case KGDB_MEM_R:
- p = buffer + 1;
- addr = hex2i(&p);
- if (*p++ != ',') {
- kgdb_send("E02");
- continue;
- }
- len = hex2i(&p);
- if (*p != '\0') {
- kgdb_send("E03");
- continue;
- }
- if (len > sizeof(buffer) / 2) {
- kgdb_send("E04");
- continue;
- }
- if (kgdb_acc(addr, len) == 0) {
- kgdb_send("E05");
- continue;
- }
- db_read_bytes(addr, (size_t)len,
- (char *)buffer + sizeof(buffer) / 2);
- mem2hex(buffer, buffer + sizeof(buffer) / 2, len);
- kgdb_send(buffer);
- continue;
-
- case KGDB_MEM_W:
- p = buffer + 1;
- addr = hex2i(&p);
- if (*p++ != ',') {
- kgdb_send("E06");
- continue;
- }
- len = hex2i(&p);
- if (*p++ != ':') {
- kgdb_send("E07");
- continue;
- }
- if (len > (sizeof(buffer) - (p - buffer))) {
- kgdb_send("E08");
- continue;
- }
- p = hex2mem(buffer, p, sizeof(buffer));
- if (p == NULL) {
- kgdb_send("E09");
- continue;
- }
- if (kgdb_acc(addr, len) == 0) {
- kgdb_send("E0A");
- continue;
- }
- db_write_bytes(addr, (size_t)len, (char *)buffer);
- kgdb_send("OK");
- continue;
-
- case KGDB_DETACH:
- kgdb_active = 0;
- printf("kgdb detached\n");
- db_clear_single_step(regs);
- kgdb_send("OK");
- goto out;
-
- case KGDB_KILL:
- kgdb_active = 0;
- printf("kgdb detached\n");
- db_clear_single_step(regs);
- goto out;
-
- case KGDB_CONT:
- if (buffer[1]) {
- p = buffer + 1;
- addr = hex2i(&p);
- if (*p) {
- kgdb_send("E0B");
- continue;
- }
- SET_PC_REGS(regs, addr);
- }
- db_clear_single_step(regs);
- goto out;
-
- case KGDB_STEP:
- if (buffer[1]) {
- p = buffer + 1;
- addr = hex2i(&p);
- if (*p) {
- kgdb_send("E0B");
- continue;
- }
- SET_PC_REGS(regs, addr);
- }
- db_set_single_step(regs);
- goto out;
- }
- }
- out:
- kgdb_recover = 0;
- return (1);
-}
-
-/*
- * Trap into kgdb to wait for debugger to connect,
- * noting on the console why nothing else is going on.
- */
-void
-kgdb_connect(int verbose)
-{
- if (kgdb_dev < 0)
- return;
-
- KGDB_PREPARE;
-
- if (verbose)
- printf("kgdb waiting...");
-
- KGDB_ENTER;
-
- if (verbose)
- printf("connected.\n");
-
- kgdb_debug_panic = 1;
-}
-
-/*
- * Decide what to do on panic.
- * (This is called by panic, like Debugger())
- */
-void
-kgdb_panic(void)
-{
- if (kgdb_dev >= 0 && kgdb_debug_panic) {
- printf("entering kgdb\n");
- kgdb_connect(kgdb_active == 0);
- }
-}
-/* $OpenBSD: subr_prf.c,v 1.89 2017/04/27 11:48:08 mpi Exp $ */
+/* $OpenBSD: subr_prf.c,v 1.90 2017/04/30 13:04:49 mpi Exp $ */
/* $NetBSD: subr_prf.c,v 1.45 1997/10/24 18:14:25 chuck Exp $ */
/*-
*/
#include <sys/stdarg.h>
-#ifdef KGDB
-#include <sys/kgdb.h>
-#endif
#ifdef DDB
#include <ddb/db_output.h> /* db_printf, db_putchar prototypes */
#include <ddb/db_var.h> /* db_log, db_radix */
printf("\n");
va_end(ap);
-#ifdef KGDB
- kgdb_panic();
-#endif
#ifdef DDB
if (db_panic)
Debugger();
+++ /dev/null
-/* $OpenBSD: kgdb.h,v 1.5 2005/11/13 17:50:45 fgsch Exp $ */
-/* $NetBSD: kgdb.h,v 1.5 1998/09/13 14:46:24 christos Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. 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 acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratories.
- *
- * 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. 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.
- *
- * @(#)remote-sl.h 8.1 (Berkeley) 6/11/93
- */
-
-#ifndef _SYS_KGDB_H_
-#define _SYS_KGDB_H_
-
-/*
- * Protocol definition for KGDB
- * (gdb over remote serial line)
- */
-
-#include <machine/db_machdep.h>
-
-/*
- * Message types.
- */
-#define KGDB_MEM_R 'm'
-#define KGDB_MEM_W 'M'
-#define KGDB_REG_R 'g'
-#define KGDB_REG_W 'G'
-#define KGDB_CONT 'c'
-#define KGDB_STEP 's'
-#define KGDB_KILL 'k'
-#define KGDB_SIGNAL '?'
-#define KGDB_DEBUG 'd'
-#define KGDB_DETACH 'D'
-
-/*
- * start of frame/end of frame
- */
-#define KGDB_START '$'
-#define KGDB_END '#'
-#define KGDB_GOODP '+'
-#define KGDB_BADP '-'
-
-#ifdef _KERNEL
-
-#include <ddb/db_run.h>
-#include <ddb/db_access.h>
-
-#ifndef KGDB_PREPARE
-#define KGDB_PREPARE
-#endif
-
-#ifndef KGDB_ENTER
-#define KGDB_ENTER
-#endif
-
-/*
- * Functions and variables exported from kgdb_stub.c
- */
-extern int kgdb_dev, kgdb_rate, kgdb_active;
-extern int kgdb_debug_init, kgdb_debug_panic;
-extern label_t *kgdb_recover;
-
-void kgdb_attach(int (*)(void *), void (*)(void *, int), void *ioarg);
-void kgdb_connect(int);
-void kgdb_panic(void);
-int kgdb_trap(int, db_regs_t *);
-
-/*
- * Machine dependent functions needed by kgdb_stub.c
- */
-int kgdb_signal(int);
-int kgdb_acc(vaddr_t, size_t);
-void kgdb_getregs(db_regs_t *, kgdb_reg_t *);
-void kgdb_setregs(db_regs_t *, kgdb_reg_t *);
-
-#endif /* _KERNEL */
-#endif /* !_SYS_KGDB_H_ */
-/* $OpenBSD: systm.h,v 1.126 2017/04/20 13:20:17 visa Exp $ */
+/* $OpenBSD: systm.h,v 1.127 2017/04/30 13:04:49 mpi Exp $ */
/* $NetBSD: systm.h,v 1.50 1996/06/09 04:55:09 briggs Exp $ */
/*-
#define memmove(d, s, n) __builtin_memmove((d), (s), (n))
#endif
-#if defined(DDB) || defined(KGDB)
+#if defined(DDB)
/* debugger entry points */
void Debugger(void); /* in DDB only */
#endif
-/* $OpenBSD: uvm_extern.h,v 1.141 2017/03/05 00:45:31 guenther Exp $ */
+/* $OpenBSD: uvm_extern.h,v 1.142 2017/04/30 13:04:49 mpi Exp $ */
/* $NetBSD: uvm_extern.h,v 1.57 2001/03/09 01:02:12 chs Exp $ */
/*
void uao_reference_locked(struct uvm_object *);
int uvm_fault(vm_map_t, vaddr_t, vm_fault_t, vm_prot_t);
-#if defined(KGDB)
-void uvm_chgkprot(caddr_t, size_t, int);
-#endif
vaddr_t uvm_uarea_alloc(void);
void uvm_uarea_free(struct proc *);
void uvm_exit(struct process *);
-/* $OpenBSD: uvm_glue.c,v 1.71 2017/02/14 10:31:15 mpi Exp $ */
+/* $OpenBSD: uvm_glue.c,v 1.72 2017/04/30 13:04:49 mpi Exp $ */
/* $NetBSD: uvm_glue.c,v 1.44 2001/02/06 19:54:44 eeh Exp $ */
/*
return(rv);
}
-#ifdef KGDB
-/*
- * Change protections on kernel pages from addr to addr+len
- * (presumably so debugger can plant a breakpoint).
- *
- * We force the protection change at the pmap level. If we were
- * to use vm_map_protect a change to allow writing would be lazily-
- * applied meaning we would still take a protection fault, something
- * we really don't want to do. It would also fragment the kernel
- * map unnecessarily. We cannot use pmap_protect since it also won't
- * enforce a write-enable request. Using pmap_enter is the only way
- * we can ensure the change takes place properly.
- */
-void
-uvm_chgkprot(caddr_t addr, size_t len, int rw)
-{
- vm_prot_t prot;
- paddr_t pa;
- vaddr_t sva, eva;
-
- prot = rw == B_READ ? PROT_READ : PROT_READ | PROT_WRITE;
- eva = round_page((vaddr_t)addr + len);
- for (sva = trunc_page((vaddr_t)addr); sva < eva; sva += PAGE_SIZE) {
- /*
- * Extract physical address for the page.
- * We use a cheezy hack to differentiate physical
- * page 0 from an invalid mapping, not that it
- * really matters...
- */
- if (pmap_extract(pmap_kernel(), sva, &pa) == FALSE)
- panic("chgkprot: invalid page");
- pmap_enter(pmap_kernel(), sva, pa, prot, PMAP_WIRED);
- }
- pmap_update(pmap_kernel());
-}
-#endif
-
/*
* uvm_vslock: wire user memory for I/O
*