Cosmetic changes, and use db_printf() rather than printf().

This commit is contained in:
mycroft 1995-01-15 00:46:38 +00:00
parent 8476bee7b5
commit c26ad3af41
1 changed files with 10 additions and 29 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: db_interface.c,v 1.14 1994/10/27 04:15:15 cgd Exp $ */ /* $NetBSD: db_interface.c,v 1.15 1995/01/15 00:46:38 mycroft Exp $ */
/* /*
* Mach Operating System * Mach Operating System
@ -45,18 +45,6 @@ extern jmp_buf *db_recover;
int db_active = 0; int db_active = 0;
/*
* Received keyboard interrupt sequence.
*/
kdb_kbd_trap(regs)
db_regs_t *regs;
{
if (db_active == 0 && (boothowto & RB_KDB)) {
printf("\n\nkernel: keyboard interrupt\n");
kdb_trap(-1, 0, regs);
}
}
/* /*
* kdb_trap - field a TRACE or BPT trap * kdb_trap - field a TRACE or BPT trap
*/ */
@ -84,22 +72,15 @@ kdb_trap(type, code, regs)
} }
} }
/* Should switch to kdb`s own stack here. */ /* XXX Should switch to kdb`s own stack here. */
ddb_regs = *regs; ddb_regs = *regs;
if (ISPL(regs->tf_cs) == SEL_KPL) {
if ((regs->tf_cs & 0x3) == 0) {
/* /*
* Kernel mode - esp and ss not saved * Kernel mode - esp and ss not saved
*/ */
ddb_regs.tf_esp = (int)&regs->tf_esp; /* kernel stack pointer */ ddb_regs.tf_esp = (int)&regs->tf_esp; /* kernel stack pointer */
#if 0 asm("movw %%ss,%W0" : "=r" (ddb_regs.tf_ss));
ddb_regs.ss = KERNEL_DS;
#endif
asm(" movw %%ss,%%ax; movl %%eax,%0 "
: "=g" (ddb_regs.tf_ss)
:
: "ax");
} }
s = splhigh(); s = splhigh();
@ -122,7 +103,7 @@ kdb_trap(type, code, regs)
regs->tf_eip = ddb_regs.tf_eip; regs->tf_eip = ddb_regs.tf_eip;
regs->tf_cs = ddb_regs.tf_cs; regs->tf_cs = ddb_regs.tf_cs;
regs->tf_eflags = ddb_regs.tf_eflags; regs->tf_eflags = ddb_regs.tf_eflags;
if (regs->tf_cs & 0x3) { if (ISPL(regs->tf_cs) != SEL_KPL) {
/* ring transit - saved esp and ss valid */ /* ring transit - saved esp and ss valid */
regs->tf_esp = ddb_regs.tf_esp; regs->tf_esp = ddb_regs.tf_esp;
regs->tf_ss = ddb_regs.tf_ss; regs->tf_ss = ddb_regs.tf_ss;
@ -140,12 +121,12 @@ extern int trap_types;
kdbprinttrap(type, code) kdbprinttrap(type, code)
int type, code; int type, code;
{ {
printf("kernel: "); db_printf("kernel: ");
if (type >= trap_types || type < 0) if (type >= trap_types || type < 0)
printf("type %d", type); db_printf("type %d", type);
else else
printf("%s", trap_type[type]); db_printf("%s", trap_type[type]);
printf(" trap, code=%x\n", code); db_printf(" trap, code=%x\n", code);
} }
/* /*
@ -216,5 +197,5 @@ db_write_bytes(addr, size, data)
int int
Debugger() Debugger()
{ {
asm ("int $3"); asm("int $3");
} }