Rename recently checked in KGDB to IPKDB to resolve conflicts with older KGDB

This commit is contained in:
ws 1996-10-16 19:32:08 +00:00
parent 78954ddcf6
commit 31bdb14ed5
44 changed files with 861 additions and 921 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: exception.S,v 1.6 1996/10/15 22:56:27 mark Exp $ */
/* $NetBSD: exception.S,v 1.7 1996/10/16 19:32:08 ws Exp $ */
/*
* Copyright (c) 1994-1996 Mark Brinicombe.
@ -45,7 +45,7 @@
* Based on kate/display/abort.s
*/
#include "kgdb.h"
#include "ipkdb.h"
#include <machine/cpu.h>
#include "assym.h"
@ -304,9 +304,9 @@ do_swi_ast:
.global undefined_entry
undefined_entry:
#if NKGDB > 0 || NKGDBSLIP > 0
#if NIPKDB > 0
/*
* KGDB must be hooked in at the earliest possible entry point.
* IPKDB must be hooked in at the earliest possible entry point.
*
*/
/*
@ -329,7 +329,7 @@ undefined_entry:
bne Lprenotuser_push
add r1, sp, #(8*4)
stmia r1,{r8-r14}^ /* store user mode r8-r14*/
b Lgokgdb
b Lgoipkdb
/*
* Switch to previous mode to get r8-r13.
*/
@ -355,12 +355,12 @@ Lprenotuser_push:
str r1, [sp, #(14*4)] /* r14 */
str r2, [sp, #(17*4)] /* spsr */
/*
* Now to KGDB.
* Now to IPKDB.
*/
Lgokgdb:
Lgoipkdb:
mov r0, sp
bl _kgdb_trap_glue
ldr r1, Lkgdb_trap_return
bl _ipkdb_trap_glue
ldr r1, Lipkdb_trap_return
str r0,[r1]
/*
* Have to load all registers from the stack.
@ -407,14 +407,14 @@ Lpull_r0r7:
/*
* Now the rest of the registers.
*/
ldr r1,Lkgdb_trap_return
ldr r1,Lipkdb_trap_return
ldr r0,[r1]
tst r0,r0
ldmfd sp!, {r0-r7} /* r0-r7 */
add sp, sp, #(10*4) /* adjust sp */
/*
* Did KGDB handle it?
* Did IPKDB handle it?
*/
movnes pc, lr /* return */
@ -427,9 +427,9 @@ Lpull_r0r7:
str r1, [r0, #0x0004]
ldmia r0, {r0, r1, pc}
#if NKGDB > 0 || NKGDBSLIP > 0
Lkgdb_trap_return:
.word Lkgdb_trap_return_data
#if NIPKDB > 0
Lipkdb_trap_return:
.word Lipkdb_trap_return_data
#endif
Lundefined_handler_indirection:
@ -452,8 +452,8 @@ _undefinedinstruction_bounce:
.data
.align 0
#if NKGDB > 0 || NKGDBSLIP > 0
Lkgdb_trap_return_data:
#if NIPKDB > 0
Lipkdb_trap_return_data:
.word 0
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: fault.c,v 1.11 1996/10/15 22:22:22 mark Exp $ */
/* $NetBSD: fault.c,v 1.12 1996/10/16 19:32:13 ws Exp $ */
/*
* Copyright (c) 1994-1996 Mark Brinicombe.
@ -623,7 +623,7 @@ copyfault:
if ((fault_code & FAULT_USER) == 0
&& (va >= KERNEL_BASE || va <= VM_MIN_ADDRESS)) {
/* Was the fault due to the FPE/KGDB ? */
/* Was the fault due to the FPE/IPKDB ? */
if ((frame->tf_spsr & PSR_MODE) == PSR_UND32_MODE) {
printf("UND32 Data abort: '%s' status = %03x address = %08x PC = %08x\n",

View File

@ -1,4 +1,4 @@
/* $NetBSD: kgdb_glue.c,v 1.5 1996/10/15 02:11:31 mark Exp $ */
/* $NetBSD: ipkdb_glue.c,v 1.1 1996/10/16 19:38:49 ws Exp $ */
/*
* Copyright (C) 1994 Wolfgang Solfrank.
@ -36,7 +36,7 @@
#include <sys/systm.h>
#include <sys/reboot.h>
#include <kgdb/kgdb.h>
#include <ipkdb/ipkdb.h>
#include <vm/vm.h>
@ -45,9 +45,9 @@
#include <machine/psl.h>
#include <machine/pte.h>
#include <machine/pmap.h>
#include <machine/kgdb.h>
#include <machine/ipkdb.h>
int kgdbregs[NREG];
int ipkdbregs[NREG];
dump(p, l)
u_char *p;
@ -73,24 +73,24 @@ dump(p, l)
}
void
kgdbinit()
ipkdbinit()
{
}
int
kgdb_poll()
ipkdb_poll()
{
return 0;
}
void
kgdb_trap()
ipkdb_trap()
{
__asm(".word 0xe6000010");
}
int
kgdb_trap_glue(regs)
ipkdb_trap_glue(regs)
int *regs;
{
int inst;
@ -99,19 +99,19 @@ kgdb_trap_glue(regs)
inst = fetchinst(regs[PC] - 4);
switch (inst) {
default:
/* non KGDB undefined instruction */
/* non IPKDB undefined instruction */
return 0;
case 0xe6000011: /* KGDB installed breakpoint */
case 0xe6000011: /* IPKDB installed breakpoint */
regs[PC] -= 4;
break;
case 0xe6000010: /* breakpoint in kgdb_connect */
case 0xe6000010: /* breakpoint in ipkdb_connect */
break;
}
while (1) {
kgdbcopy(regs, kgdbregs, sizeof kgdbregs);
switch (kgdbcmds()) {
ipkdbcopy(regs, ipkdbregs, sizeof ipkdbregs);
switch (ipkdbcmds()) {
case 1:
kgdbcopy(kgdbregs, regs, sizeof kgdbregs);
ipkdbcopy(ipkdbregs, regs, sizeof ipkdbregs);
if ((cnt = singlestep(regs)) < 0)
panic("singlestep");
regs[PC] += cnt;
@ -121,15 +121,15 @@ kgdb_trap_glue(regs)
}
break;
}
kgdbcopy(kgdbregs, regs, sizeof kgdbregs);
ipkdbcopy(ipkdbregs, regs, sizeof ipkdbregs);
if (PSR_IN_USR_MODE(regs[PSR]) ||
!PSR_IN_32_MODE(regs[PSR]))
panic("KGDB: invalid mode %x", regs[PSR]);
panic("IPKDB: invalid mode %x", regs[PSR]);
return 1;
}
void
kgdbcopy(vs, vd, n)
ipkdbcopy(vs, vd, n)
void *vs, *vd;
int n;
{
@ -140,7 +140,7 @@ kgdbcopy(vs, vd, n)
}
void
kgdbzero(vd, n)
ipkdbzero(vd, n)
void *vd;
int n;
{
@ -151,7 +151,7 @@ kgdbzero(vd, n)
}
int
kgdbcmp(vs, vd, n)
ipkdbcmp(vs, vd, n)
void *vs, *vd;
int n;
{
@ -164,7 +164,7 @@ kgdbcmp(vs, vd, n)
}
int kgdbfbyte(src)
int ipkdbfbyte(src)
unsigned char *src;
{
/* modified db_interface.c source */
@ -182,10 +182,10 @@ unsigned char *src;
ch = *src;
return ch;
} /* kgdbfbyte */
} /* ipkdbfbyte */
int kgdbsbyte(dst, ch)
int ipkdbsbyte(dst, ch)
unsigned char *dst;
int ch;
{
@ -211,4 +211,4 @@ int ch;
tlbflush();
return 0;
} /* kgdbsbyte */
} /* ipkdbsbyte */

View File

@ -1,4 +1,4 @@
/* $NetBSD: kgdb_step.c,v 1.3 1996/10/15 02:11:32 mark Exp $ */
/* $NetBSD: ipkdb_step.c,v 1.1 1996/10/16 19:38:50 ws Exp $ */
/*
* Copyright (C) 1994 Wolfgang Solfrank.
@ -35,7 +35,7 @@
#include <machine/cpu.h>
#include <machine/psl.h>
#include <machine/kgdb.h>
#include <machine/ipkdb.h>
/*
* Faults during instruction fetch? XXX
@ -50,7 +50,7 @@ fetchinst(pc)
pc += sizeof(int);
for (n = sizeof(int); --n >= 0;) {
inst <<= 8;
byte = kgdbfbyte(--pc);
byte = ipkdbfbyte(--pc);
if (byte < 0)
return 0xe7ffffff; /* special hack! */
inst |= byte;
@ -72,11 +72,11 @@ execute(inst, args, regs)
if (PSR_IN_USR_MODE(regs[PSR]) || !PSR_IN_32_MODE(regs[PSR]))
panic("execute");
/*
sp = kgdb_find_stack();
sp = ipkdb_find_stack();
*/
regs[PSR] = Execute(inst, regs[PSR], args, 0);
/*
kgdb_free_stack(sp);
ipkdb_free_stack(sp);
*/
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.S,v 1.13 1996/10/15 02:10:17 mark Exp $ */
/* $NetBSD: locore.S,v 1.14 1996/10/16 19:32:18 ws Exp $ */
/*
* Copyright (C) 1994 Mark Brinicombe
@ -31,7 +31,7 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "kgdb.h"
#include "ipkdb.h"
#include "assym.h"
#include <machine/asm.h>
#include <machine/cpu.h>
@ -453,27 +453,27 @@ Lsigerr:
.globl _esigcode
_esigcode:
#if NKGDB > 0 || NKGDBSLIP > 0
#if NIPKDB > 0
#if 0
/*
* kgdbfbyte and kgdbsbyte are now in kgdb_glue.c and do not tweak
* ipkdbfbyte and ipkdbsbyte are now in ipkdb_glue.c and do not tweak
* the abort handler anymore
*/
.global _kgdbfbyte
_kgdbfbyte:
.global _ipkdbfbyte
_ipkdbfbyte:
ldr ip, abortp
ldr r2, [ip]
add r3, pc, #kgdbfault - . - 8
add r3, pc, #ipkdbfault - . - 8
str r3, [ip]
ldrb r0, [r0]
str r2, [ip]
mov pc, lr
.global _kgdbsbyte
_kgdbsbyte:
.global _ipkdbsbyte
_ipkdbsbyte:
ldr ip, abortp
ldr r2, [ip]
add r3, pc, #kgdbfault - . - 8
add r3, pc, #ipkdbfault - . - 8
str r3, [ip]
strb r1, [r0]
sub r0, r0, r0
@ -482,7 +482,7 @@ _kgdbsbyte:
abortp:
.word Labortdata - _page0
kgdbfault:
ipkdbfault:
mov r0, #0xd3
msr cpsr_all, r0
mvn r0, #0 /* mov r0, #-1 */

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.12 1996/10/16 00:35:45 mark Exp $ */
/* $NetBSD: machdep.c,v 1.13 1996/10/16 19:32:22 ws Exp $ */
/*
* Copyright (c) 1994-1996 Mark Brinicombe.
@ -96,7 +96,7 @@
#include <machine/undefined.h>
#include <machine/rtc.h>
#include "kgdb.h"
#include "ipkdb.h"
#include "hydrabus.h"
#ifdef RC7500
@ -1043,8 +1043,8 @@ initarm(bootconf)
abtstack.physical = physical_freestart;
physical_freestart += NBPG;
undstack.physical = physical_freestart;
#if NKGDB > 0 || NKGDBSLIP > 0
/* Use a bigger UND32 stack when running with kgdb */
#if NIPKDB > 0
/* Use a bigger UND32 stack when running with ipkdb */
physical_freestart += 2*NBPG;
bzero((char *)irqstack.physical - physical_start, 4*NBPG);
@ -1100,8 +1100,8 @@ initarm(bootconf)
abtstack.physical);
map_entry(l2pagetable, undstack.physical-physical_start,
undstack.physical);
#if NKGDB > 0 || NKGDBSLIP > 0
/* Use a bigger UND32 stack when running with kgdb */
#if NIPKDB > 0
/* Use a bigger UND32 stack when running with ipkdb */
map_entry(l2pagetable, NBPG+undstack.physical-physical_start,
NBPG+undstack.physical);
@ -1335,8 +1335,8 @@ initarm(bootconf)
set_stackptr(PSR_IRQ32_MODE, irqstack.virtual + NBPG);
set_stackptr(PSR_ABT32_MODE, abtstack.virtual + NBPG);
#if NKGDB > 0 || NKGDBSLIP > 0
/* Use a bigger UND32 stack when running with kgdb */
#if NIPKDB > 0
/* Use a bigger UND32 stack when running with ipkdb */
set_stackptr(PSR_UND32_MODE, undstack.virtual + 2*NBPG);
#else
set_stackptr(PSR_UND32_MODE, undstack.virtual + NBPG);
@ -1423,12 +1423,12 @@ initarm(bootconf)
irq_init();
printf("done.\n");
/* Initialise kgdb */
/* Initialise ipkdb */
#if NKGDB > 0 || NKGDBSLIP > 0
kgdb_init();
#if NIPKDB > 0
ipkdb_init();
if (boothowto & RB_KDB)
kgdb_connect(0);
ipkdb_connect(0);
#endif
#ifdef DDB

View File

@ -1,4 +1,4 @@
/* $NetBSD: process_machdep.c,v 1.3 1996/10/15 02:26:11 mark Exp $ */
/* $NetBSD: process_machdep.c,v 1.4 1996/10/16 19:32:26 ws Exp $ */
/*
* Copyright (c) 1995 Frank Lancaster. All rights reserved.
@ -171,7 +171,7 @@ process_sstep(p, sstep)
int sstep;
{
if (sstep)
/* this is going to be fun, I'll start off with kgdb_step ... */
/* this is going to be fun, I'll start off with ipkdb_step ... */
return (EINVAL);
return (0);
}

View File

@ -97,7 +97,7 @@ options POSTMORTEM # perform postmortem on panic
# undefined instructions
options KSHELL # kernel developemnt shell (debug)
#options DEBUGTERM # create a debug console
#options KGDB # remote kernel debugging
#options IPKDB # remote kernel debugging
options DDB # in-kernel debugger
#makeoptions DEBUG="-g" # compile full symbol table

View File

@ -101,7 +101,7 @@ options POSTMORTEM # perform postmortem on panic
options KSHELL # kernel developemnt shell (debug)
options LKM # loadable kernel modules
#options DEBUGTERM # create a debug console
#options KGDB # remote kernel debugging
#options IPKDB # remote kernel debugging
options DDB # in-kernel debugger
#makeoptions DEBUG="-g" # compile full symbol table

View File

@ -87,7 +87,7 @@ options POSTMORTEM # perform postmortem on panic
options KSHELL # kernel developemnt shell (debug)
options LKM # loadable kernel modules
#options DEBUGTERM # create a debug console
#options KGDB # remote kernel debugging
#options IPKDB # remote kernel debugging
options DDB # in-kernel debugger
#makeoptions DEBUG="-g" # compile full symbol table

View File

@ -90,7 +90,7 @@ options POSTMORTEM # perform postmortem on panic
options KSHELL # kernel developemnt shell (debug)
options LKM # loadable kernel modules
#options DEBUGTERM # create a debug console
#options KGDB # remote kernel debugging
#options IPKDB # remote kernel debugging
options DDB # in-kernel debugger
#makeoptions DEBUG="-g" # compile full symbol table

View File

@ -87,7 +87,7 @@ options POSTMORTEM # perform postmortem on panic
options KSHELL # kernel developemnt shell (debug)
options LKM # loadable kernel modules
#options DEBUGTERM # create a debug console
#options KGDB # remote kernel debugging
#options IPKDB # remote kernel debugging
#options DDB # in-kernel debugger
#makeoptions DEBUG="-g" # compile full symbol table

View File

@ -95,7 +95,7 @@ options POSTMORTEM # perform postmortem on panic
# undefined instructions
options KSHELL # kernel developemnt shell (debug)
#options DEBUGTERM # create a debug console
#options KGDB # remote kernel debugging
#options IPKDB # remote kernel debugging
options DDB # in-kernel debugger
#makeoptions DEBUG="-g" # compile full symbol table

View File

@ -99,7 +99,7 @@ options POSTMORTEM # perform postmortem on panic
options PROFILE_ASM # profile asm functions were possible
options KSHELL # kernel developemnt shell (debug)
#options DEBUGTERM # create a debug console
#options KGDB # remote kernel debugging
#options IPKDB # remote kernel debugging
options DDB # in-kernel debugger
#makeoptions DEBUG="-g" # compile full symbol table

View File

@ -126,14 +126,14 @@ device rtc
attach rtc at iic
file arch/arm32/mainbus/rtc.c rtc needs-count
#define kgdb
#define ipkdb
#device kie: kgdb
#device kie: ipkdb
#attach kie at podule
#file arch/arm32/podulebus/kgdb_ie.c kie
#file arch/arm32/podulebus/ipkdb_ie.c kie
#file arch/arm32/arm32/kgdb_glue.c kgdb
#file arch/arm32/arm32/kgdb_step.c kgdb
#file arch/arm32/arm32/ipkdb_glue.c ipkdb
#file arch/arm32/arm32/ipkdb_step.c ipkdb
#
# Machine-independent SCSI drivers

View File

@ -1,4 +1,4 @@
/* $NetBSD: com.c,v 1.11 1996/10/15 21:00:55 mark Exp $ */
/* $NetBSD: com.c,v 1.12 1996/10/16 19:32:56 ws Exp $ */
/*-
* Copyright (c) 1993, 1994, 1995, 1996
@ -39,7 +39,7 @@
*/
/*
* For KGDBSLIP support: (NOTE: No relationship to KGDBSERIAL!!!)
* For IPKDBSLIP support: (NOTE: No relationship to IPKDBSERIAL!!!)
*
* Copyright (C) 1996 Frank Lancaster
* Copyright (C) 1995 Wolfgang Solfrank.
@ -102,25 +102,25 @@
#include "com.h"
#if NKGDB_CSLP > 0 || NKGDB_CPPP > 0
#if NIPKDB_CSLP > 0 || NIPKDB_CPPP > 0
#define kgdbinb inb
#define kgdboutb outb
#define ipkdbinb inb
#define ipkdboutb outb
#include <kgdb/kgdb.h>
#include <machine/kgdb.h>
#include <ipkdb/ipkdb.h>
#include <machine/ipkdb.h>
static int kgdbprobe __P((void *, void *));
static int ipkdbprobe __P((void *, void *));
#if NKGDB_CSLP > 0
struct cfattach kgdb_cslp_ca = {
0, kgdb_probe, kgdb_attach
#if NIPKDB_CSLP > 0
struct cfattach ipkdb_cslp_ca = {
0, ipkdb_probe, ipkdb_attach
};
#endif
#if NKGDB_CPPP > 0
struct cfattach kgdb_cppp_ca = {
0, kgdb_probe, kgdb_attach
#if NIPKDB_CPPP > 0
struct cfattach ipkdb_cppp_ca = {
0, ipkdb_probe, ipkdb_attach
};
#endif
#endif
@ -293,9 +293,9 @@ comprobe(parent, match, aux)
rv = 0;
goto out;
}
#if NKGDB_CSLP > 0 || NKGDB_CPPP > 0
#if NIPKDB_CSLP > 0 || NIPKDB_CPPP > 0
if (!parent)
return(kgdbprobe(match, aux));
return(ipkdbprobe(match, aux));
#endif
rv = comprobe1(bc, ioh, iobase);
if (needioh)
@ -1356,7 +1356,7 @@ comcnpollc(dev, on)
}
#if NKGDB_CSLP > 0 || NKGDB_CPPP > 0
#if NIPKDB_CSLP > 0 || NIPKDB_CPPP > 0
/*
* This need upgrading to use bus_io_*. However I need to
@ -1364,71 +1364,71 @@ comcnpollc(dev, on)
*/
static void
kgdbstart(kip)
struct kgdb_if *kip;
ipkdbstart(kip)
struct ipkdb_if *kip;
{
int iobase = kip->port;
int speed;
if (!(kip->drvflags&1)) {
kip->drvflags |= 1;
kgdboutb(iobase + com_lcr, LCR_DLAB);
ipkdboutb(iobase + com_lcr, LCR_DLAB);
speed = comspeed(kip->speed);
kgdboutb(iobase + com_dlbl, speed);
kgdboutb(iobase + com_dlbh, speed >> 8);
kgdboutb(iobase + com_lcr, LCR_8BITS);
kgdboutb(iobase + com_ier, IER_ERXRDY | IER_ETXRDY);
kgdboutb(iobase + com_fifo,
ipkdboutb(iobase + com_dlbl, speed);
ipkdboutb(iobase + com_dlbh, speed >> 8);
ipkdboutb(iobase + com_lcr, LCR_8BITS);
ipkdboutb(iobase + com_ier, IER_ERXRDY | IER_ETXRDY);
ipkdboutb(iobase + com_fifo,
FIFO_ENABLE | FIFO_RCV_RST | FIFO_XMT_RST | FIFO_TRIGGER_4);
kgdboutb(iobase + com_mcr, MCR_IENABLE | MCR_DTR | MCR_RTS);
kgdbinb(iobase + com_iir);
ipkdboutb(iobase + com_mcr, MCR_IENABLE | MCR_DTR | MCR_RTS);
ipkdbinb(iobase + com_iir);
}
}
static void
kgdbleave(kip)
struct kgdb_if *kip;
ipkdbleave(kip)
struct ipkdb_if *kip;
{
int iobase = kip->port;
/* wait for draining */
while (!(kgdbinb(iobase + com_lsr) & LSR_TXRDY));
while (!(ipkdbinb(iobase + com_lsr) & LSR_TXRDY));
}
static int
kgdbgetc(kip, poll)
struct kgdb_if *kip;
ipkdbgetc(kip, poll)
struct ipkdb_if *kip;
int poll;
{
int iobase = kip->port;
int stat, c = -1;
do {
if ((stat = kgdbinb(iobase + com_lsr)) & LSR_RXRDY) {
c = (u_char)kgdbinb(iobase + com_data);
stat = kgdbinb(iobase + com_iir);
if ((stat = ipkdbinb(iobase + com_lsr)) & LSR_RXRDY) {
c = (u_char)ipkdbinb(iobase + com_data);
stat = ipkdbinb(iobase + com_iir);
}
} while (!poll && c == -1);
return c;
}
static void
kgdbputc(kip, c)
struct kgdb_if *kip;
ipkdbputc(kip, c)
struct ipkdb_if *kip;
char c;
{
int iobase = kip->port;
while (!(kgdbinb(iobase + com_lsr) & LSR_TXRDY));
kgdboutb(iobase + com_data, c);
while (!(ipkdbinb(iobase + com_lsr) & LSR_TXRDY));
ipkdboutb(iobase + com_data, c);
}
static int
kgdbprobe(match, aux)
ipkdbprobe(match, aux)
void *match, *aux;
{
struct cfdata *cf = match;
struct kgdb_if *kip = aux;
struct ipkdb_if *kip = aux;
bus_chipset_tag_t bc;
bus_io_handle_t ioh;
char *name;
@ -1450,12 +1450,12 @@ kgdbprobe(match, aux)
kip->speed = kip->cfp->cf_loc[2];
kip->name = "COM";
kip->start = kgdbstart;
kip->leave = kgdbleave;
kip->getc = kgdbgetc;
kip->putc = kgdbputc;
kip->start = ipkdbstart;
kip->leave = ipkdbleave;
kip->getc = ipkdbgetc;
kip->putc = ipkdbputc;
kgdb_serial(kip);
ipkdb_serial(kip);
printf("done: kip->send=%x\n", kip->send);
return 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: kgdb.h,v 1.2 1996/03/14 23:11:23 mark Exp $ */
/* $NetBSD: ipkdb.h,v 1.1 1996/10/16 19:38:53 ws Exp $ */
/*
* Copyright (C) 1993, 1994 Wolfgang Solfrank.
@ -39,7 +39,7 @@
#define SPSR 17
#define NREG 18
extern int kgdbregs[NREG];
extern int ipkdbregs[NREG];
extern int *kgdb_find_stack();
extern void kgdb_free_stack __P((int *));
extern int *ipkdb_find_stack();
extern void ipkdb_free_stack __P((int *));

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.h,v 1.1 1996/10/14 22:49:23 mark Exp $ */
/* $NetBSD: trap.h,v 1.2 1996/10/16 19:32:52 ws Exp $ */
/*
* Copyright (c) 1995 Mark Brinicombe.
@ -43,7 +43,7 @@
*
* This is an undefined instruction.
* Technically the userspace breakpoint could be a SWI
* but we want to keep this the same as KGDB which
* but we want to keep this the same as IPKDB which
* needs an undefined instruction as a break point.
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: com.c,v 1.11 1996/10/15 21:00:55 mark Exp $ */
/* $NetBSD: com.c,v 1.12 1996/10/16 19:32:56 ws Exp $ */
/*-
* Copyright (c) 1993, 1994, 1995, 1996
@ -39,7 +39,7 @@
*/
/*
* For KGDBSLIP support: (NOTE: No relationship to KGDBSERIAL!!!)
* For IPKDBSLIP support: (NOTE: No relationship to IPKDBSERIAL!!!)
*
* Copyright (C) 1996 Frank Lancaster
* Copyright (C) 1995 Wolfgang Solfrank.
@ -102,25 +102,25 @@
#include "com.h"
#if NKGDB_CSLP > 0 || NKGDB_CPPP > 0
#if NIPKDB_CSLP > 0 || NIPKDB_CPPP > 0
#define kgdbinb inb
#define kgdboutb outb
#define ipkdbinb inb
#define ipkdboutb outb
#include <kgdb/kgdb.h>
#include <machine/kgdb.h>
#include <ipkdb/ipkdb.h>
#include <machine/ipkdb.h>
static int kgdbprobe __P((void *, void *));
static int ipkdbprobe __P((void *, void *));
#if NKGDB_CSLP > 0
struct cfattach kgdb_cslp_ca = {
0, kgdb_probe, kgdb_attach
#if NIPKDB_CSLP > 0
struct cfattach ipkdb_cslp_ca = {
0, ipkdb_probe, ipkdb_attach
};
#endif
#if NKGDB_CPPP > 0
struct cfattach kgdb_cppp_ca = {
0, kgdb_probe, kgdb_attach
#if NIPKDB_CPPP > 0
struct cfattach ipkdb_cppp_ca = {
0, ipkdb_probe, ipkdb_attach
};
#endif
#endif
@ -293,9 +293,9 @@ comprobe(parent, match, aux)
rv = 0;
goto out;
}
#if NKGDB_CSLP > 0 || NKGDB_CPPP > 0
#if NIPKDB_CSLP > 0 || NIPKDB_CPPP > 0
if (!parent)
return(kgdbprobe(match, aux));
return(ipkdbprobe(match, aux));
#endif
rv = comprobe1(bc, ioh, iobase);
if (needioh)
@ -1356,7 +1356,7 @@ comcnpollc(dev, on)
}
#if NKGDB_CSLP > 0 || NKGDB_CPPP > 0
#if NIPKDB_CSLP > 0 || NIPKDB_CPPP > 0
/*
* This need upgrading to use bus_io_*. However I need to
@ -1364,71 +1364,71 @@ comcnpollc(dev, on)
*/
static void
kgdbstart(kip)
struct kgdb_if *kip;
ipkdbstart(kip)
struct ipkdb_if *kip;
{
int iobase = kip->port;
int speed;
if (!(kip->drvflags&1)) {
kip->drvflags |= 1;
kgdboutb(iobase + com_lcr, LCR_DLAB);
ipkdboutb(iobase + com_lcr, LCR_DLAB);
speed = comspeed(kip->speed);
kgdboutb(iobase + com_dlbl, speed);
kgdboutb(iobase + com_dlbh, speed >> 8);
kgdboutb(iobase + com_lcr, LCR_8BITS);
kgdboutb(iobase + com_ier, IER_ERXRDY | IER_ETXRDY);
kgdboutb(iobase + com_fifo,
ipkdboutb(iobase + com_dlbl, speed);
ipkdboutb(iobase + com_dlbh, speed >> 8);
ipkdboutb(iobase + com_lcr, LCR_8BITS);
ipkdboutb(iobase + com_ier, IER_ERXRDY | IER_ETXRDY);
ipkdboutb(iobase + com_fifo,
FIFO_ENABLE | FIFO_RCV_RST | FIFO_XMT_RST | FIFO_TRIGGER_4);
kgdboutb(iobase + com_mcr, MCR_IENABLE | MCR_DTR | MCR_RTS);
kgdbinb(iobase + com_iir);
ipkdboutb(iobase + com_mcr, MCR_IENABLE | MCR_DTR | MCR_RTS);
ipkdbinb(iobase + com_iir);
}
}
static void
kgdbleave(kip)
struct kgdb_if *kip;
ipkdbleave(kip)
struct ipkdb_if *kip;
{
int iobase = kip->port;
/* wait for draining */
while (!(kgdbinb(iobase + com_lsr) & LSR_TXRDY));
while (!(ipkdbinb(iobase + com_lsr) & LSR_TXRDY));
}
static int
kgdbgetc(kip, poll)
struct kgdb_if *kip;
ipkdbgetc(kip, poll)
struct ipkdb_if *kip;
int poll;
{
int iobase = kip->port;
int stat, c = -1;
do {
if ((stat = kgdbinb(iobase + com_lsr)) & LSR_RXRDY) {
c = (u_char)kgdbinb(iobase + com_data);
stat = kgdbinb(iobase + com_iir);
if ((stat = ipkdbinb(iobase + com_lsr)) & LSR_RXRDY) {
c = (u_char)ipkdbinb(iobase + com_data);
stat = ipkdbinb(iobase + com_iir);
}
} while (!poll && c == -1);
return c;
}
static void
kgdbputc(kip, c)
struct kgdb_if *kip;
ipkdbputc(kip, c)
struct ipkdb_if *kip;
char c;
{
int iobase = kip->port;
while (!(kgdbinb(iobase + com_lsr) & LSR_TXRDY));
kgdboutb(iobase + com_data, c);
while (!(ipkdbinb(iobase + com_lsr) & LSR_TXRDY));
ipkdboutb(iobase + com_data, c);
}
static int
kgdbprobe(match, aux)
ipkdbprobe(match, aux)
void *match, *aux;
{
struct cfdata *cf = match;
struct kgdb_if *kip = aux;
struct ipkdb_if *kip = aux;
bus_chipset_tag_t bc;
bus_io_handle_t ioh;
char *name;
@ -1450,12 +1450,12 @@ kgdbprobe(match, aux)
kip->speed = kip->cfp->cf_loc[2];
kip->name = "COM";
kip->start = kgdbstart;
kip->leave = kgdbleave;
kip->getc = kgdbgetc;
kip->putc = kgdbputc;
kip->start = ipkdbstart;
kip->leave = ipkdbleave;
kip->getc = ipkdbgetc;
kip->putc = ipkdbputc;
kgdb_serial(kip);
ipkdb_serial(kip);
printf("done: kip->send=%x\n", kip->send);
return 0;

View File

@ -15,7 +15,7 @@ options EXEC_SCRIPT
# various hacks due to bugs in Openfirmware implementation
options FIREPOWERBUGS
options KGDBUSERHACK
options IPKDBUSERHACK
makeoptions DEBUG="-g"
options TCP_COMPAT_42
@ -53,7 +53,7 @@ ofbus* at openfirm?
ofdisk* at openfirm?
ofnet* at openfirm?
kgdbif0 at ofnet?
ipkdbif0 at ofnet?
ofcons* at openfirm?

View File

@ -24,7 +24,7 @@ file arch/powerpc/powerpc/fpu.c
file arch/powerpc/powerpc/fubyte.c
file arch/powerpc/powerpc/fuswintr.c
file arch/powerpc/powerpc/in_cksum.c
file arch/powerpc/powerpc/kgdb_glue.c
file arch/powerpc/powerpc/ipkdb_glue.c ipkdb
file arch/powerpc/powerpc/machdep.c
file arch/powerpc/powerpc/mem.c
file arch/powerpc/powerpc/ofw_machdep.c

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.S,v 1.1 1996/09/30 16:34:48 ws Exp $ */
/* $NetBSD: locore.S,v 1.2 1996/10/16 19:33:09 ws Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -31,7 +31,7 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "kgdb.h"
#include "ipkdb.h"
#include "assym.h"
@ -401,7 +401,7 @@ _intr_depth:
/*
* This code gets copied to all the trap vectors
* (except ISI/DSI, the interrupts, and possibly the debugging traps when using KGDB).
* (except ISI/DSI, the interrupts, and possibly the debugging traps when using IPKDB).
*/
.text
.globl _trapcode,_trapsize
@ -729,24 +729,24 @@ _tlbdsmiss:
ba EXC_DSI
_tlbdsmsize = .-_tlbdsmiss
#if NKGDB > 0
#define kgdbsave 0xde0 /* primary save area for KGDB */
#if NIPKDB > 0
#define ipkdbsave 0xde0 /* primary save area for IPKDB */
/*
* In case of KGDB we want a separate trap catcher for it
* In case of IPKDB we want a separate trap catcher for it
*/
.lcomm kgdbstk,INTSTK /* kgdb stack */
.lcomm ipkdbstk,INTSTK /* ipkdb stack */
.globl _kgdblow,_kgdbsize
_kgdblow:
.globl _ipkdblow,_ipkdbsize
_ipkdblow:
mtsprg 1,1 /* save SP */
stmw 28,kgdbsave(0) /* free r28-r31 */
lis 1,kgdbstk+INTSTK@ha /* get new SP */
addi 1,1,kgdbstk+INTSTK@l
stmw 28,ipkdbsave(0) /* free r28-r31 */
lis 1,ipkdbstk+INTSTK@ha /* get new SP */
addi 1,1,ipkdbstk+INTSTK@l
mflr 28
mfcr 29
bla kgdbtrap
_kgdbsize = .-_kgdblow
#endif /* NKGDB > 0 */
bla ipkdbtrap
_ipkdbsize = .-_ipkdblow
#endif /* NIPKDB > 0 */
/*
* FRAME_SETUP assumes:
@ -1105,12 +1105,12 @@ decrintr:
bl _decr_intr
b intr_exit
#if NKGDB > 0
#if NIPKDB > 0
/*
* Deliberate entry to kgdbtrap
* Deliberate entry to ipkdbtrap
*/
.globl _kgdb_trap
_kgdb_trap:
.globl _ipkdb_trap
_ipkdb_trap:
mtsprg 1,1
mtsprg 2,2
mfmsr 3
@ -1118,7 +1118,7 @@ _kgdb_trap:
andi. 3,3,~(PSL_EE|PSL_ME)@l
mtmsr 3 /* disable interrupts */
isync
stmw 28,kgdbsave(0)
stmw 28,ipkdbsave(0)
mflr 28
li 29,EXC_BPT
mtlr 29
@ -1126,33 +1126,33 @@ _kgdb_trap:
mtsrr0 28
/*
* Now the kgdb trap catching code.
* Now the ipkdb trap catching code.
*/
kgdbtrap:
FRAME_SETUP(kgdbsave)
ipkdbtrap:
FRAME_SETUP(ipkdbsave)
/* Call C trap code: */
addi 3,1,8
bl _kgdb_trap_glue
bl _ipkdb_trap_glue
or. 3,3,3
bne kgdbleave
/* This wasn't for KGDB, so switch to real trap: */
bne ipkdbleave
/* This wasn't for IPKDB, so switch to real trap: */
lwz 3,FRAME_EXC+8(1) /* save exception */
stw 3,kgdbsave+8(0)
FRAME_LEAVE(kgdbsave)
stw 3,ipkdbsave+8(0)
FRAME_LEAVE(ipkdbsave)
mtsprg 1,1 /* prepare for entrance to realtrap */
stmw 28,tempsave(0)
mflr 28
mfcr 29
lwz 31,kgdbsave+8(0)
lwz 31,ipkdbsave+8(0)
mtlr 31
b realtrap
kgdbleave:
FRAME_LEAVE(kgdbsave)
ipkdbleave:
FRAME_LEAVE(ipkdbsave)
rfi
kgdbfault:
ba _kgdbfault
_kgdbfault:
ipkdbfault:
ba _ipkdbfault
_ipkdbfault:
mfsrr0 3
addi 3,3,4
mtsrr0 3
@ -1160,18 +1160,18 @@ _kgdbfault:
rfi
/*
* int kgdbfbyte(unsigned char *p)
* int ipkdbfbyte(unsigned char *p)
*/
.globl _kgdbfbyte
_kgdbfbyte:
.globl _ipkdbfbyte
_ipkdbfbyte:
li 9,EXC_DSI /* establish new fault routine */
lwz 5,0(9)
lis 6,kgdbfault@ha
lwz 6,kgdbfault@l(6)
lis 6,ipkdbfault@ha
lwz 6,ipkdbfault@l(6)
stw 6,0(9)
#ifdef KGDBUSERHACK
lis 8,_kgdbsr@ha
lwz 8,_kgdbsr@l(8)
#ifdef IPKDBUSERHACK
lis 8,_ipkdbsr@ha
lwz 8,_ipkdbsr@l(8)
mtsr USER_SR,8
isync
#endif
@ -1186,18 +1186,18 @@ _kgdbfbyte:
blr
/*
* int kgdbsbyte(unsigned char *p, int c)
* int ipkdbsbyte(unsigned char *p, int c)
*/
.globl _kgdbsbyte
_kgdbsbyte:
.globl _ipkdbsbyte
_ipkdbsbyte:
li 9,EXC_DSI /* establish new fault routine */
lwz 5,0(9)
lis 6,kgdbfault@ha
lwz 6,kgdbfault@l(6)
lis 6,ipkdbfault@ha
lwz 6,ipkdbfault@l(6)
stw 6,0(9)
#ifdef KGDBUSERHACK
lis 8,_kgdbsr@ha
lwz 8,_kgdbsr@l(8)
#ifdef IPKDBUSERHACK
lis 8,_ipkdbsr@ha
lwz 8,_ipkdbsr@l(8)
mtsr USER_SR,8
isync
#endif
@ -1215,7 +1215,7 @@ _kgdbsbyte:
sync
icbi 0,9 /* and instruction caches */
blr
#endif /* NKGDB > 0 */
#endif /* NIPKDB > 0 */
/*
* int setfault()

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.3 1996/10/13 03:31:36 christos Exp $ */
/* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -30,7 +30,7 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "kgdb.h"
#include "ipkdb.h"
#include <sys/param.h>
#include <sys/buf.h>
@ -106,8 +106,8 @@ initppc(startkernel, endkernel, args)
extern tlbimiss, tlbimsize;
extern tlbdlmiss, tlbdlmsize;
extern tlbdsmiss, tlbdsmsize;
#if NKGDB > 0
extern kgdblow, kgdbsize;
#if NIPKDB > 0
extern ipkdblow, ipkdbsize;
#endif
extern void consinit __P((void));
extern void callback __P((void *));
@ -193,11 +193,11 @@ initppc(startkernel, endkernel, args)
case EXC_DSMISS:
bcopy(&tlbdsmiss, (void *)EXC_DSMISS, (size_t)&tlbdsmsize);
break;
#if NKGDB > 0
#if NIPKDB > 0
case EXC_PGM:
case EXC_TRC:
case EXC_BPT:
bcopy(&kgdblow, (void *)exc, (size_t)&kgdbsize);
bcopy(&ipkdblow, (void *)exc, (size_t)&ipkdbsize);
break;
#endif
}
@ -232,13 +232,13 @@ initppc(startkernel, endkernel, args)
}
}
#if NKGDB > 0
#if NIPKDB > 0
/*
* Now trap to KGDB
* Now trap to IPKDB
*/
kgdb_init();
ipkdb_init();
if (boothowto & RB_KDB)
kgdb_connect(0);
ipkdb_connect(0);
#endif
/*

View File

@ -15,7 +15,7 @@ options EXEC_SCRIPT
# various hacks due to bugs in Openfirmware implementation
options FIREPOWERBUGS
options KGDBUSERHACK
options IPKDBUSERHACK
makeoptions DEBUG="-g"
options TCP_COMPAT_42
@ -53,7 +53,7 @@ ofbus* at openfirm?
ofdisk* at openfirm?
ofnet* at openfirm?
kgdbif0 at ofnet?
ipkdbif0 at ofnet?
ofcons* at openfirm?

View File

@ -24,7 +24,7 @@ file arch/powerpc/powerpc/fpu.c
file arch/powerpc/powerpc/fubyte.c
file arch/powerpc/powerpc/fuswintr.c
file arch/powerpc/powerpc/in_cksum.c
file arch/powerpc/powerpc/kgdb_glue.c
file arch/powerpc/powerpc/ipkdb_glue.c ipkdb
file arch/powerpc/powerpc/machdep.c
file arch/powerpc/powerpc/mem.c
file arch/powerpc/powerpc/ofw_machdep.c

View File

@ -1,3 +1,5 @@
/* $NetBSD: ipkdb.h,v 1.1 1996/10/16 19:33:04 ws Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
* Copyright (C) 1995, 1996 TooLs GmbH.
@ -38,13 +40,11 @@
#define MSR 37
#define NREG 38
extern int kgdbregs[NREG];
extern char kgdbstep;
extern int ipkdbregs[NREG];
/* Doesn't handle overlapping regions */
__inline extern void
kgdbcopy(s,d,n)
ipkdbcopy(s,d,n)
void *s, *d;
int n;
{
@ -55,7 +55,7 @@ kgdbcopy(s,d,n)
}
__inline extern void
kgdbzero(d,n)
ipkdbzero(d,n)
void *d;
int n;
{
@ -66,7 +66,7 @@ kgdbzero(d,n)
}
__inline extern int
kgdbcmp(s,d,n)
ipkdbcmp(s,d,n)
void *s, *d;
{
char *sp = s, *dp = d;

View File

@ -1,95 +0,0 @@
/* $NetBSD: kgdb_glue.c,v 1.1 1996/09/30 16:34:47 ws Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
* Copyright (C) 1995, 1996 TooLs GmbH.
* 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by TooLs GmbH.
* 4. The name of TooLs GmbH may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH 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/cdefs.h>
#include <sys/param.h>
#include <kgdb/kgdb.h>
#include <machine/frame.h>
#include <machine/kgdb.h>
#include <machine/pcb.h>
#include <machine/psl.h>
#include <machine/trap.h>
int kgdbregs[NREG];
#ifdef KGDBUSERHACK
int kgdbsr; /* TEMPRORARY (Really needs some better mechanism) XXX */
int savesr;
#endif
void
kgdbinit()
{
}
int
kgdb_poll()
{
/* for now: */
return 0;
}
int
kgdb_trap_glue(frame)
struct trapframe *frame;
{
if (!(frame->srr1 & PSL_PR)
&& (frame->exc == EXC_TRC
|| (frame->exc == EXC_PGM
&& (frame->srr1 & 0x20000))
|| frame->exc == EXC_BPT)) {
#ifdef KGDBUSERHACK
asm ("mfsr %0,%1" : "=r"(savesr) : "K"(USER_SR)); /* see above XXX */
#endif
kgdbcopy(frame, kgdbregs, sizeof kgdbregs);
kgdbregs[MSR] &= ~PSL_BE;
switch (kgdbcmds()) {
case 2:
case 0:
kgdbregs[MSR] &= ~PSL_SE;
break;
case 1:
kgdbregs[MSR] |= PSL_SE;
break;
}
kgdbcopy(kgdbregs, frame, sizeof kgdbregs);
#ifdef KGDBUSERHACK
asm ("mtsr %0,%1; isync" :: "K"(USER_SR), "r"(savesr));
#endif
return 1;
}
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.S,v 1.1 1996/09/30 16:34:48 ws Exp $ */
/* $NetBSD: locore.S,v 1.2 1996/10/16 19:33:09 ws Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -31,7 +31,7 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "kgdb.h"
#include "ipkdb.h"
#include "assym.h"
@ -401,7 +401,7 @@ _intr_depth:
/*
* This code gets copied to all the trap vectors
* (except ISI/DSI, the interrupts, and possibly the debugging traps when using KGDB).
* (except ISI/DSI, the interrupts, and possibly the debugging traps when using IPKDB).
*/
.text
.globl _trapcode,_trapsize
@ -729,24 +729,24 @@ _tlbdsmiss:
ba EXC_DSI
_tlbdsmsize = .-_tlbdsmiss
#if NKGDB > 0
#define kgdbsave 0xde0 /* primary save area for KGDB */
#if NIPKDB > 0
#define ipkdbsave 0xde0 /* primary save area for IPKDB */
/*
* In case of KGDB we want a separate trap catcher for it
* In case of IPKDB we want a separate trap catcher for it
*/
.lcomm kgdbstk,INTSTK /* kgdb stack */
.lcomm ipkdbstk,INTSTK /* ipkdb stack */
.globl _kgdblow,_kgdbsize
_kgdblow:
.globl _ipkdblow,_ipkdbsize
_ipkdblow:
mtsprg 1,1 /* save SP */
stmw 28,kgdbsave(0) /* free r28-r31 */
lis 1,kgdbstk+INTSTK@ha /* get new SP */
addi 1,1,kgdbstk+INTSTK@l
stmw 28,ipkdbsave(0) /* free r28-r31 */
lis 1,ipkdbstk+INTSTK@ha /* get new SP */
addi 1,1,ipkdbstk+INTSTK@l
mflr 28
mfcr 29
bla kgdbtrap
_kgdbsize = .-_kgdblow
#endif /* NKGDB > 0 */
bla ipkdbtrap
_ipkdbsize = .-_ipkdblow
#endif /* NIPKDB > 0 */
/*
* FRAME_SETUP assumes:
@ -1105,12 +1105,12 @@ decrintr:
bl _decr_intr
b intr_exit
#if NKGDB > 0
#if NIPKDB > 0
/*
* Deliberate entry to kgdbtrap
* Deliberate entry to ipkdbtrap
*/
.globl _kgdb_trap
_kgdb_trap:
.globl _ipkdb_trap
_ipkdb_trap:
mtsprg 1,1
mtsprg 2,2
mfmsr 3
@ -1118,7 +1118,7 @@ _kgdb_trap:
andi. 3,3,~(PSL_EE|PSL_ME)@l
mtmsr 3 /* disable interrupts */
isync
stmw 28,kgdbsave(0)
stmw 28,ipkdbsave(0)
mflr 28
li 29,EXC_BPT
mtlr 29
@ -1126,33 +1126,33 @@ _kgdb_trap:
mtsrr0 28
/*
* Now the kgdb trap catching code.
* Now the ipkdb trap catching code.
*/
kgdbtrap:
FRAME_SETUP(kgdbsave)
ipkdbtrap:
FRAME_SETUP(ipkdbsave)
/* Call C trap code: */
addi 3,1,8
bl _kgdb_trap_glue
bl _ipkdb_trap_glue
or. 3,3,3
bne kgdbleave
/* This wasn't for KGDB, so switch to real trap: */
bne ipkdbleave
/* This wasn't for IPKDB, so switch to real trap: */
lwz 3,FRAME_EXC+8(1) /* save exception */
stw 3,kgdbsave+8(0)
FRAME_LEAVE(kgdbsave)
stw 3,ipkdbsave+8(0)
FRAME_LEAVE(ipkdbsave)
mtsprg 1,1 /* prepare for entrance to realtrap */
stmw 28,tempsave(0)
mflr 28
mfcr 29
lwz 31,kgdbsave+8(0)
lwz 31,ipkdbsave+8(0)
mtlr 31
b realtrap
kgdbleave:
FRAME_LEAVE(kgdbsave)
ipkdbleave:
FRAME_LEAVE(ipkdbsave)
rfi
kgdbfault:
ba _kgdbfault
_kgdbfault:
ipkdbfault:
ba _ipkdbfault
_ipkdbfault:
mfsrr0 3
addi 3,3,4
mtsrr0 3
@ -1160,18 +1160,18 @@ _kgdbfault:
rfi
/*
* int kgdbfbyte(unsigned char *p)
* int ipkdbfbyte(unsigned char *p)
*/
.globl _kgdbfbyte
_kgdbfbyte:
.globl _ipkdbfbyte
_ipkdbfbyte:
li 9,EXC_DSI /* establish new fault routine */
lwz 5,0(9)
lis 6,kgdbfault@ha
lwz 6,kgdbfault@l(6)
lis 6,ipkdbfault@ha
lwz 6,ipkdbfault@l(6)
stw 6,0(9)
#ifdef KGDBUSERHACK
lis 8,_kgdbsr@ha
lwz 8,_kgdbsr@l(8)
#ifdef IPKDBUSERHACK
lis 8,_ipkdbsr@ha
lwz 8,_ipkdbsr@l(8)
mtsr USER_SR,8
isync
#endif
@ -1186,18 +1186,18 @@ _kgdbfbyte:
blr
/*
* int kgdbsbyte(unsigned char *p, int c)
* int ipkdbsbyte(unsigned char *p, int c)
*/
.globl _kgdbsbyte
_kgdbsbyte:
.globl _ipkdbsbyte
_ipkdbsbyte:
li 9,EXC_DSI /* establish new fault routine */
lwz 5,0(9)
lis 6,kgdbfault@ha
lwz 6,kgdbfault@l(6)
lis 6,ipkdbfault@ha
lwz 6,ipkdbfault@l(6)
stw 6,0(9)
#ifdef KGDBUSERHACK
lis 8,_kgdbsr@ha
lwz 8,_kgdbsr@l(8)
#ifdef IPKDBUSERHACK
lis 8,_ipkdbsr@ha
lwz 8,_ipkdbsr@l(8)
mtsr USER_SR,8
isync
#endif
@ -1215,7 +1215,7 @@ _kgdbsbyte:
sync
icbi 0,9 /* and instruction caches */
blr
#endif /* NKGDB > 0 */
#endif /* NIPKDB > 0 */
/*
* int setfault()

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.3 1996/10/13 03:31:36 christos Exp $ */
/* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -30,7 +30,7 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "kgdb.h"
#include "ipkdb.h"
#include <sys/param.h>
#include <sys/buf.h>
@ -106,8 +106,8 @@ initppc(startkernel, endkernel, args)
extern tlbimiss, tlbimsize;
extern tlbdlmiss, tlbdlmsize;
extern tlbdsmiss, tlbdsmsize;
#if NKGDB > 0
extern kgdblow, kgdbsize;
#if NIPKDB > 0
extern ipkdblow, ipkdbsize;
#endif
extern void consinit __P((void));
extern void callback __P((void *));
@ -193,11 +193,11 @@ initppc(startkernel, endkernel, args)
case EXC_DSMISS:
bcopy(&tlbdsmiss, (void *)EXC_DSMISS, (size_t)&tlbdsmsize);
break;
#if NKGDB > 0
#if NIPKDB > 0
case EXC_PGM:
case EXC_TRC:
case EXC_BPT:
bcopy(&kgdblow, (void *)exc, (size_t)&kgdbsize);
bcopy(&ipkdblow, (void *)exc, (size_t)&ipkdbsize);
break;
#endif
}
@ -232,13 +232,13 @@ initppc(startkernel, endkernel, args)
}
}
#if NKGDB > 0
#if NIPKDB > 0
/*
* Now trap to KGDB
* Now trap to IPKDB
*/
kgdb_init();
ipkdb_init();
if (boothowto & RB_KDB)
kgdb_connect(0);
ipkdb_connect(0);
#endif
/*

View File

@ -1,4 +1,4 @@
# $NetBSD: files,v 1.101 1996/10/02 05:29:29 cgd Exp $
# $NetBSD: files,v 1.102 1996/10/16 19:33:15 ws Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
@ -21,8 +21,23 @@ define atm
define ether
define fddi
# kgdb has its own "files" file, but is really machine independent
include "kgdb/files.kgdb"
# Device description for machine-independent IPKDB code.
define ipkdb
device ipkdbif: ipkdb
device ipkdbslip: ipkdb
device ipkdbppp: ipkdb
# Common files for any ipkdb support
file ipkdb/ipkdb_ipkdb.c ipkdb needs-flag
file ipkdb/ipkdb_if.c ipkdb
# Support for slip
file ipkdb/ipkdb_slip.c ipkdbslip needs-flag
# Support for ppp (for now only fake)
file ipkdb/ipkdb_ppp.c ipkdbppp needs-flag
# "Chipset" drivers. These are the bus-independent routines which
# contain the cfdrivers. Attachments are provided by files.<bus>

View File

@ -1,4 +1,4 @@
# $NetBSD: files.oldconf,v 1.73 1996/10/02 21:41:37 thorpej Exp $
# $NetBSD: files.oldconf,v 1.74 1996/10/16 19:33:18 ws Exp $
#
adosfs/adlookup.c optional adosfs
adosfs/adutil.c optional adosfs
@ -298,4 +298,5 @@ dev/ccd.c optional ccd needs-count
# XXX !! These should not be necessary!
dev/audio.c optional audio device-driver
kgdb/kgdb_kgdb.c optional kgdb device-driver
# This is here only as a stub! IPKDB doesn't work with old config (yet?).
ipkdb/ipkdb_ipkdb.c optional ipkdb device-driver

View File

@ -10,11 +10,11 @@ attach ofdisk at openfirm
file dev/ofw/ofdisk.c ofdisk needs-flag
# Generic net support
define kgdbofn { [ disable = 0 ] }
device ofnet: ether, ifnet, kgdbofn
define ipkdbofn { [ disable = 0 ] }
device ofnet: ether, ifnet, ipkdbofn
attach ofnet at openfirm
file dev/ofw/ofnet.c ofnet | kgdb_ofn needs-flag
attach kgdbif at kgdbofn with kgdb_ofn
file dev/ofw/ofnet.c ofnet | ipkdb_ofn needs-flag
attach ipkdbif at ipkdbofn with ipkdb_ofn
# Generic console support
device ofcons: tty

View File

@ -1,4 +1,4 @@
/* $NetBSD: ofnet.c,v 1.3 1996/10/13 01:38:14 christos Exp $ */
/* $NetBSD: ofnet.c,v 1.4 1996/10/16 19:33:21 ws Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -49,18 +49,18 @@
#include <dev/ofw/openfirm.h>
#if NKGDB_OFN > 0
#include <kgdb/kgdb.h>
#include <machine/kgdb.h>
#if NIPKDB_OFN > 0
#include <ipkdb/ipkdb.h>
#include <machine/ipkdb.h>
struct cfattach kgdb_ofn_ca = {
0, kgdb_probe, kgdb_attach
struct cfattach ipkdb_ofn_ca = {
0, ipkdb_probe, ipkdb_attach
};
static struct kgdb_if *kifp;
static struct ofn_softc *kgdb_of;
static struct ipkdb_if *kifp;
static struct ofn_softc *ipkdb_of;
static int kgdbprobe __P((void *, void *));
static int ipkdbprobe __P((void *, void *));
#endif
struct ofn_softc {
@ -99,9 +99,9 @@ ofnprobe(parent, match, aux)
char type[32];
int l;
#if NKGDB_OFN > 0
#if NIPKDB_OFN > 0
if (!parent)
return kgdbprobe(match, aux);
return ipkdbprobe(match, aux);
#endif
if ((l = OF_getprop(ofp->phandle, "device_type", type, sizeof type - 1)) < 0)
return 0;
@ -125,11 +125,11 @@ ofnattach(parent, self, aux)
int l;
of->sc_phandle = ofp->phandle;
#if NKGDB_OFN > 0
#if NIPKDB_OFN > 0
if (kifp
&& kifp->unit - 1 == of->sc_dev.dv_unit
&& OF_instance_to_package(kifp->port) == ofp->phandle) {
kgdb_of = of;
ipkdb_of = of;
of->sc_ihandle = kifp->port;
} else
#endif
@ -173,8 +173,8 @@ ofnread(of)
int l, len;
char *bufp;
#if NKGDB_OFN > 0
kgdbrint(kifp, ifp);
#if NIPKDB_OFN > 0
ipkdbrint(kifp, ifp);
#endif
while (1) {
if ((len = OF_read(of->sc_ihandle, buf, sizeof buf)) < 0) {
@ -376,26 +376,26 @@ ofnwatchdog(ifp)
ofninit(of);
}
#if NKGDB_OFN > 0
#if NIPKDB_OFN > 0
static void
kgdbofstart(kip)
struct kgdb_if *kip;
ipkdbofstart(kip)
struct ipkdb_if *kip;
{
int unit = kip->unit - 1;
if (kgdb_of)
kgdbattach(kip, &kgdb_of->sc_arpcom);
if (ipkdb_of)
ipkdbattach(kip, &ipkdb_of->sc_arpcom);
}
static void
kgdbofleave(kip)
struct kgdb_if *kip;
ipkdbofleave(kip)
struct ipkdb_if *kip;
{
}
static int
kgdbofrcv(kip, buf, poll)
struct kgdb_if *kip;
ipkdbofrcv(kip, buf, poll)
struct ipkdb_if *kip;
u_char *buf;
int poll;
{
@ -410,8 +410,8 @@ kgdbofrcv(kip, buf, poll)
}
static void
kgdbofsend(kip, buf, l)
struct kgdb_if *kip;
ipkdbofsend(kip, buf, l)
struct ipkdb_if *kip;
u_char *buf;
int l;
{
@ -419,11 +419,11 @@ kgdbofsend(kip, buf, l)
}
static int
kgdbprobe(match, aux)
ipkdbprobe(match, aux)
void *match, *aux;
{
struct cfdata *cf = match;
struct kgdb_if *kip = aux;
struct ipkdb_if *kip = aux;
static char name[256];
int len;
int phandle;
@ -442,12 +442,12 @@ kgdbprobe(match, aux)
< 0)
return -1;
kip->flags |= KGDB_MYHW;
kip->flags |= IPKDB_MYHW;
kip->name = name;
kip->start = kgdbofstart;
kip->leave = kgdbofleave;
kip->receive = kgdbofrcv;
kip->send = kgdbofsend;
kip->start = ipkdbofstart;
kip->leave = ipkdbofleave;
kip->receive = ipkdbofrcv;
kip->send = ipkdbofsend;
kifp = kip;

View File

@ -1,4 +1,4 @@
What to Look for when Porting the KGDB Interface
What to Look for when Porting the IPKDB Interface
===============================================
Try to avoid calling any routine from the rest of the kernel.
@ -7,7 +7,7 @@ You wouldn't be able to set breakpoints within these routines
during debugging, since this would hang the debugging interface.
Interface between KGDB and Ethernet Board (sys/dev/yy/if_xx.c)
Interface between IPKDB and Ethernet Board (sys/dev/yy/if_xx.c)
--------------------------------------------------------------
General Considerations
@ -22,7 +22,7 @@ the debugging driver must leave the interrupt pending conditions alone
so that the kernel driver gets the interrupt at the next time its
interrupt is enabled (whether this is when the debugger is left or
later with an spl*()). The same holds for the transmit interrupt
pending, at least when kgdbinit determines that there is some packet
pending, at least when ipkdbinit determines that there is some packet
on its way out.
@ -31,28 +31,28 @@ Configuration Files
The interface that is used for debugging has to have a unique
attribute with the option "disable", and must allow the attachment
of a kgdbif. The relevant part of the "files" file for interface
of a ipkdbif. The relevant part of the "files" file for interface
"xx" would look like this:
define kgdbxx { [ disable = 0 ] }
device xx: ether, ifnet, kgdbxx
define ipkdbxx { [ disable = 0 ] }
device xx: ether, ifnet, ipkdbxx
attach xx at yy
file dev/zz/if_xx.c xx | kgdb_xx needs-flag
attach kgdbif at kgdbxx with kgdb_xx
file dev/zz/if_xx.c xx | ipkdb_xx needs-flag
attach ipkdbif at ipkdbxx with ipkdb_xx
with proper values for yy and zz. The file dev/zz/if_xx.c contains
both the code of the kernel driver and the KGDB driver for this
both the code of the kernel driver and the IPKDB driver for this
interface. You might want to #include "xx.h" in there and
conditionalize the compilation of the KGDB driver with
#if NKGDB_XX > 0.
conditionalize the compilation of the IPKDB driver with
#if NIPKDB_XX > 0.
The appropriate part of the machine configuration would read like
this:
xx* at yy
kgdbif0 at xx?
xx* at yy
ipkdbif0 at xx?
Note that the unit for kgdbif in the configuration file must be
Note that the unit for ipkdbif in the configuration file must be
given explicitly! It's used to distinguish the interface used
for debugging from the one you want to debug a new interface
driver for (see below).
@ -62,24 +62,24 @@ Driver Code
The interface is "probed" by calling the parent probe routine with
a first argument of NULL. The last argument to the probe routine
is a struct kgdb_if pointer that needs to be (partly) initialized by
is a struct ipkdb_if pointer that needs to be (partly) initialized by
the probe code. Fields to be set by the probe routine are:
myenetaddr fill this with the own ethernet address of
the device/machine.
flags mark at least KGDB_MYHW here.
flags mark at least IPKDB_MYHW here.
name Name of the device, only used for a message.
port Port number, only used for a message by
machine/device independent code.
start routine called everytime KGDB is entered.
leave routine called everytime KGDB is left.
start routine called everytime IPKDB is entered.
leave routine called everytime IPKDB is left.
receive routine called to receive a packet.
send routine called to send a packet.
Additional fields that may be set are:
myinetaddr fill this with the own internet address,
and mark KGDB_MYIP in flags.
and mark IPKDB_MYIP in flags.
unit These remaining fields are solely for
speed use by the driver.
fill
@ -92,13 +92,13 @@ same board and note its unit and device structure for later use.
The routine should return 0 on success and -1 on failure.
The remainder of the routines are called via function pointers
in the kgdb_if structure. The probe routine needs to fill in
in the ipkdb_if structure. The probe routine needs to fill in
these function pointers with proper values.
void start(struct kgdb_if *kip)
void start(struct ipkdb_if *kip)
This routine gets called every time the debugger is entered.
kip is a pointer to the kgdb_if structure used for debugging.
kip is a pointer to the ipkdb_if structure used for debugging.
It should initialize the hardware and software interface.
@ -106,13 +106,13 @@ This routine should also note the current state of the ethernet board
(as far as it can) so a later call to leave can reinstantiate this
state.
void leave(struct kgdb_if *kip)
void leave(struct ipkdb_if *kip)
This routine is called whenever the debugger is left. It should
restore the ethernet hardware to the state prior to the last call to
start.
int receive(struct kgdb_if *kip, u_char *buf, int poll)
int receive(struct ipkdb_if *kip, u_char *buf, int poll)
This routine should return an ethernet packet to the buffer pointed to
by buf and return its length. The packet should be complete with the
@ -124,7 +124,7 @@ Otherwise it should wait for the next packet.
This routine should return the number of bytes transferred to buf.
void send(struct kgdb_if *kip, u_char *buf, int l)
void send(struct ipkdb_if *kip, u_char *buf, int l)
This routine should send an ethernet packet out of the debugging
interface. The packet is already complete with the ethernet header,
@ -134,27 +134,27 @@ but does not contain the ethernet checksum.
Debugging
If you have a working KGDB, you can test new interface code for a
different interface by supplying "option KGDBTEST" and attaching
a kgdbif1 to the new interface in your configuration file. When
If you have a working IPKDB, you can test new interface code for a
different interface by supplying "option IPKDBTEST" and attaching
a ipkdbif1 to the new interface in your configuration file. When
you boot the resulting kernel with the "-d" option, this will
initialize the new interface right after starting KGDB on the
initialize the new interface right after starting IPKDB on the
working one. Thereafter, the code will continue to send and
receive packets on the new interface until you set the variable
"kgdb_test" to 0.
"ipkdb_test" to 0.
Note that during debugging interface code this way you are using
most of the code that comprises the debugger code itself. So you
have to be extremely careful with setting breakpoints and the like.
Interface between KGDB and Machine (sys/arch/xxx/xxx/kgdb_glue.c)
Interface between IPKDB and Machine (sys/arch/xxx/xxx/ipkdb_glue.c)
-----------------------------------------------------------------
void kgdbcopy(s,d,n) void *s, *d; int n;
void kgdbzero(d,n) void *d; int n;
void kgdbcmp(s,d,n) char *s, *d; int n;
void ipkdbcopy(s,d,n) void *s, *d; int n;
void ipkdbzero(d,n) void *d; int n;
void ipkdbcmp(s,d,n) char *s, *d; int n;
These routines are the same as bcopy, bzero and bcmp resp. They are
here with other names to allow setting breakpoints into the normal
@ -162,35 +162,35 @@ routines during debugging. This implies that you shouldn't use
things like structure assignement in the code that gets used by
the debugger.
void kgdbinit(void)
void ipkdbinit(void)
This routine gets called when the debugger should be entered for the
first time.
int kgdb_poll(void)
int ipkdb_poll(void)
This routine gets called after a panic to check for a keypress by the user.
If implemented it allows the user to press any key on the console to do
the automatic reboot after a panic. Otherwise the debugging interface
will wait forever for some remote debugger to attach in case of a panic.
int kgdbcmds(void)
int ipkdbcmds(void)
There should be call to this routine from somewhere in locore when the
trap mechanism determines that the debugger should be entered, i.e. on
a single step or breakpoint interrupt from kernel code. The trapping
mechanism should already have stored the registers into the global area
kgdbregs. The layout of this area must be the same as that expected
ipkdbregs. The layout of this area must be the same as that expected
by GDB. The return value of this routine is 0, if the user wants to
continue, 1 if the user wants to do single stepping, and 2 if the user
has detached from debugging.
int kgdbfbyte(u_char *p)
int ipkdbfbyte(u_char *p)
This routine should fetch a byte from address p. It must not enter any
trap handling code, but instead return -1 on inability to access the data.
void kgdbsbyte(u_char *p,u_char c)
void ipkdbsbyte(u_char *p,u_char c)
This routine should set the byte pointed to by p to the value given as c.
The routine must not enter any trap handling code. Furthermore it should
@ -198,10 +198,10 @@ reset the modification bit in the relevant page table entry to the value
before the store.
sys/arch/xxx/include/kgdb.h
sys/arch/xxx/include/ipkdb.h
Machine dependent definitions and protoypes should be in
sys/arch/xxx/include/kgdb.h, i.e. in <machine/kgdb.h>. This includes
the size of the array kgdbregs, that holds the contents of the registers
of the debuggee at the time KGDB is entered.
sys/arch/xxx/include/ipkdb.h, i.e. in <machine/ipkdb.h>. This includes
the size of the array ipkdbregs, that holds the contents of the registers
of the debuggee at the time IPKDB is entered.

View File

@ -14,7 +14,7 @@ protocol hangs (Is this necessary? easily possible?).
Support handling of pagefaults so the debugger sees the
same memory contents as the kernel (Extremely questionable,
since it would need too much interaction between debugger
since it would need to much interaction between debugger
and the rest of the kernel, I think).
Support prespecification of debugging host in the config file

17
sys/ipkdb/debuggers.h Normal file
View File

@ -0,0 +1,17 @@
/*
* debuggers.h
* Generated by config program
*/
#include <ipkdb/ipkdb.h>
struct ipkdb_allow ipkdballow[] = {
#ifdef DEBUG_BY_TOOLS
{ { 255, 255, 255, 0 }, { 192, 76, 135, 0 } },
#endif
/*
* This entry doesn't ever match,
* but is needed if there is no other entry in this table.
*/
{ { 0, 0, 0, 0 }, { 1, 1, 1, 1 } }
};
int ipkdbcount = sizeof(ipkdballow)/sizeof(ipkdballow[0]);

View File

@ -28,47 +28,48 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _KGDB_H
#define _KGDB_H
#ifndef _IPKDB_H
#define _IPKDB_H
struct device;
extern int kgdb_probe __P((struct device *, void *, void *));
extern void kgdb_attach __P((struct device *, struct device *, void *));
extern int ipkdb_probe __P((struct device *, void *, void *));
extern void ipkdb_attach __P((struct device *, struct device *, void *));
struct kgdb_allow {
struct ipkdb_allow {
u_char mask[4];
u_char match[4];
};
extern struct kgdb_allow kgdballow[]; /* allowed debuggers */
extern int kgdbcount; /* count of above */
extern struct ipkdb_allow ipkdballow[]; /* allowed debuggers */
extern int ipkdbcount; /* count of above */
extern int kgdbpanic;
extern int ipkdbpanic;
#define KGDBPORT 1138 /* debugging port */
#define IPKDBPORT 1138 /* debugging port */
#ifdef KGDBUSER
extern char kgdbuser; /* nonzero, if we want to debug user mode */
#ifdef IPKDBUSER
extern char ipkdbuser; /* nonzero, if we want to debug user mode */
#endif
extern void kgdbcopy __P((void *, void *, int));
extern void kgdbzero __P((void *, int));
extern int kgdbcmp __P((void *, void *, int));
extern void ipkdbcopy __P((void *, void *, int));
extern void ipkdbzero __P((void *, int));
extern int ipkdbcmp __P((void *, void *, int));
extern int kgdbfbyte __P((unsigned char *));
extern int kgdbsbyte __P((unsigned char *, int));
extern int ipkdbfbyte __P((unsigned char *));
extern int ipkdbsbyte __P((unsigned char *, int));
struct kgdb_if {
/* These fields are used by KGDB itself: */
struct ipkdb_if {
/* These fields are used by IPKDB itself: */
u_char myenetaddr[6]; /* to be filled by the driver */
u_char myinetaddr[4];
u_char hisenetaddr[6];
u_char hisinetaddr[4];
u_char flags; /* driver marks KGDB_MYHW here */
u_char flags; /* driver marks IPKDB_MYHW here */
u_char connect;
u_char pkt[1500];
int pktlen;
int seq;
u_int32_t seq;
u_int32_t id;
int mtu;
u_char ass[1500];
u_char assbit[1500/8/8 + 1];
@ -95,45 +96,45 @@ struct kgdb_if {
};
/* flags: */
#define KGDB_MYHW 0x01
#define KGDB_MYIP 0x02
#define KGDB_HISHW 0x04
#define KGDB_HISIP 0x08
#define KGDB_CONNECTED 0x10
#define IPKDB_MYHW 0x01
#define IPKDB_MYIP 0x02
#define IPKDB_HISHW 0x04
#define IPKDB_HISIP 0x08
#define IPKDB_CONNECTED 0x10
/* connect: */
#define KGDB_NOIF 0 /* no interface */
#define KGDB_NO 1 /* no host may connect to kgdb */
#define KGDB_SAME 2 /* only the previous host may connect */
#define KGDB_ALL 3 /* any host may connect */
#ifndef KGDB_DEF
#define KGDB_DEF KGDB_ALL /* default to anyone may connect */
#define IPKDB_NOIF 0 /* no interface */
#define IPKDB_NO 1 /* no host may connect to ipkdb */
#define IPKDB_SAME 2 /* only the previous host may connect */
#define IPKDB_ALL 3 /* any host may connect */
#ifndef IPKDB_DEF
#define IPKDB_DEF IPKDB_ALL /* default to anyone may connect */
#endif
/* Forward declaration to not force <sys/net/if.h> inclusion */
struct ifnet;
/*
* Interface routines, to be called by kgdb itself
* Interface routines, to be called by ipkdb itself
*/
extern void kgdbinet __P((struct kgdb_if *kip));
extern int kgdbifinit __P((struct kgdb_if *kip, int unit));
extern void ipkdbinet __P((struct ipkdb_if *kip));
extern int ipkdbifinit __P((struct ipkdb_if *kip, int unit));
/*
* Network interface routines, to be called by network card drivers
*/
extern void kgdbrint __P((struct kgdb_if *kip, struct ifnet *ifp));
extern void kgdbgotpkt __P((struct kgdb_if *kip, char *pkt, int len));
extern __inline void kgdbattach __P((struct kgdb_if *kip, struct arpcom *arp));
extern __inline void kgdbattach(kip, arp)
struct kgdb_if *kip;
extern void ipkdbrint __P((struct ipkdb_if *kip, struct ifnet *ifp));
extern void ipkdbgotpkt __P((struct ipkdb_if *kip, char *pkt, int len));
extern __inline void ipkdbattach __P((struct ipkdb_if *kip, struct arpcom *arp));
extern __inline void ipkdbattach(kip, arp)
struct ipkdb_if *kip;
struct arpcom *arp;
{
if (!kip->arp)
kip->arp = arp;
}
/* Routine for SLIP KGDB initialization: (to be called by serial driver) */
extern void kgdb_serial __P((struct kgdb_if *));
/* Routine for SLIP IPKDB initialization: (to be called by serial driver) */
extern void ipkdb_serial __P((struct ipkdb_if *));
#endif

View File

@ -41,19 +41,23 @@
#include <netinet/in.h>
#include <netinet/if_ether.h>
#include <kgdb/kgdb.h>
#include <machine/kgdb.h>
#include <ipkdb/ipkdb.h>
#include <machine/ipkdb.h>
int kgdb_probe __P((struct device *, void *, void *));
void kgdb_attach __P((struct device *, struct device *, void *));
int ipkdb_probe __P((struct device *, void *, void *));
void ipkdb_attach __P((struct device *, struct device *, void *));
struct cfdriver kgdbif_cd = {
NULL, "kgdb", DV_DULL
static void ipkdbrcpy __P((struct ipkdb_if * , void *, void *, int));
static void ipkdbwcpy __P((struct ipkdb_if * , void *, void *, int));
static int ipkdbread __P((struct ipkdb_if *));
struct cfdriver ipkdbif_cd = {
NULL, "ipkdb", DV_DULL
};
/* For the config system the device doesn't exist */
int
kgdb_probe(parent, match, aux)
ipkdb_probe(parent, match, aux)
struct device *parent;
void *match, *aux;
{
@ -61,78 +65,79 @@ kgdb_probe(parent, match, aux)
}
void
kgdb_attach(parent, self, aux)
ipkdb_attach(parent, self, aux)
struct device *parent, *self;
void *aux;
{
panic("kgdb_attach");
panic("ipkdb_attach");
}
static void
kgdbrcpy(kip, sp, dp, l)
struct kgdb_if *kip;
char *sp;
char *dp;
ipkdbrcpy(kip, vsp, vdp, l)
struct ipkdb_if *kip;
void *vsp;
void *vdp;
int l;
{
int l1;
char *sp = vsp, *dp = vdp;
/* bounce source pointer */
while (sp >= kip->gotbuf + sizeof kip->gotbuf)
sp -= sizeof kip->gotbuf;
l1 = kip->gotbuf + sizeof kip->gotbuf - sp;
if (l >= l1) {
kgdbcopy(sp, dp, l1);
ipkdbcopy(sp, dp, l1);
l -= l1;
dp += l1;
sp = kip->gotbuf;
}
if (l)
kgdbcopy(sp, dp, l);
ipkdbcopy(sp, dp, l);
}
static void
kgdbwcpy(kip, sp, dp, l)
struct kgdb_if *kip;
char *sp;
char *dp;
ipkdbwcpy(kip, vsp, vdp, l)
struct ipkdb_if *kip;
void *vsp;
void *vdp;
int l;
{
int l1;
char *sp = vsp, *dp = vdp;
/* bounce destination pointer */
while (dp >= kip->gotbuf + sizeof kip->gotbuf)
dp -= sizeof kip->gotbuf;
l1 = kip->gotbuf + sizeof kip->gotbuf - dp;
if (l >= l1) {
kgdbcopy(sp, dp, l1);
ipkdbcopy(sp, dp, l1);
l -= l1;
sp += l1;
dp = kip->gotbuf;
}
if (l)
kgdbcopy(sp, dp, l);
ipkdbcopy(sp, dp, l);
}
static int
kgdbread(kip)
struct kgdb_if *kip;
ipkdbread(kip)
struct ipkdb_if *kip;
{
struct ifnet *ifp = &kip->arp->ac_if;
struct ether_header *eh;
struct mbuf *m, **mp, *head = 0;
int l, len;
char *buf = kip->got;
kgdbrcpy(kip, buf, &len, sizeof(int));
ipkdbrcpy(kip, buf, &len, sizeof(int));
buf += sizeof(int);
kip->got += len + sizeof(int);
if (kip->got >= kip->gotbuf + sizeof kip->gotbuf)
kip->got -= sizeof kip->gotbuf;
if ((kip->gotlen -= len + sizeof(int)) < 0)
goto bad;
/* Allocate a header mbuf */
MGETHDR(m, M_DONTWAIT, MT_DATA);
if (m == 0)
@ -158,7 +163,7 @@ kgdbread(kip)
l = MCLBYTES;
}
m->m_len = l = min(len, l);
kgdbrcpy(kip, buf, mtod(m, caddr_t), l);
ipkdbrcpy(kip, buf, mtod(m, caddr_t), l);
buf += l;
len -= l;
*mp = m;
@ -174,29 +179,28 @@ kgdbread(kip)
*/
if (kip->arp->ac_if.if_bpf)
bpf_mtap(kip->arp->ac_if.if_bpf, head);
/*
* Note that the interface cannot be in promiscuous mode if
* there are no bpf listeners. And if we are in promiscuous
* mode, we have to check if this packet is really ours.
*/
if ((ifp->if_flags&IFF_PROMISC)
&& kgdbcmp(eh->ether_dhost,
kip->arp->ac_enaddr,
sizeof eh->ether_dhost)
&& ipkdbcmp(eh->ether_dhost,
kip->arp->ac_enaddr,
sizeof eh->ether_dhost)
!= 0
&& !(eh->ether_dhost[0] & 1)) { /* !mcast && !bcast */
m_freem(head);
return 0;
}
#endif
/*
* Fix up data start offset in mbuf to point past ether header
*/
m_adj(head, sizeof(struct ether_header));
ether_input(ifp, eh, head);
return 1;
bad:
@ -215,64 +219,64 @@ bad:
* 1 - deliver 'em just as they would without debugging
*/
#ifdef __notyet__ /* results in mp_map overflows XXX */
char kgdbget = 1;
char ipkdbget = 1;
#else
char kgdbget = 0;
char ipkdbget = 0;
#endif
/*
* Interface driver interrupt handler calls here
* to get packets buffered by KGDB.
* to get packets buffered by IPKDB.
*/
void
kgdbrint(kip, ifp)
struct kgdb_if *kip;
ipkdbrint(kip, ifp)
struct ipkdb_if *kip;
struct ifnet *ifp;
{
if (kip && kip->arp && ifp == &kip->arp->ac_if)
while (kip->gotlen > 0)
kgdbread(kip);
ipkdbread(kip);
}
/*
* KGDB hands out a packet that it doesn't want
* IPKDB hands out a packet that it doesn't want
*/
void
kgdbgotpkt(kip, cp, len)
struct kgdb_if *kip;
ipkdbgotpkt(kip, cp, len)
struct ipkdb_if *kip;
char *cp;
int len;
{
char *buf;
if (!kip->arp || !kgdbget)
if (!kip->arp || !ipkdbget)
return;
if (kip->gotlen + sizeof(int) + len > sizeof kip->gotbuf)
return;
buf = kip->got + kip->gotlen;
kgdbwcpy(kip, &len, buf, sizeof(int));
ipkdbwcpy(kip, &len, buf, sizeof(int));
buf += sizeof(int);
kgdbwcpy(kip, cp, buf, len);
ipkdbwcpy(kip, cp, buf, len);
kip->gotlen += sizeof(int) + roundup(len, sizeof(int));
}
/*
* KGDB wants to know the IP address of its interface
* IPKDB wants to know the IP address of its interface
*/
void
kgdbinet(kip)
struct kgdb_if *kip;
ipkdbinet(kip)
struct ipkdb_if *kip;
{
struct ifaddr *ap;
if (kip->arp) {
for (ap = kip->arp->ac_if.if_addrlist.tqh_first; ap; ap = ap->ifa_list.tqe_next) {
if (ap->ifa_addr->sa_family == AF_INET) {
kgdbcopy(&((struct sockaddr_in *)ap->ifa_addr)->sin_addr,
ipkdbcopy(&((struct sockaddr_in *)ap->ifa_addr)->sin_addr,
kip->myinetaddr, sizeof kip->myinetaddr);
kip->flags |= KGDB_MYIP;
kip->flags |= IPKDB_MYIP;
return;
}
}
@ -280,18 +284,18 @@ kgdbinet(kip)
}
/*
* Initialize KGDB Interface handling
* Initialize IPKDB Interface handling
*/
int
kgdbifinit(kip, unit)
struct kgdb_if *kip;
ipkdbifinit(kip, unit)
struct ipkdb_if *kip;
int unit;
{
struct cfdata *cfp, *pcfp;
extern struct cfdata cfdata[];
short *pp;
u_char *cp;
/* flush buffer */
kip->got = kip->gotbuf;
/* defaults: */
@ -302,7 +306,7 @@ kgdbifinit(kip, unit)
*cp++ = -1;
/* search for interface */
for (cfp = cfdata; cfp->cf_driver; cfp++) {
if (strcmp(cfp->cf_driver->cd_name, "kgdb")
if (strcmp(cfp->cf_driver->cd_name, "ipkdb")
|| cfp->cf_unit != unit)
continue;
kip->cfp = cfp;
@ -312,9 +316,9 @@ kgdbifinit(kip, unit)
pcfp,
kip)
>= 0) {
printf("KGDB on %s at address %x\n",
kip->name, kip->port);
if (cfp->cf_loc[0]) /* disable interface fro system */
printf("IPKDB on %s at address %x\n",
kip->name, kip->port);
if (cfp->cf_loc[0]) /* disable interface from system */
pcfp->cf_fstate = FSTATE_FOUND;
return 0;
}

View File

@ -50,65 +50,76 @@
#include <machine/psl.h>
#include <machine/reg.h>
#include <kgdb/kgdb.h>
#include <ipkdb/ipkdb.h>
#include "debuggers.h"
#include <machine/kgdb.h>
#include <machine/ipkdb.h>
int kgdbpanic = 0;
int ipkdbpanic = 0;
#ifdef KGDBUSER
char kgdbuser = 0; /* allows debugging of user processes by KGDB when set */
#ifdef IPKDBUSER
char ipkdbuser = 0; /* allows debugging of user processes by IPKDB when set */
#endif
static struct kgdb_if kgdb_if;
#ifdef KGDBTEST
static struct kgdb_if new_if;
static int kgdb_test = 0;
static struct ipkdb_if ipkdb_if;
#ifdef IPKDBTEST
static struct ipkdb_if new_if;
static int ipkdb_test = 0;
#endif
static u_char *kgdbaddr __P((u_char *, int *, void **));
static void init __P((struct kgdb_if *));
static void peekmem __P((struct kgdb_if *, char *, char *, long));
static void pokemem __P((struct kgdb_if *, char *, char *, long));
static void getpkt __P((struct kgdb_if *, char *, int *));
static void putpkt __P((struct kgdb_if *, char *, int));
static int check_kgdb __P((struct kgdb_if *, struct in_addr *, u_short, u_short, char *, int));
static int connectkgdb __P((struct kgdb_if *, char *));
static u_char *ipkdbaddr __P((u_char *, int *, void **));
static void peekmem __P((struct ipkdb_if *, u_char *, void *, long));
static void pokemem __P((struct ipkdb_if *, u_char *, void *, long));
static u_int32_t getnl __P((void *));
static u_int getns __P((void *));
static void setnl __P((void *, u_int32_t));
static void setns __P((void *, int));
static u_short cksum __P((u_short, void *, int));
static int assemble __P((struct ipkdb_if *, void *));
static char *inpkt __P((struct ipkdb_if *, char *, int));
static void outpkt __P((struct ipkdb_if *, char *, int, int, int));
static void init __P((struct ipkdb_if *));
static int chksum __P((char *, int));
static void getpkt __P((struct ipkdb_if *, char *, int *));
static void putpkt __P((struct ipkdb_if *, char *, int));
static int maskcmp __P((void *, void *, void *));
static int check_ipkdb __P((struct ipkdb_if *, struct in_addr *, u_short, u_short, char *, int));
static int connectipkdb __P((struct ipkdb_if *, char *));
void
kgdb_init()
ipkdb_init()
{
kgdb_if.connect = KGDB_DEF;
kgdbinit();
if (kgdbifinit(&kgdb_if, 0) < 0
|| !(kgdb_if.flags&KGDB_MYHW)) {
/* Interface not found, drop KGDB */
printf("KGDB: No interface found!\n");
kgdb_if.connect = KGDB_NOIF;
ipkdb_if.connect = IPKDB_DEF;
ipkdbinit();
if ( ipkdbifinit(&ipkdb_if, 0) < 0
|| !(ipkdb_if.flags&IPKDB_MYHW)) {
/* Interface not found, drop IPKDB */
printf("IPKDB: No interface found!\n");
ipkdb_if.connect = IPKDB_NOIF;
boothowto &= ~RB_KDB;
}
}
void
kgdb_connect(when)
ipkdb_connect(when)
int when;
{
boothowto |= RB_KDB;
if (when == 0)
printf("waiting for remote GDB\n");
kgdb_trap();
#ifdef KGDBTEST
new_if.connect = KGDB_ALL;
if (kgdbifinit(&new_if, 1) < 0
|| !(new_if.flags&KGDB_MYHW)) {
printf("waiting for remote debugger\n");
ipkdb_trap();
#ifdef IPKDBTEST
new_if.connect = IPKDB_ALL;
if ( ipkdbifinit(&new_if, 1) < 0
|| !(new_if.flags&IPKDB_MYHW)) {
/* Interface not found, no test */
return;
}
init(&new_if);
putpkt(&new_if, "s", 1);
for (kgdb_test = 1; kgdb_test;) {
for (ipkdb_test = 1; ipkdb_test;) {
static char buf[512];
int plen;
getpkt(&new_if, buf, &plen);
if (!plen)
continue;
@ -118,117 +129,115 @@ kgdb_connect(when)
}
void
kgdb_panic()
ipkdb_panic()
{
if (kgdb_if.connect == KGDB_NOIF)
if (ipkdb_if.connect == IPKDB_NOIF)
return;
kgdbpanic = 1;
kgdb_trap();
ipkdbpanic = 1;
ipkdb_trap();
}
int
kgdbcmds()
ipkdbcmds()
{
static char buf[512];
char *cp;
int plen;
if (!(kgdb_if.flags&KGDB_MYHW)) /* no interface */
return 0;
init(&kgdb_if);
if (kgdbpanic > 1) {
kgdb_if.leave(&kgdb_if);
if (!(ipkdb_if.flags&IPKDB_MYHW)) /* no interface */
return 2;
init(&ipkdb_if);
if (ipkdbpanic > 1) {
ipkdb_if.leave(&ipkdb_if);
return 0;
}
putpkt(&kgdb_if, "s", 1);
putpkt(&ipkdb_if, "s", 1);
while (1) {
getpkt(&kgdb_if, buf, &plen);
getpkt(&ipkdb_if, buf, &plen);
if (!plen) {
if (kgdbpanic && kgdb_poll()) {
kgdb_if.leave(&kgdb_if);
if (ipkdbpanic && ipkdb_poll()) {
ipkdb_if.leave(&ipkdb_if);
return 0;
} else
continue;
} else
kgdbpanic = 0;
ipkdbpanic = 0;
switch (*buf) {
default:
putpkt(&kgdb_if, "eunknown command", 16);
putpkt(&ipkdb_if, "eunknown command", 16);
break;
case 'O':
/* This is an allowed reconnect, ack it */
putpkt(&kgdb_if, "s", 1);
putpkt(&ipkdb_if, "s", 1);
break;
case 'R':
peekmem(&kgdb_if, buf, (char *)kgdbregs, sizeof kgdbregs);
peekmem(&ipkdb_if, buf, ipkdbregs, sizeof ipkdbregs);
break;
case 'W':
if (plen != sizeof kgdbregs + 1) {
putpkt(&kgdb_if, "einvalid register size", 22);
if (plen != sizeof ipkdbregs + 1) {
putpkt(&ipkdb_if, "einvalid register size", 22);
break;
}
pokemem(&kgdb_if, buf + 1, (char *)kgdbregs, sizeof kgdbregs);
pokemem(&ipkdb_if, buf + 1, ipkdbregs, sizeof ipkdbregs);
break;
case 'M':
{
char *addr;
long len;
void *addr, *len;
plen--;
if (!(cp = kgdbaddr(buf + 1, &plen, (void **)&addr))
|| !kgdbaddr(cp, &plen, (void **)&len)) {
putpkt(&kgdb_if, "einvalid peek format", 20);
if ( !(cp = ipkdbaddr(buf + 1, &plen, &addr))
|| !ipkdbaddr(cp, &plen, &len)) {
putpkt(&ipkdb_if, "einvalid peek format", 20);
break;
}
peekmem(&kgdb_if, buf, addr, len);
peekmem(&ipkdb_if, buf, addr, (long)len);
break;
}
case 'N':
{
char *addr;
int len;
void *addr, *len;
plen--;
if (!(cp = kgdbaddr(buf + 1, &plen, (void **)&addr))
|| !(cp = kgdbaddr(cp, &plen, (void **)&len))
|| plen < len) {
putpkt(&kgdb_if, "einvalid poke format", 20);
if ( !(cp = ipkdbaddr(buf + 1, &plen, &addr))
|| !(cp = ipkdbaddr(cp, &plen, &len))
|| plen < (long)len) {
putpkt(&ipkdb_if, "einvalid poke format", 20);
break;
}
pokemem(&kgdb_if, cp, addr, len);
pokemem(&ipkdb_if, cp, addr, (long)len);
break;
}
case 'S':
kgdb_if.leave(&kgdb_if);
ipkdb_if.leave(&ipkdb_if);
return 1;
case 'X':
putpkt(&kgdb_if, "ok",2);
#ifdef KGDBUSER
kgdbuser = 0;
putpkt(&ipkdb_if, "ok",2);
#ifdef IPKDBUSER
ipkdbuser = 0;
#endif
kgdb_if.connect = KGDB_DEF; /* ??? */
kgdb_if.leave(&kgdb_if);
ipkdb_if.connect = IPKDB_DEF; /* ??? */
ipkdb_if.leave(&ipkdb_if);
return 2;
case 'C':
kgdb_if.leave(&kgdb_if);
ipkdb_if.leave(&ipkdb_if);
return 0;
}
}
}
static u_char *
kgdbaddr(cp, pl, dp)
ipkdbaddr(cp, pl, dp)
u_char *cp;
int *pl;
void **dp;
{
/* Assume that sizeof(void*) <= sizeof(long) */
long l;
/* Assume that sizeof(void *) <= sizeof(u_long) */
u_long l;
int i;
if ((*pl -= sizeof(void *)) < 0)
if ((*pl -= sizeof *dp) < 0)
return 0;
for (i = sizeof(void *), l = 0; --i >= 0;) {
for (i = sizeof *dp, l = 0; --i >= 0;) {
l <<= 8;
l |= *cp++;
}
@ -238,55 +247,61 @@ kgdbaddr(cp, pl, dp)
static void
peekmem(ifp, buf, addr, len)
struct kgdb_if *ifp;
char *buf, *addr;
struct ipkdb_if *ifp;
u_char *buf;
void *addr;
long len;
{
char *cp;
u_char *cp, *p = addr;
int l;
cp = buf;
*cp++ = 'p';
for (l = len; --l >= 0;)
*cp++ = kgdbfbyte(addr++);
*cp++ = ipkdbfbyte(p++);
putpkt(ifp, buf, len + 1);
}
static void
pokemem(ifp, cp, addr, len)
struct kgdb_if *ifp;
char *cp, *addr;
struct ipkdb_if *ifp;
u_char *cp;
void *addr;
long len;
{
int c;
u_char *p = addr;
while (--len >= 0)
kgdbsbyte(addr++, *cp++);
ipkdbsbyte(p++, *cp++);
putpkt(ifp, "ok", 2);
}
__inline static u_long
getnl(s)
u_char *s;
__inline static u_int32_t
getnl(vs)
void *vs;
{
return (*s << 24)
|(s[1] << 16)
|(s[2] << 8)
|s[3];
u_char *s = vs;
return (*s << 24)|(s[1] << 16)|(s[2] << 8)|s[3];
}
__inline static u_int
getns(s)
u_char *s;
getns(vs)
void *vs;
{
return (*s << 8)
|s[1];
u_char *s = vs;
return (*s << 8)|s[1];
}
__inline static void
setnl(s, l)
u_char *s;
long l;
setnl(vs, l)
void *vs;
u_int32_t l;
{
u_char *s = vs;
*s++ = l >> 24;
*s++ = l >> 16;
*s++ = l >> 8;
@ -294,20 +309,26 @@ setnl(s, l)
}
__inline static void
setns(s, l)
u_char *s;
setns(vs, l)
void *vs;
int l;
{
u_char *s = vs;
*s++ = l >> 8;
*s = l;
}
static u_short
cksum(s, cp, l)
u_long s;
u_char *cp;
cksum(st, vcp, l)
u_short st;
void *vcp;
int l;
{
for (; (l -= 2) >= 0; cp += 2)
u_char *cp = vcp;
u_long s;
for (s = st; (l -= 2) >= 0; cp += 2)
s += (*cp << 8) + cp[1];
if (l == -1)
s += *cp << 8;
@ -318,15 +339,15 @@ cksum(s, cp, l)
static int
assemble(ifp, buf)
struct kgdb_if *ifp;
u_char *buf;
struct ipkdb_if *ifp;
void *buf;
{
struct ip *ip, iph;
int off, len, i;
u_char *cp, *ecp;
ip = (struct ip *)buf;
kgdbcopy(ip, &iph, sizeof iph);
ipkdbcopy(ip, &iph, sizeof iph);
iph.ip_hl = 5;
iph.ip_tos = 0;
iph.ip_len = 0;
@ -334,7 +355,7 @@ assemble(ifp, buf)
iph.ip_ttl = 0;
iph.ip_sum = 0;
if (ifp->asslen) {
if (kgdbcmp(&iph, ifp->ass, sizeof iph)) {
if (ipkdbcmp(&iph, ifp->ass, sizeof iph)) {
/*
* different packet
* decide whether to keep the old
@ -349,8 +370,8 @@ assemble(ifp, buf)
}
}
if (!ifp->asslen) {
kgdbzero(ifp->assbit, sizeof ifp->assbit);
kgdbcopy(&iph, ifp->ass, sizeof iph);
ipkdbzero(ifp->assbit, sizeof ifp->assbit);
ipkdbcopy(&iph, ifp->ass, sizeof iph);
}
off = getns(&ip->ip_off);
len = ((off&IP_OFFMASK) << 3) + getns(&ip->ip_len) - ip->ip_hl * 4;
@ -378,9 +399,9 @@ assemble(ifp, buf)
for (i = 0; i < ((len >> 3)&7); *cp |= 1 << i++);
}
}
kgdbcopy(buf + ip->ip_hl * 4,
ifp->ass + sizeof *ip + (off << 3),
len - (off << 3));
ipkdbcopy(buf + ip->ip_hl * 4,
ifp->ass + sizeof *ip + (off << 3),
len - (off << 3));
for (cp = ifp->assbit; cp < ifp->assbit + sizeof ifp->assbit;)
if (*cp++ != (u_char)-1)
/* not complete */
@ -393,7 +414,7 @@ assemble(ifp, buf)
static char *
inpkt(ifp, ibuf, poll)
struct kgdb_if *ifp;
struct ipkdb_if *ifp;
char *ibuf;
int poll;
{
@ -404,7 +425,7 @@ inpkt(ifp, ibuf, poll)
struct ip *ip;
struct udphdr *udp;
struct ipovly ipo;
while (1) {
l = ifp->receive(ifp, ibuf, poll != 0);
if (!l) {
@ -425,30 +446,30 @@ inpkt(ifp, ibuf, poll)
break;
switch (getns(&ah->arp_op)) {
case ARPOP_REQUEST:
if ( (ifp->flags&KGDB_MYIP)
&& !kgdbcmp(ah->arp_tpa,
ifp->myinetaddr,
sizeof ifp->myinetaddr)) {
if ( (ifp->flags&IPKDB_MYIP)
&& !ipkdbcmp(ah->arp_tpa,
ifp->myinetaddr,
sizeof ifp->myinetaddr)) {
/* someone requested my address */
kgdbcopy(eh->ether_shost,
eh->ether_dhost,
sizeof eh->ether_dhost);
kgdbcopy(ifp->myenetaddr,
eh->ether_shost,
sizeof eh->ether_shost);
ipkdbcopy(eh->ether_shost,
eh->ether_dhost,
sizeof eh->ether_dhost);
ipkdbcopy(ifp->myenetaddr,
eh->ether_shost,
sizeof eh->ether_shost);
setns(&ah->arp_op, ARPOP_REPLY);
kgdbcopy(ah->arp_sha,
ah->arp_tha,
sizeof ah->arp_tha);
kgdbcopy(ah->arp_spa,
ah->arp_tpa,
sizeof ah->arp_tpa);
kgdbcopy(ifp->myenetaddr,
ah->arp_sha,
sizeof ah->arp_sha);
kgdbcopy(ifp->myinetaddr,
ah->arp_spa,
sizeof ah->arp_spa);
ipkdbcopy(ah->arp_sha,
ah->arp_tha,
sizeof ah->arp_tha);
ipkdbcopy(ah->arp_spa,
ah->arp_tpa,
sizeof ah->arp_tpa);
ipkdbcopy(ifp->myenetaddr,
ah->arp_sha,
sizeof ah->arp_sha);
ipkdbcopy(ifp->myinetaddr,
ah->arp_spa,
sizeof ah->arp_spa);
ifp->send(ifp, ibuf, 74);
continue;
}
@ -458,9 +479,9 @@ inpkt(ifp, ibuf, poll)
}
break;
case ETHERTYPE_IP:
if (kgdbcmp(eh->ether_dhost,
ifp->myenetaddr,
sizeof ifp->myenetaddr))
if (ipkdbcmp(eh->ether_dhost,
ifp->myenetaddr,
sizeof ifp->myenetaddr))
/* not only for us */
break;
ip = (struct ip *)(ibuf + 14);
@ -485,67 +506,67 @@ inpkt(ifp, ibuf, poll)
if (getns(&udp->uh_ulen) != ul)
/* invalid UDP packet length */
break;
kgdbcopy(ip, &ipo, sizeof ipo);
kgdbzero(ipo.ih_x1, sizeof ipo.ih_x1);
ipkdbcopy(ip, &ipo, sizeof ipo);
ipkdbzero(ipo.ih_x1, sizeof ipo.ih_x1);
ipo.ih_len = udp->uh_ulen;
if ( udp->uh_sum
&& cksum(cksum(0, &ipo, sizeof ipo), udp, ul))
/* wrong checksum */
break;
if (!(ifp->flags&KGDB_MYIP)) {
if (!(ifp->flags&IPKDB_MYIP)) {
if ( getns(&udp->uh_sport) == 67
&& getns(&udp->uh_dport) == 68
&& *(char *)(udp + 1) == 2) {
/* this is a BOOTP reply to our ethernet address */
/* should check a bit more? XXX */
kgdbcopy(&ip->ip_dst,
ifp->myinetaddr,
sizeof ifp->myinetaddr);
ifp->flags |= KGDB_MYIP;
ipkdbcopy(&ip->ip_dst,
ifp->myinetaddr,
sizeof ifp->myinetaddr);
ifp->flags |= IPKDB_MYIP;
}
/* give caller a chance to resend his request */
return 0;
}
if ( kgdbcmp(&ip->ip_dst, ifp->myinetaddr, sizeof ifp->myinetaddr)
|| getns(&udp->uh_sport) != KGDBPORT
|| getns(&udp->uh_dport) != KGDBPORT)
if ( ipkdbcmp(&ip->ip_dst, ifp->myinetaddr, sizeof ifp->myinetaddr)
|| getns(&udp->uh_sport) != IPKDBPORT
|| getns(&udp->uh_dport) != IPKDBPORT)
break;
/* so now it's a UDP packet for the debugger */
{
/* Check for reconnect packet */
u_char *p;
p = (u_char *)(udp + 1);
if (!getnl(p) && p[6] == 'O') {
l = getns(p + 4);
if (l <= ul - sizeof *udp - 6
&& check_kgdb(ifp, &ip->ip_src, udp->uh_sport,
udp->uh_dport, p + 6, l)) {
kgdbcopy(&ip->ip_src,
ifp->hisinetaddr,
sizeof ifp->hisinetaddr);
kgdbcopy(eh->ether_shost,
ifp->hisenetaddr,
sizeof ifp->hisenetaddr);
ifp->flags |= KGDB_HISHW|KGDB_HISIP;
if ( l <= ul - sizeof *udp - 6
&& check_ipkdb(ifp, &ip->ip_src, udp->uh_sport,
udp->uh_dport, p + 6, l)) {
ipkdbcopy(&ip->ip_src,
ifp->hisinetaddr,
sizeof ifp->hisinetaddr);
ipkdbcopy(eh->ether_shost,
ifp->hisenetaddr,
sizeof ifp->hisenetaddr);
ifp->flags |= IPKDB_HISHW|IPKDB_HISIP;
return p;
}
}
}
if ((ifp->flags&KGDB_HISIP)
&& kgdbcmp(&ip->ip_src,
ifp->hisinetaddr, sizeof ifp->hisinetaddr))
if ( (ifp->flags&IPKDB_HISIP)
&& ipkdbcmp(&ip->ip_src,
ifp->hisinetaddr, sizeof ifp->hisinetaddr))
/* It's a packet from someone else */
break;
if (!(ifp->flags&KGDB_HISIP)) {
ifp->flags |= KGDB_HISIP;
kgdbcopy(&ip->ip_src,
ifp->hisinetaddr, sizeof ifp->hisinetaddr);
if (!(ifp->flags&IPKDB_HISIP)) {
ifp->flags |= IPKDB_HISIP;
ipkdbcopy(&ip->ip_src,
ifp->hisinetaddr, sizeof ifp->hisinetaddr);
}
if (!(ifp->flags&KGDB_HISHW)) {
ifp->flags |= KGDB_HISHW;
kgdbcopy(eh->ether_shost,
ifp->hisenetaddr, sizeof ifp->hisenetaddr);
if (!(ifp->flags&IPKDB_HISHW)) {
ifp->flags |= IPKDB_HISHW;
ipkdbcopy(eh->ether_shost,
ifp->hisenetaddr, sizeof ifp->hisenetaddr);
}
return (char *)(udp + 1);
default:
@ -553,16 +574,16 @@ inpkt(ifp, ibuf, poll)
break;
}
if (l)
kgdbgotpkt(ifp, ibuf, l);
ipkdbgotpkt(ifp, ibuf, l);
}
return 0;
}
static short kgdb_id = 0;
static short ipkdb_ipid = 0;
static void
outpkt(ifp, in, l, srcport, dstport)
struct kgdb_if *ifp;
struct ipkdb_if *ifp;
char *in;
int l;
int srcport, dstport;
@ -575,30 +596,30 @@ outpkt(ifp, in, l, srcport, dstport)
char obuf[ETHERMTU+14];
struct ipovly ipo;
int i, off;
kgdbzero(obuf, sizeof obuf);
ipkdbzero(obuf, sizeof obuf);
eh = (struct ether_header *)obuf;
if (!(ifp->flags&KGDB_HISHW))
if (!(ifp->flags&IPKDB_HISHW))
for (cp = eh->ether_dhost; cp < eh->ether_dhost + sizeof eh->ether_dhost;)
*cp++ = -1;
else
kgdbcopy(ifp->hisenetaddr, eh->ether_dhost, sizeof eh->ether_dhost);
kgdbcopy(ifp->myenetaddr, eh->ether_shost, sizeof eh->ether_shost);
ipkdbcopy(ifp->hisenetaddr, eh->ether_dhost, sizeof eh->ether_dhost);
ipkdbcopy(ifp->myenetaddr, eh->ether_shost, sizeof eh->ether_shost);
setns(&eh->ether_type, ETHERTYPE_IP);
ip = (struct ip *)(obuf + 14);
ip->ip_v = IPVERSION;
ip->ip_hl = 5;
setns(&ip->ip_id, kgdb_id++);
setns(&ip->ip_id, ipkdb_ipid++);
ip->ip_ttl = 255;
ip->ip_p = IPPROTO_UDP;
kgdbcopy(ifp->myinetaddr, &ip->ip_src, sizeof ip->ip_src);
kgdbcopy(ifp->hisinetaddr, &ip->ip_dst, sizeof ip->ip_dst);
ipkdbcopy(ifp->myinetaddr, &ip->ip_src, sizeof ip->ip_src);
ipkdbcopy(ifp->hisinetaddr, &ip->ip_dst, sizeof ip->ip_dst);
udp = (struct udphdr *)(ip + 1);
setns(&udp->uh_sport, srcport);
setns(&udp->uh_dport, dstport);
setns(&udp->uh_ulen, l + sizeof *udp);
kgdbcopy(ip, &ipo, sizeof ipo);
kgdbzero(ipo.ih_x1, sizeof ipo.ih_x1);
ipkdbcopy(ip, &ipo, sizeof ipo);
ipkdbzero(ipo.ih_x1, sizeof ipo.ih_x1);
ipo.ih_len = udp->uh_ulen;
setns(&udp->uh_sum,
~cksum(cksum(cksum(0, &ipo, sizeof ipo),
@ -608,7 +629,7 @@ outpkt(ifp, in, l, srcport, dstport)
l > 0;
l -= i, in += i, off += i, cp = (u_char *)udp) {
i = l > ifp->mtu - sizeof *ip ? ((ifp->mtu - sizeof *ip)&~7) : l;
kgdbcopy(in, cp, i);
ipkdbcopy(in, cp, i);
setns(&ip->ip_len, i + sizeof *ip);
setns(&ip->ip_off, (l > i ? IP_MF : 0)|(off >> 3));
ip->ip_sum = 0;
@ -621,7 +642,7 @@ outpkt(ifp, in, l, srcport, dstport)
static void
init(ifp)
struct kgdb_if *ifp;
struct ipkdb_if *ifp;
{
u_char *cp;
struct ether_header *eh;
@ -630,58 +651,60 @@ init(ifp)
u_char buf[ETHERMTU+14];
struct ipovly ipo;
int secs = 0;
ifp->start(ifp);
#ifdef __notyet__
if (!(ifp->flags&KGDB_MYIP))
kgdbinet(ifp);
if (!(ifp->flags&IPKDB_MYIP))
ipkdbinet(ifp);
#endif
if (ifp->flags&KGDB_MYIP)
if (ifp->flags&IPKDB_MYIP)
return;
while (!(ifp->flags&KGDB_MYIP)) {
kgdbzero(buf, sizeof buf);
while (!(ifp->flags&IPKDB_MYIP)) {
ipkdbzero(buf, sizeof buf);
cp = buf;
*cp++ = 1; /* BOOTP_REQUEST */
*cp++ = 1; /* Ethernet hardware */
*cp++ = 6; /* length of address */
setnl(++cp, 0x12345678); /* some random number? */
setns(cp + 4, secs++);
kgdbcopy(ifp->myenetaddr, cp + 24, sizeof ifp->myenetaddr);
ipkdbcopy(ifp->myenetaddr, cp + 24, sizeof ifp->myenetaddr);
outpkt(ifp, buf, 300, 68, 67);
inpkt(ifp, buf, 2);
if (kgdbpanic && kgdb_poll()) {
kgdbpanic++;
if (ipkdbpanic && ipkdb_poll()) {
ipkdbpanic++;
return;
}
}
cp = ifp->myinetaddr;
printf("My IP address is %d.%d.%d.%d\n", cp[0], cp[1], cp[2], cp[3]);
printf("My IP address is %d.%d.%d.%d\n",
cp[0], cp[1], cp[2], cp[3]);
}
static int
chksum(p, l)
char *p;
int l;
{
char csum;
for (csum = 0; --l >= 0; csum += *p++);
return csum;
}
static void
getpkt(ifp, buf, lp)
struct kgdb_if *ifp;
struct ipkdb_if *ifp;
char *buf;
int *lp;
{
char *got;
int l;
char ibuf[ETHERMTU+14];
*lp = 0;
while (1) {
if (!(got = inpkt(ifp, ibuf, kgdbpanic != 0))) {
if (!(got = inpkt(ifp, ibuf, ipkdbpanic != 0))) {
*lp = 0;
return;
}
@ -689,40 +712,41 @@ getpkt(ifp, buf, lp)
&& got[6] >= 'A'
&& got[6] <= 'Z'
&& (l = getns(got + 4))
&& (got[6] == 'O' || chksum(got + 6,l) == got[l + 6])) {
kgdbcopy(got + 6, buf, *lp = l);
&& (got[6] == 'O' || chksum(got + 6, l) == got[l + 6])) {
ipkdbcopy(got + 6, buf, *lp = l);
return;
}
if (ifp->pktlen
&& ((ifp->flags&(KGDB_MYIP|KGDB_HISIP|KGDB_CONNECTED))
== (KGDB_MYIP|KGDB_HISIP|KGDB_CONNECTED)))
outpkt(ifp, ifp->pkt, ifp->pktlen, KGDBPORT, KGDBPORT);
if ( ifp->pktlen
&& ((ifp->flags&(IPKDB_MYIP|IPKDB_HISIP|IPKDB_CONNECTED))
== (IPKDB_MYIP|IPKDB_HISIP|IPKDB_CONNECTED)))
outpkt(ifp, ifp->pkt, ifp->pktlen, IPKDBPORT, IPKDBPORT);
}
}
static void
putpkt(ifp, buf, l)
struct kgdb_if *ifp;
struct ipkdb_if *ifp;
char *buf;
int l;
{
setnl(ifp->pkt, ifp->seq++);
setns(ifp->pkt + 4, l);
kgdbcopy(buf, ifp->pkt + 6, l);
ipkdbcopy(buf, ifp->pkt + 6, l);
ifp->pkt[l + 6] = chksum(ifp->pkt + 6, l);
ifp->pktlen = l + 7;
if ((ifp->flags&(KGDB_MYIP|KGDB_HISIP|KGDB_CONNECTED))
!= (KGDB_MYIP|KGDB_HISIP|KGDB_CONNECTED))
if ( (ifp->flags&(IPKDB_MYIP|IPKDB_HISIP|IPKDB_CONNECTED))
!= (IPKDB_MYIP|IPKDB_HISIP|IPKDB_CONNECTED))
return;
outpkt(ifp, ifp->pkt, ifp->pktlen, KGDBPORT, KGDBPORT);
outpkt(ifp, ifp->pkt, ifp->pktlen, IPKDBPORT, IPKDBPORT);
}
static __inline int
maskcmp(in, mask, match)
u_char *in, *mask, *match;
maskcmp(vin, vmask, vmatch)
void *vin, *vmask, *vmatch;
{
int i;
u_char *in = vin, *mask = vmask, *match = vmatch;
for (i = 4; --i >= 0;)
if ((*in++&*mask++) != *match++)
return 0;
@ -730,8 +754,8 @@ maskcmp(in, mask, match)
}
static int
check_kgdb(ifp, shost, sport, dport, p, l)
struct kgdb_if *ifp;
check_ipkdb(ifp, shost, sport, dport, p, l)
struct ipkdb_if *ifp;
struct in_addr *shost;
u_short sport, dport;
char *p;
@ -740,43 +764,43 @@ check_kgdb(ifp, shost, sport, dport, p, l)
u_char hisenet[6];
u_char hisinet[4];
char save;
struct kgdb_allow *kap;
struct ipkdb_allow *kap;
if (chksum(p, l) != p[l])
return 0;
p[l] = 0;
switch (ifp->connect) {
default:
return 0;
case KGDB_SAME:
if (kgdbcmp(shost, ifp->hisinetaddr, sizeof ifp->hisinetaddr))
case IPKDB_SAME:
if (ipkdbcmp(shost, ifp->hisinetaddr, sizeof ifp->hisinetaddr))
return 0;
if (getns(&sport) != KGDBPORT || getns(&dport) != KGDBPORT)
if (getns(&sport) != IPKDBPORT || getns(&dport) != IPKDBPORT)
return 0;
bzero(&hisinet, sizeof hisinet);
break;
case KGDB_ALL:
for (kap = kgdballow; kap < kgdballow + kgdbcount; kap++) {
case IPKDB_ALL:
for (kap = ipkdballow; kap < ipkdballow + ipkdbcount; kap++) {
if (maskcmp(shost, kap->mask, kap->match))
break;
}
if (kap >= kgdballow + kgdbcount)
if (kap >= ipkdballow + ipkdbcount)
return 0;
if (getns(&sport) != KGDBPORT || getns(&dport) != KGDBPORT)
if (getns(&sport) != IPKDBPORT || getns(&dport) != IPKDBPORT)
return 0;
kgdbcopy(ifp->hisenetaddr, hisenet, sizeof hisenet);
kgdbcopy(ifp->hisinetaddr, hisinet, sizeof hisinet);
ipkdbcopy(ifp->hisenetaddr, hisenet, sizeof hisenet);
ipkdbcopy(ifp->hisinetaddr, hisinet, sizeof hisinet);
save = ifp->flags;
kgdbcopy(shost, ifp->hisinetaddr, sizeof ifp->hisinetaddr);
ifp->flags &= ~KGDB_HISHW;
ifp->flags |= KGDB_HISIP;
ipkdbcopy(shost, ifp->hisinetaddr, sizeof ifp->hisinetaddr);
ifp->flags &= ~IPKDB_HISHW;
ifp->flags |= IPKDB_HISIP;
break;
}
if (connectkgdb(ifp, p) < 0) {
if (ifp->connect == KGDB_ALL) {
kgdbcopy(hisenet, ifp->hisenetaddr, sizeof ifp->hisenetaddr);
kgdbcopy(hisinet, ifp->hisinetaddr, sizeof ifp->hisinetaddr);
kgdb_if.flags = save;
if (connectipkdb(ifp, p) < 0) {
if (ifp->connect == IPKDB_ALL) {
ipkdbcopy(hisenet, ifp->hisenetaddr, sizeof ifp->hisenetaddr);
ipkdbcopy(hisinet, ifp->hisinetaddr, sizeof ifp->hisinetaddr);
ipkdb_if.flags = save;
}
return 0;
}
@ -787,7 +811,7 @@ check_kgdb(ifp, shost, sport, dport, p, l)
* Should check whether packet came across the correct interface
*/
int
checkkgdb(shost, sport, dport, m, off, len)
checkipkdb(shost, sport, dport, m, off, len)
struct in_addr *shost;
u_short sport, dport;
struct mbuf *m;
@ -795,38 +819,42 @@ checkkgdb(shost, sport, dport, m, off, len)
char *p;
int l;
char ibuf[ETHERMTU+50];
m_copydata(m, off, len, ibuf);
p = ibuf;
if (getnl(p) || p[6] != 'O')
return 0;
l = getns(p + 4);
if (l > len - 6 || !check_kgdb(&kgdb_if, shost, sport, dport, p + 6, l))
if (l > len - 6 || !check_ipkdb(&ipkdb_if, shost, sport, dport, p + 6, l))
return 0;
kgdb_connect(1);
ipkdb_connect(1);
return 1;
}
static int
connectkgdb(ifp, buf)
struct kgdb_if *ifp;
connectipkdb(ifp, buf)
struct ipkdb_if *ifp;
char *buf;
{
char *cp;
u_char *ip;
if (*buf != 'O')
return -1;
for (cp = buf; *cp && *cp != ':'; cp++);
if (getnl(buf + 1) == ifp->id)
/* It's a retry of a connect packet, ignore it */
return -1;
for (cp = buf + 1 + sizeof(u_int32_t); *cp && *cp != ':'; cp++);
if (!*cp)
return -1;
*cp++ = 0;
ip = ifp->hisinetaddr;
printf("debugged by %s@%s (%d.%d.%d.%d)\n",buf + 1,cp,
ip[0], ip[1], ip[2], ip[3]);
ifp->connect = KGDB_SAME; /* if someone once connected, he may do so again */
ifp->flags |= KGDB_CONNECTED;
printf("debugged by %s@%s (%d.%d.%d.%d)\n", buf + 1 + sizeof(u_int32_t), cp,
ip[0], ip[1], ip[2], ip[3]);
ifp->connect = IPKDB_SAME; /* if someone once connected, he may do so again */
ifp->flags |= IPKDB_CONNECTED;
ifp->seq = 0;
ifp->pktlen = 0;
ifp->id = getnl(buf + 1);
return 0;
}

View File

@ -37,8 +37,8 @@
#include <netinet/in.h>
#include <netinet/if_ether.h>
#include <kgdb/kgdb.h>
#include <machine/kgdb.h>
#include <ipkdb/ipkdb.h>
#include <machine/ipkdb.h>
/* These should be in <net/if_sl.h> or some such! */
#define FRAME_END 0xc0 /* Frame End */
@ -46,27 +46,27 @@
#define TRANS_FRAME_END 0xdc /* transposed frame end */
#define TRANS_FRAME_ESCAPE 0xdd /* transposed frame esc */
struct cfdriver kgdbslip_cd = {
NULL, "kgdb", DV_DULL
struct cfdriver ipkdbslip_cd = {
NULL, "ipkdb", DV_DULL
};
static int
kgdbrcv(kip, buf, poll)
struct kgdb_if *kip;
ipkdbrcv(kip, buf, poll)
struct ipkdb_if *kip;
u_char *buf;
int poll;
{
int c, len = 0;
/* Fake an ether header: */
kgdbcopy(kip->myenetaddr, buf, sizeof kip->myenetaddr);
ipkdbcopy(kip->myenetaddr, buf, sizeof kip->myenetaddr);
buf += sizeof kip->myenetaddr;
kgdbcopy(kip->hisenetaddr, buf, sizeof kip->hisenetaddr);
ipkdbcopy(kip->hisenetaddr, buf, sizeof kip->hisenetaddr);
buf += sizeof kip->hisenetaddr;
*buf++ = ETHERTYPE_IP >> 8;
*buf++ = (u_char)ETHERTYPE_IP;
do {
switch (c = kip->getc(kip, poll)) {
switch ((c = kip->getc(kip, poll))) {
case -1:
break;
case TRANS_FRAME_ESCAPE:
@ -94,8 +94,8 @@ kgdbrcv(kip, buf, poll)
}
static void
kgdbsend(kip, buf, l)
struct kgdb_if *kip;
ipkdbsend(kip, buf, l)
struct ipkdb_if *kip;
u_char *buf;
int l;
{
@ -118,20 +118,20 @@ kgdbsend(kip, buf, l)
}
void
kgdb_serial(kip)
struct kgdb_if *kip;
ipkdb_serial(kip)
struct ipkdb_if *kip;
{
struct cfdata *cf = kip->cfp;
kip->myenetaddr[0] = 1; /* make it a local address */
kip->myenetaddr[1] = 0;
kip->myenetaddr[2] = cf->cf_loc[1] >> 24;
kip->myenetaddr[3] = cf->cf_loc[1] >> 16;
kip->myenetaddr[4] = cf->cf_loc[1] >> 8;
kip->myenetaddr[5] = cf->cf_loc[1];
kip->flags |= KGDB_MYHW;
kip->flags |= IPKDB_MYHW;
kip->mtu = 296;
kip->receive = kgdbrcv;
kip->send = kgdbsend;
kip->receive = ipkdbrcv;
kip->send = ipkdbsend;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: subr_prf.c,v 1.31 1996/10/15 21:35:56 cgd Exp $ */
/* $NetBSD: subr_prf.c,v 1.32 1996/10/16 19:33:30 ws Exp $ */
/*-
* Copyright (c) 1986, 1988, 1991, 1993
@ -63,7 +63,7 @@
*/
#include <machine/stdarg.h>
#include "kgdb.h"
#include "ipkdb.h"
#ifdef KADB
#include <machine/kdbparam.h>
@ -119,8 +119,8 @@ panic(fmt, va_alist)
printf("panic: %:\n", fmt, ap);
va_end(ap);
#if NKGDB > 0
kgdb_panic();
#if NIPKDB > 0
ipkdb_panic();
#endif
#ifdef KGDB
kgdb_panic();

View File

@ -1,10 +0,0 @@
/*
* debuggers.h
* Automatically generated by config program (not yet!)
*/
#include <kgdb/kgdb.h>
struct kgdb_allow kgdballow[] = {
{ { 255, 255, 255, 0 }, { 192, 76, 135, 0 } },
};
int kgdbcount = sizeof(kgdballow)/sizeof(kgdballow[0]);

View File

@ -1,21 +0,0 @@
#
# KGDB support
#
# Config file and device description for machine-independent KGDB code.
#
define kgdb
device kgdbif: kgdb
device kgdbslip: kgdb
device kgdbppp: kgdb
# Common files for any kgdb support
file kgdb/kgdb_kgdb.c kgdb needs-flag
file kgdb/kgdb_if.c kgdb
# Support for slip
file kgdb/kgdb_slip.c kgdbslip needs-flag
# Support for ppp (for now only fake)
file kgdb/kgdb_ppp.c kgdbppp needs-flag

View File

@ -1,4 +1,4 @@
/* $NetBSD: udp_usrreq.c,v 1.37 1996/09/30 16:16:45 ws Exp $ */
/* $NetBSD: udp_usrreq.c,v 1.38 1996/10/16 19:33:39 ws Exp $ */
/*
* Copyright (c) 1982, 1986, 1988, 1990, 1993
@ -34,7 +34,7 @@
*
* @(#)udp_usrreq.c 8.4 (Berkeley) 1/21/94
*/
#include "kgdb.h"
#include "ipkdb.h"
#include <sys/param.h>
#include <sys/malloc.h>
@ -281,13 +281,13 @@ udp_input(m, va_alist)
}
*ip = save_ip;
ip->ip_len += iphlen;
#if NKGDB > 0
if (checkkgdb(&ip->ip_src,
uh->uh_sport,
uh->uh_dport,
m,
iphlen + sizeof(struct udphdr),
len - sizeof(struct udphdr)))
#if NIPKDB > 0
if (checkipkdb(&ip->ip_src,
uh->uh_sport,
uh->uh_dport,
m,
iphlen + sizeof(struct udphdr),
len - sizeof(struct udphdr)))
/* It was a debugger connect packet, just drop it now */
goto bad;
#endif