(some) support for DDB disassembly added.

This commit is contained in:
ragge 1995-07-05 09:54:07 +00:00
parent 620027e37d
commit e0ebe6c93d
2 changed files with 356 additions and 20 deletions

View File

@ -0,0 +1,347 @@
#include <sys/param.h>
#include <sys/proc.h>
#include <sys/reboot.h>
#include <ddb/db_variables.h>
#include <machine/db_machdep.h>
struct vax_insn {
char *insn;
int nargs;
} instr[] = {
"halt", 0,
"nop", 0,
"rei", 0,
"bpt", 0,
"ret", 0,
"rsb", 0,
"ldpctx", 0,
"svpctx", 0,
"cvtps", 4,
"cvtsp", 4,
"index", 6,
"crc", 4,
"prober", 3,
"probew", 3,
"insque", 2,
"remque", 2,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
"", -1,
};
/*
* Disassemble instruction at 'loc'. 'altfmt' specifies an
* (optional) alternate format. Return address of start of
* next instruction.
*/
db_addr_t
db_disasm(loc, altfmt)
db_addr_t loc;
boolean_t altfmt;
{
char *i_pl;
int inr, i;
i_pl = loc;
inr = *i_pl;
if (instr[*i_pl].nargs < 0) {
printf("Ok{nd instruktion: %2x",*i_pl&0xff);
i_pl++;
} else {
printf("\t%s\t",instr[inr].insn);
i_pl++;
for (i=0;i<instr[inr].nargs;i++) {
i_pl = argprint(i_pl);
if (i<instr[inr].nargs-1)
printf(",");
}
}
return i_pl;
}
argprint(plats)
char *plats;
{
switch (*plats&0xf0) {
case 0x00:
case 0x10:
case 0x20:
case 0x30:
printf("$%x",*plats++);
break;
case 0xe0:
if (*plats++&15 == 15) {
printf("%8x",*(unsigned *)plats + plats);
plats += 4;
} else {
printf("Oinpl. s{tt.");
}
break;
default:
printf("Oinpl. s{tt.");
}
return plats;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: db_machdep.c,v 1.1 1995/06/16 15:36:43 ragge Exp $ */
/* $NetBSD: db_machdep.c,v 1.2 1995/07/05 09:54:09 ragge Exp $ */
/*
* Mach Operating System
@ -60,9 +60,10 @@ kdb_trap(frame)
{
int s;
#if 0
if ((boothowto&RB_KDB) == 0)
return(0);
#endif
switch (frame->trap) {
case T_BPTFLT: /* breakpoint */
@ -139,14 +140,16 @@ db_write_bytes(addr, size, data)
{
register char *dst;
printf("db_write_bytes: addr %x, size %x, data %x\n",addr, size, data);
dst = addr;
for (;size;size--)
*dst++ = *data++;
}
int
Debugger()
{
int s=splx(0xe); /* Is this good? We must lower anyway... */
mtpr(0xf,PR_SIRR); /* beg for debugger */
int s = splx(0xe); /* Is this good? We must lower anyway... */
mtpr(0xf, PR_SIRR); /* beg for debugger */
splx(s);
}
@ -181,21 +184,7 @@ db_stack_trace_cmd(addr, have_addr, count, modif)
db_expr_t count;
char *modif;
{
printf("db_stack_trace_cmd - not yet...\n");
}
/*
* Disassemble instruction at 'loc'. 'altfmt' specifies an
* (optional) alternate format. Return address of start of
* next instruction.
*/
db_addr_t
db_disasm(loc, altfmt)
db_addr_t loc;
boolean_t altfmt;
{
printf("db_disasm - not yet...\n");
return loc;
printf("db_stack_trace_cmd - addr %x, have_addr %x, count %x, modif %x\n",addr, have_addr, count, modif);
}
static int ddbescape = 0;