xcallintr() receive a `clockframe *' argument, not a `trapframe *'.

Setup a DDB context for paused CPUs by defining a soft trap (T_DBPAUSE)
which uses the generic trap handler code to get the trapframe constructed
and then calls on a debugger-defined `suspend' routine.
This commit is contained in:
pk 2002-12-23 00:55:16 +00:00
parent 5c62f82bdf
commit f953a01835
4 changed files with 23 additions and 28 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.h,v 1.11 1999/01/20 00:15:08 pk Exp $ */
/* $NetBSD: trap.h,v 1.12 2002/12/23 00:55:16 pk Exp $ */
/*
* Copyright (c) 1992, 1993
@ -109,6 +109,7 @@
#define T_SVR4_SYSCALL 0x88 /* SVR4 system call */
#define T_BSD_SYSCALL 0x89 /* BSD system call */
#define T_KGDB_EXEC 0x8a /* for kernel gdb */
#define T_DBPAUSE 0x8b /* for smp kernel debugging */
/* 0x8b..0xff are currently unallocated, except the following */
#define T_SVR4_GETCC 0xa0

View File

@ -1,4 +1,4 @@
/* $NetBSD: intr.c,v 1.68 2002/12/21 12:55:54 pk Exp $ */
/* $NetBSD: intr.c,v 1.69 2002/12/23 00:55:18 pk Exp $ */
/*
* Copyright (c) 1992, 1993
@ -270,21 +270,14 @@ nmi_soft(tf)
cpuinfo.fpproc = NULL;
break;
case XPMSG_PAUSECPU:
{
#if defined(DDB)
db_regs_t regs;
regs.db_tf = *tf;
regs.db_fr = *(struct frame *)tf->tf_out[6];
cpuinfo.ci_ddb_regs = &regs;
#endif
/* XXX - assumes DDB is the only user of mp_pause_cpu() */
cpuinfo.flags |= CPUFLG_PAUSED|CPUFLG_GOTMSG;
while (cpuinfo.flags & CPUFLG_PAUSED) /*void*/;
#if defined(DDB)
cpuinfo.ci_ddb_regs = 0;
__asm("ta 0x8b"); /* trap(T_DBPAUSE) */
#else
while (cpuinfo.flags & CPUFLG_PAUSED) /**/;
#endif
return;
}
case XPMSG_FUNC:
{
volatile struct xpmsg_func *p = &cpuinfo.msg.u.xpmsg_func;
@ -306,22 +299,14 @@ static void xcallintr(void *v)
switch (cpuinfo.msg.tag) {
case XPMSG_PAUSECPU:
{
#if defined(DDB)
struct trapframe *tf = v;
volatile db_regs_t regs;
regs.db_tf = *tf;
regs.db_fr = *(struct frame *)tf->tf_out[6];
cpuinfo.ci_ddb_regs = &regs;
#endif
/* XXX - assumes DDB is the only user of mp_pause_cpu() */
cpuinfo.flags |= CPUFLG_PAUSED|CPUFLG_GOTMSG;
while (cpuinfo.flags & CPUFLG_PAUSED) /**/;
#if defined(DDB)
cpuinfo.ci_ddb_regs = NULL;
__asm("ta 0x8b"); /* trap(T_DBPAUSE) */
#else
while (cpuinfo.flags & CPUFLG_PAUSED) /**/;
#endif
return;
}
case XPMSG_FUNC:
{
volatile struct xpmsg_func *p = &cpuinfo.msg.u.xpmsg_func;

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.s,v 1.170 2002/12/21 11:57:41 pk Exp $ */
/* $NetBSD: locore.s,v 1.171 2002/12/23 00:55:16 pk Exp $ */
/*
* Copyright (c) 1996 Paul Kranenburg
@ -1034,7 +1034,7 @@ trapbase_sun4m:
SYSCALL ! 88 = svr4 syscall
SYSCALL ! 89 = bsd syscall
BPT_KGDB_EXEC ! 8a = enter kernel gdb on kernel startup
STRAP(0x8b)
TRAP(T_DBPAUSE) ! 8b = hold CPU for kernel debugger
STRAP(0x8c)
STRAP(0x8d)
STRAP(0x8e)

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.116 2002/12/21 16:23:59 manu Exp $ */
/* $NetBSD: trap.c,v 1.117 2002/12/23 00:55:17 pk Exp $ */
/*
* Copyright (c) 1996
@ -292,6 +292,14 @@ trap(type, psr, pc, tf)
return;
}
}
if (type == T_DBPAUSE) {
/* XXX - deal with kgdb too */
extern void ddb_suspend(struct trapframe *tf);
write_all_windows();
ddb_suspend(tf);
ADVANCE;
return;
}
#endif
#ifdef DIAGNOSTIC
/*
@ -334,6 +342,7 @@ trap(type, psr, pc, tf)
type, pc, tf->tf_npc, bitmask_snprintf(psr,
PSR_BITS, bits, sizeof(bits)));
#ifdef DDB
write_all_windows();
(void) kdb_trap(type, tf);
#endif
panic(type < N_TRAP_TYPES ? trap_type[type] : T);