Clean up a bit.
This commit is contained in:
parent
52778508b5
commit
e2662b6ceb
|
@ -27,18 +27,17 @@
|
||||||
/*
|
/*
|
||||||
* Interface to new debugger.
|
* Interface to new debugger.
|
||||||
*/
|
*/
|
||||||
#include "param.h"
|
#include <sys/param.h>
|
||||||
#include "proc.h"
|
#include <sys/proc.h>
|
||||||
#include <machine/db_machdep.h>
|
|
||||||
|
|
||||||
#include <sys/reboot.h>
|
#include <sys/reboot.h>
|
||||||
|
#include <sys/systm.h> /* just for boothowto --eichin */
|
||||||
|
|
||||||
#include <vm/vm_statistics.h>
|
#include <vm/vm_statistics.h>
|
||||||
#include <vm/pmap.h>
|
#include <vm/pmap.h>
|
||||||
|
|
||||||
#include <setjmp.h>
|
#include <machine/trap.h>
|
||||||
#include <sys/systm.h> /* just for boothowto --eichin */
|
#include <machine/mon.h>
|
||||||
#include "machine/trap.h"
|
#include <machine/db_machdep.h>
|
||||||
#include "machine/mon.h"
|
|
||||||
|
|
||||||
extern jmp_buf db_jmpbuf; /* XXX used in i386. ? */
|
extern jmp_buf db_jmpbuf; /* XXX used in i386. ? */
|
||||||
extern jmp_buf *db_recover;
|
extern jmp_buf *db_recover;
|
||||||
|
@ -49,14 +48,13 @@ int db_active = 0;
|
||||||
* Received keyboard interrupt sequence.
|
* Received keyboard interrupt sequence.
|
||||||
*/
|
*/
|
||||||
kdb_kintr(regs)
|
kdb_kintr(regs)
|
||||||
register struct mc68020_saved_state *regs;
|
register struct mc68020_saved_state *regs;
|
||||||
{
|
{
|
||||||
if (db_active == 0 && (boothowto & RB_KDB)) {
|
if (db_active == 0 && (boothowto & RB_KDB)) {
|
||||||
printf("\n\nkernel: keyboard interrupt\n");
|
printf("\n\nkernel: keyboard interrupt\n");
|
||||||
kdb_trap(-1, regs);
|
kdb_trap(-1, regs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#define T_BRKPT T_TRAP15
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* kdb_trap - field a TRACE or BPT trap
|
* kdb_trap - field a TRACE or BPT trap
|
||||||
|
@ -65,65 +63,57 @@ kdb_trap(type, regs)
|
||||||
int type;
|
int type;
|
||||||
register struct mc68020_saved_state *regs;
|
register struct mc68020_saved_state *regs;
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type) {
|
||||||
{
|
case T_TRACE: /* single-step */
|
||||||
case T_TRACE: /* single-step */
|
case T_BREAKPOINT: /* breakpoint */
|
||||||
case T_BRKPT: /* breakpoint */
|
|
||||||
/* case T_WATCHPOINT:*/
|
/* case T_WATCHPOINT:*/
|
||||||
break;
|
break;
|
||||||
#if 0
|
|
||||||
case EXC_BREAKPOINT:
|
|
||||||
type = T_BRKPT;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case -1:
|
case -1:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
kdbprinttrap(type, 0);
|
kdbprinttrap(type, 0);
|
||||||
if (db_recover != 0) {
|
if (db_recover != 0) {
|
||||||
db_printf("Caught exception in ddb.\n");
|
db_printf("Caught exception in ddb.\n");
|
||||||
db_error("");
|
db_error("");
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* Should switch to kdb's own stack here. */
|
/* Should switch to kdb's own stack here. */
|
||||||
|
|
||||||
ddb_regs = *regs;
|
ddb_regs = *regs;
|
||||||
|
|
||||||
db_active++;
|
db_active++;
|
||||||
cnpollc(TRUE);
|
cnpollc(TRUE);
|
||||||
/* (void) setvideoenable(1);*/
|
/* (void) setvideoenable(1);*/
|
||||||
|
|
||||||
db_trap(type, 0);
|
db_trap(type, 0);
|
||||||
|
|
||||||
cnpollc(FALSE);
|
cnpollc(FALSE);
|
||||||
db_active--;
|
db_active--;
|
||||||
|
|
||||||
*regs = ddb_regs;
|
*regs = ddb_regs;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Indicate that single_step is for KDB.
|
* Indicate that single_step is for KDB.
|
||||||
* But lock out interrupts to prevent TRACE_KDB from setting the
|
* But lock out interrupts to prevent TRACE_KDB from setting the
|
||||||
* trace bit in the current SR (and trapping while exiting KDB).
|
* trace bit in the current SR (and trapping while exiting KDB).
|
||||||
*/
|
*/
|
||||||
(void) spl7();
|
(void) spl7();
|
||||||
/*
|
/* if (!USERMODE(regs->sr) && (regs->sr & SR_T1) && (current_thread())) {
|
||||||
if (!USERMODE(regs->sr) && (regs->sr & SR_T1) && (current_thread())) {
|
current_thread()->pcb->pcb_flag |= TRACE_KDB;
|
||||||
current_thread()->pcb->pcb_flag |= TRACE_KDB;
|
}*/
|
||||||
*/
|
/* if ((regs->sr & SR_T1) && (current_thread())) {
|
||||||
/* if ((regs->sr & SR_T1) && (current_thread())) {
|
current_thread()->pcb->flag |= TRACE_KDB;
|
||||||
current_thread()->pcb->flag |= TRACE_KDB;
|
}*/
|
||||||
}*/
|
|
||||||
|
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern char * trap_type[];
|
extern char *trap_type[];
|
||||||
#define TRAP_TYPES 15
|
extern int trap_types;
|
||||||
/*extern int TRAP_TYPES;*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Print trap reason.
|
* Print trap reason.
|
||||||
|
@ -132,17 +122,16 @@ kdbprinttrap(type, code)
|
||||||
int type, code;
|
int type, code;
|
||||||
{
|
{
|
||||||
printf("kernel: ");
|
printf("kernel: ");
|
||||||
if (type >= TRAP_TYPES || type < 0)
|
if (type >= trap_types || type < 0)
|
||||||
printf("type %d", type);
|
printf("type %d", type);
|
||||||
else
|
else
|
||||||
printf("%s", trap_type[type]);
|
printf("%s", trap_type[type]);
|
||||||
printf(" trap\n");
|
printf(" trap\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Read bytes from kernel address space for debugger.
|
* Read bytes from kernel address space for debugger.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
db_read_bytes(addr, size, data)
|
db_read_bytes(addr, size, data)
|
||||||
vm_offset_t addr;
|
vm_offset_t addr;
|
||||||
|
@ -153,7 +142,7 @@ db_read_bytes(addr, size, data)
|
||||||
|
|
||||||
src = (char *)addr;
|
src = (char *)addr;
|
||||||
while (--size >= 0)
|
while (--size >= 0)
|
||||||
*data++ = *src++;
|
*data++ = *src++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -176,30 +165,29 @@ db_write_bytes(addr, size, data)
|
||||||
addr <= (vm_offset_t)&etext)
|
addr <= (vm_offset_t)&etext)
|
||||||
{
|
{
|
||||||
#ifdef 0 /* XXX - needs to be cpu_dependent, probably */
|
#ifdef 0 /* XXX - needs to be cpu_dependent, probably */
|
||||||
oldmap0 = getpgmap(addr);
|
oldmap0 = getpgmap(addr);
|
||||||
setpgmap(addr, (oldmap0 & ~PG_PROT) | PG_KW);
|
setpgmap(addr, (oldmap0 & ~PG_PROT) | PG_KW);
|
||||||
|
|
||||||
addr1 = sun_trunc_page(addr + size - 1);
|
addr1 = sun_trunc_page(addr + size - 1);
|
||||||
if (sun_trunc_page(addr) != addr1) {
|
if (sun_trunc_page(addr) != addr1) {
|
||||||
/* data crosses a page boundary */
|
/* data crosses a page boundary */
|
||||||
|
|
||||||
oldmap1 = getpgmap(addr1);
|
oldmap1 = getpgmap(addr1);
|
||||||
setpgmap(addr1, (oldmap1 & ~PG_PROT) | PG_KW);
|
setpgmap(addr1, (oldmap1 & ~PG_PROT) | PG_KW);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
dst = (char *)addr;
|
dst = (char *)addr;
|
||||||
|
|
||||||
while (--size >= 0)
|
while (--size >= 0)
|
||||||
*dst++ = *data++;
|
*dst++ = *data++;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (oldmap0) {
|
if (oldmap0) {
|
||||||
setpgmap(addr, oldmap0);
|
setpgmap(addr, oldmap0);
|
||||||
if (oldmap1) {
|
if (oldmap1)
|
||||||
setpgmap(addr1, oldmap1);
|
setpgmap(addr1, oldmap1);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -207,5 +195,5 @@ db_write_bytes(addr, size, data)
|
||||||
int
|
int
|
||||||
Debugger()
|
Debugger()
|
||||||
{
|
{
|
||||||
asm ("trap #15");
|
asm ("trap #15");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue