summaryrefslogtreecommitdiff
path: root/sys/arch/mvme88k/ddb
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2004-01-07 17:52:31 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2004-01-07 17:52:31 +0000
commit104a4a46db41203a2ece6806fd360dcb98c38361 (patch)
tree51164e4423064a1bcce1803f4a2d32f8b16d1824 /sys/arch/mvme88k/ddb
parent448c51c2b60a5de0a473313b1bd7ebd3d259d321 (diff)
Constify, remove db_task_name() Mach leftover, and fix an hilarious typo
in db_interface.c comments while there.
Diffstat (limited to 'sys/arch/mvme88k/ddb')
-rw-r--r--sys/arch/mvme88k/ddb/db_disasm.c124
-rw-r--r--sys/arch/mvme88k/ddb/db_interface.c117
-rw-r--r--sys/arch/mvme88k/ddb/db_sstep.c4
-rw-r--r--sys/arch/mvme88k/ddb/db_trace.c7
4 files changed, 99 insertions, 153 deletions
diff --git a/sys/arch/mvme88k/ddb/db_disasm.c b/sys/arch/mvme88k/ddb/db_disasm.c
index c5bbf03118c..e97647618cb 100644
--- a/sys/arch/mvme88k/ddb/db_disasm.c
+++ b/sys/arch/mvme88k/ddb/db_disasm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_disasm.c,v 1.12 2003/10/05 20:25:06 miod Exp $ */
+/* $OpenBSD: db_disasm.c,v 1.13 2004/01/07 17:52:30 miod Exp $ */
/*
* Mach Operating System
* Copyright (c) 1993-1991 Carnegie Mellon University
@@ -40,15 +40,15 @@
#include <ddb/db_output.h> /* db_printf() */
#include <ddb/db_interface.h>
-static char *instwidth[4] = {
+static const char *instwidth[4] = {
".d", " ", ".h", ".b"
};
-static char *condname[6] = {
+static const char *condname[6] = {
"gt0 ", "eq0 ", "ge0 ", "lt0 ", "ne0 ", "le0 "
};
-static char *m88100_ctrlreg[64] = {
+static const char *m88100_ctrlreg[64] = {
"cr0(PID) ",
"cr1(PSR) ",
"cr2(EPSR) ",
@@ -79,26 +79,29 @@ static char *m88100_ctrlreg[64] = {
"fcr6(FPRH) ",
"fcr7(FPRL) ",
"fcr8(FPIT) ",
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
"fcr62(FPSR)",
"fcr63(FPCR)"
};
-static char *m88110_ctrlreg[64] = {
+static const char *m88110_ctrlreg[64] = {
"cr0(PID) ",
"cr1(PSR) ",
"cr2(EPSR) ",
- 0,
+ NULL,
"cr4(EXIP) ",
"cr5(ENIP) ",
- 0,
+ NULL,
"cr7(VBR) ",
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
"cr14(RES1) ",
"cr15(RES2) ",
"cr16(SR0) ",
@@ -107,9 +110,9 @@ static char *m88110_ctrlreg[64] = {
"cr19(SR3) ",
"cr20(SR4) ",
"fcr0(FPECR)",
- 0,
- 0,
- 0,
+ NULL,
+ NULL,
+ NULL,
"cr25(ICMD) ",
"cr26(ICTL) ",
"cr27(ISAR) ",
@@ -122,7 +125,9 @@ static char *m88110_ctrlreg[64] = {
"cr34(ISR) ",
"cr35(ILAR) ",
"cr36(IPAR) ",
- 0,0,0,
+ NULL,
+ NULL,
+ NULL,
"cr40(DCMD) ",
"cr41(DCTL) ",
"cr42(DSAR) ",
@@ -135,7 +140,8 @@ static char *m88110_ctrlreg[64] = {
"cr49(DSR) ",
"cr50(DLAR) ",
"cr51(DPAR) ",
- 0,0,0,0,0,0,0,0,0,0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL,
"fcr62(FPSR)",
"fcr63(FPCR)"
};
@@ -149,26 +155,26 @@ static char *m88110_ctrlreg[64] = {
} while (0)
/* prototypes */
-void oimmed(int, char *, long);
-void ctrlregs(int, char *, long);
+void oimmed(int, const char *, long);
+void ctrlregs(int, const char *, long);
void printsod(int);
-void sindou(int, char *, long);
-void jump(int, char *, long);
-void instset(int, char *, long);
+void sindou(int, const char *, long);
+void jump(int, const char *, long);
+void instset(int, const char *, long);
void symofset(int, int, int);
-void obranch(int, char *, long);
-void brcond(int, char *, long);
-void otrap(int, char *, long);
-void obit(int, char *, long);
-void bitman(int, char *, long);
-void immem(int, char *, long);
-void nimmem(int, char *, long);
-void lognim(int, char *, long);
-void onimmed(int, char *, long);
+void obranch(int, const char *, long);
+void brcond(int, const char *, long);
+void otrap(int, const char *, long);
+void obit(int, const char *, long);
+void bitman(int, const char *, long);
+void immem(int, const char *, long);
+void nimmem(int, const char *, long);
+void lognim(int, const char *, long);
+void onimmed(int, const char *, long);
/* Handlers immediate integer arithmetic instructions */
void
-oimmed(int inst, char *opcode, long iadr)
+oimmed(int inst, const char *opcode, long iadr)
{
int Linst = inst & 0177777;
int Hinst = inst >> 16;
@@ -189,7 +195,7 @@ oimmed(int inst, char *opcode, long iadr)
/* Handles instructions dealing with control registers */
void
-ctrlregs(int inst, char *opcode, long iadr)
+ctrlregs(int inst, const char *opcode, long iadr)
{
int L6inst = (inst >> 11) & 037;
int creg = (inst >> 5) & 077;
@@ -221,7 +227,7 @@ printsod(int t)
/* Handles floating point instructions */
void
-sindou(int inst, char *opcode, long iadr)
+sindou(int inst, const char *opcode, long iadr)
{
int rs2 = inst & 037;
int td = ( inst >> 5 ) & 03;
@@ -248,7 +254,7 @@ sindou(int inst, char *opcode, long iadr)
void
-jump(int inst, char *opcode, long iadr)
+jump(int inst, const char *opcode, long iadr)
{
int rs2 = inst & 037;
int Nbit = ( inst >> 10 ) & 01;
@@ -264,7 +270,7 @@ jump(int inst, char *opcode, long iadr)
/* Handles ff1, ff0, tbnd and rte instructions */
void
-instset(int inst, char *opcode, long iadr)
+instset(int inst, const char *opcode, long iadr)
{
int rs2 = inst & 037;
int rs1 = ( inst >> 16 ) & 037;
@@ -298,7 +304,7 @@ symofset(int disp, int bit, int iadr)
}
void
-obranch(int inst, char *opcode, long iadr)
+obranch(int inst, const char *opcode, long iadr)
{
int cond = ( inst >> 26 ) & 01;
int disp = inst &0377777777;
@@ -315,7 +321,7 @@ obranch(int inst, char *opcode, long iadr)
/* Handles branch on conditions instructions */
void
-brcond(int inst, char *opcode, long iadr)
+brcond(int inst, const char *opcode, long iadr)
{
int cond = ( inst >> 26 ) & 1;
int match = ( inst >> 21 ) & 037;
@@ -347,7 +353,7 @@ brcond(int inst, char *opcode, long iadr)
void
-otrap(int inst, char *opcode, long iadr)
+otrap(int inst, const char *opcode, long iadr)
{
int vecno = inst & 0777;
int match = ( inst >> 21 ) & 037;
@@ -375,7 +381,7 @@ otrap(int inst, char *opcode, long iadr)
/* Handles 10 bit immediate bit field operations */
void
-obit(int inst, char *opcode, long iadr)
+obit(int inst, const char *opcode, long iadr)
{
int rs = ( inst >> 16 ) & 037;
int rd = ( inst >> 21 ) & 037;
@@ -398,7 +404,7 @@ obit(int inst, char *opcode, long iadr)
/* Handles triadic mode bit field instructions */
void
-bitman(int inst, char *opcode, long iadr)
+bitman(int inst, const char *opcode, long iadr)
{
int rs1 = ( inst >> 16 ) & 037;
@@ -411,7 +417,7 @@ bitman(int inst, char *opcode, long iadr)
/* Handles immediate load/store/exchange instructions */
void
-immem(int inst, char *opcode, long iadr)
+immem(int inst, const char *opcode, long iadr)
{
int immed = inst & 0xFFFF;
int rd = (inst >> 21) & 037;
@@ -441,7 +447,7 @@ immem(int inst, char *opcode, long iadr)
/* Handles triadic mode load/store/exchange instructions */
void
-nimmem(int inst, char *opcode, long iadr)
+nimmem(int inst, const char *opcode, long iadr)
{
int scaled = (inst >> 9) & 01;
int rd = (inst >> 21) & 037;
@@ -499,7 +505,7 @@ nimmem(int inst, char *opcode, long iadr)
/* Handles triadic mode logical instructions */
void
-lognim(int inst, char *opcode, long iadr)
+lognim(int inst, const char *opcode, long iadr)
{
int rd = (inst >> 21) & 037;
int rs1 = (inst >> 16) & 037;
@@ -516,7 +522,7 @@ lognim(int inst, char *opcode, long iadr)
/* Handles triadic mode arithmetic instructions */
void
-onimmed(int inst, char *opcode, long iadr)
+onimmed(int inst, const char *opcode, long iadr)
{
int rd = (inst >> 21) & 037;
int rs1 = (inst >> 16) & 037;
@@ -549,16 +555,16 @@ onimmed(int inst, char *opcode, long iadr)
tab, rd, rs1, rs2);
}
-static struct opdesc {
+static const struct opdesc {
unsigned mask, match;
- void (*opfun)(int, char *, long);
- char *farg;
+ void (*opfun)(int, const char *, long);
+ const char *farg;
} opdecode[] = {
/* ORDER IS IMPORTANT BELOW */
- { 0xF0000000U, 0x00000000U, immem, 0,},
- { 0xF0000000U, 0x10000000U, immem, 0,},
+ { 0xF0000000U, 0x00000000U, immem, NULL},
+ { 0xF0000000U, 0x10000000U, immem, NULL},
{ 0xF0000000U, 0x20000000U, immem, "st"},
{ 0xF0000000U, 0x30000000U, immem, "lda"},
@@ -610,10 +616,10 @@ static struct opdesc {
{ 0xFC00FE00U, 0xF000D800U, otrap, "tb1"},
{ 0xFC00FE00U, 0xF000E800U, otrap, "tcnd"},
- { 0xFC00F2E0U, 0xF4000000U, nimmem, 0,},
- { 0xFC00F2E0U, 0xF4000200U, nimmem, 0,},
- { 0xFC00F2E0U, 0xF4001000U, nimmem, 0,},
- { 0xFC00F2E0U, 0xF4001200U, nimmem, 0,},
+ { 0xFC00F2E0U, 0xF4000000U, nimmem, NULL},
+ { 0xFC00F2E0U, 0xF4000200U, nimmem, NULL},
+ { 0xFC00F2E0U, 0xF4001000U, nimmem, NULL},
+ { 0xFC00F2E0U, 0xF4001200U, nimmem, NULL},
{ 0xFC00F2E0U, 0xF4002000U, nimmem, "st"},
{ 0xFC00F2E0U, 0xF4002200U, nimmem, "st"},
{ 0xFC00F2E0U, 0xF4003000U, nimmem, "lda"},
@@ -647,15 +653,15 @@ static struct opdesc {
{ 0xFC00FFE0U, 0xF400F800U, instset, "tbnd"},
{ 0xFC00FFE0U, 0xF400FC00U, instset, "rte"},
{ 0xFC000000U, 0xF8000000U, instset, "tbnd"},
- { 0,0,0,0}
+ { 0, 0, NULL, NULL}
};
-static char *badop = "\t???";
+static const char *badop = "\t???";
int
m88k_print_instruction(unsigned iadr, long inst)
{
- struct opdesc *p;
+ const struct opdesc *p;
/* this messes up "orb" instructions ever so slightly, */
/* but keeps us in sync between routines... */
diff --git a/sys/arch/mvme88k/ddb/db_interface.c b/sys/arch/mvme88k/ddb/db_interface.c
index 64e20996811..29e17e31e45 100644
--- a/sys/arch/mvme88k/ddb/db_interface.c
+++ b/sys/arch/mvme88k/ddb/db_interface.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_interface.c,v 1.35 2004/01/07 16:22:17 miod Exp $ */
+/* $OpenBSD: db_interface.c,v 1.36 2004/01/07 17:52:30 miod Exp $ */
/*
* Mach Operating System
* Copyright (c) 1993-1991 Carnegie Mellon University
@@ -64,8 +64,6 @@ int ddb_nmi_trap(int, db_regs_t *);
void ddb_error_trap(char *, db_regs_t *);
void db_putc(int);
int db_getc(void);
-void cpu_interrupt_to_db(int);
-char *db_task_name(void);
int m88k_dmx_print(unsigned, unsigned, unsigned, unsigned);
void m88k_db_pause(unsigned);
void m88k_db_print_frame(db_expr_t, int, db_expr_t, char *);
@@ -90,7 +88,7 @@ db_regs_t ddb_regs;
* If you really feel like understanding the following procedure and
* macros, see pages 6-22 to 6-30 (Section 6.7.3) of
*
- * MC881000 RISC Microprocessor User's Manual Second Edition
+ * MC88100 RISC Microprocessor User's Manual Second Edition
* (Motorola Order: MC88100UM/AD REV 1)
*
* and ERRATA-5 (6-23, 6-24, 6-24) of
@@ -101,6 +99,7 @@ db_regs_t ddb_regs;
*
*/
+#ifdef M88100
/* macros for decoding dmt registers */
/*
@@ -110,21 +109,21 @@ int
m88k_dmx_print(t, d, a, no)
unsigned t, d, a, no;
{
- static unsigned addr_mod[16] = {
+ static const unsigned addr_mod[16] = {
0, 3, 2, 2, 1, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0
};
- static char *mode[16] = {
+ static const char *mode[16] = {
"?", ".b", ".b", ".h", ".b", "?", "?", "?",
".b", "?", "?" , "?" , ".h" , "?", "?", ""
};
- static unsigned mask[16] = {
+ static const unsigned mask[16] = {
0, 0xff, 0xff00, 0xffff,
0xff0000, 0, 0, 0,
0xff000000, 0, 0, 0,
0xffff0000, 0, 0, 0xffffffff
};
- static unsigned shift[16] = {
+ static const unsigned shift[16] = {
0, 0, 8, 0, 16, 0, 0, 0,
24, 0, 0, 0, 16, 0, 0, 0
};
@@ -170,6 +169,7 @@ m88k_dmx_print(t, d, a, no)
}
return 0;
}
+#endif /* M88100 */
void
m88k_db_print_frame(addr, have_addr, count, modif)
@@ -294,6 +294,7 @@ m88k_db_print_frame(addr, have_addr, count, modif)
return;
}
+#ifdef M88100
if (cputyp != CPU_88110) {
if (s->vector == /*data*/3 || s->dmt0 & DMT_VALID) {
db_printf("dmt,d,a0: 0x%08x 0x%08x 0x%08x ",
@@ -335,16 +336,19 @@ m88k_db_print_frame(addr, have_addr, count, modif)
(s->dpfsr >> 16) & 0x07, s->dpfsr);
}
}
+#endif /* M88100 */
if (s->fpecr & 255) { /* floating point error occurred */
db_printf("fpecr: 0x%08x fpsr: 0x%08x fpcr: 0x%08x\n",
s->fpecr, s->fpsr, s->fpcr);
+#ifdef M88100
if (cputyp != CPU_88110) {
db_printf("fcr1-4: 0x%08x 0x%08x 0x%08x 0x%08x\n",
s->fphs1, s->fpls1, s->fphs2, s->fpls2);
db_printf("fcr5-8: 0x%08x 0x%08x 0x%08x 0x%08x\n",
s->fppt, s->fprh, s->fprl, s->fpit);
}
+#endif
}
db_printf("\n");
}
@@ -799,11 +803,6 @@ m88k_db_cmmucfg(addr, have_addr, count, modif)
cmmu_dump_config();
}
-void cpu_interrupt_to_db(cpu_no)
- int cpu_no;
-{
-}
-
void
m88k_db_prom_cmd(addr, have_addr, count, modif)
db_expr_t addr;
@@ -818,88 +817,28 @@ m88k_db_prom_cmd(addr, have_addr, count, modif)
/* COMMAND TABLE / INIT */
/************************/
-struct db_command m88k_cache_cmds[] =
-{
- { "iflush", m88k_db_iflush, 0, 0},
- { "dflush", m88k_db_dflush, 0, 0},
- { "peek", m88k_db_peek, 0, 0},
- { (char *) 0,}
+struct db_command m88k_cache_cmds[] = {
+ { "iflush", m88k_db_iflush, 0, NULL },
+ { "dflush", m88k_db_dflush, 0, NULL },
+ { "peek", m88k_db_peek, 0, NULL },
+ { NULL, NULL, 0, NULL }
};
-struct db_command db_machine_cmds[] =
-{
- {"cache", 0, 0, m88k_cache_cmds},
- {"frame", m88k_db_print_frame, 0, 0},
- {"regs", m88k_db_registers, 0, 0},
- {"noise", m88k_db_noise, 0, 0},
- {"searchframe", m88k_db_frame_search, 0, 0},
- {"translate", m88k_db_translate, 0, 0},
- {"cmmucfg", m88k_db_cmmucfg, 0, 0},
- {"where", m88k_db_where, 0, 0},
- {"prom", m88k_db_prom_cmd, 0, 0},
- {(char *) 0,}
+struct db_command db_machine_cmds[] = {
+ { "cache", NULL, 0, m88k_cache_cmds },
+ { "frame", m88k_db_print_frame, 0, NULL },
+ { "regs", m88k_db_registers, 0, NULL },
+ { "noise", m88k_db_noise, 0, NULL },
+ { "searchframe",m88k_db_frame_search, 0, NULL },
+ { "translate", m88k_db_translate, 0, NULL },
+ { "cmmucfg", m88k_db_cmmucfg, 0, NULL },
+ { "where", m88k_db_where, 0, NULL },
+ { "prom", m88k_db_prom_cmd, 0, NULL },
+ { NULL, NULL, 0, NULL }
};
-/*
- * Called from "m88k/m1x7_init.c"
- */
void
db_machine_init()
{
db_machine_commands_install(db_machine_cmds);
}
-
-/*
- * Attempt to figure out the UX name of the task.
- * This is kludgy at best... we can't even be sure the task is a UX task...
- */
-#define TOP_OF_USER_STACK USRSTACK
-#define MAX_DISTANCE_TO_LOOK (1024 * 10)
-
-#define DB_TASK_NAME_LEN 50
-
-char *
-db_task_name()
-{
- static unsigned buffer[(DB_TASK_NAME_LEN + 5) / sizeof(unsigned)];
- vaddr_t ptr = (vaddr_t)(TOP_OF_USER_STACK - 4);
- vaddr_t limit = ptr - MAX_DISTANCE_TO_LOOK;
- unsigned word;
- int i;
-
- /* skip zeros at the end */
- while (ptr > limit &&
- (i = db_trace_get_val(ptr, &word)) && (word == 0)) {
- ptr -= 4; /* continue looking for a non-null word */
- }
-
- if (ptr <= limit) {
- db_printf("bad name at line %d\n", __LINE__);
- return "<couldn't find 1>";
- } else if (i != 1) {
- return "<nostack>";
- }
-
- /* skip looking for null before all the text */
- while (ptr > limit &&
- (i = db_trace_get_val(ptr, &word)) && (word != 0)) {
- ptr -= 4; /* continue looking for a null word */
- }
-
- if (ptr <= limit) {
- db_printf("bad name at line %d\n", __LINE__);
- return "<couldn't find 2>";
- } else if (i != 1) {
- db_printf("bad name read of %lx at line %d\n", ptr, __LINE__);
- return "<bad read 2>";
- }
-
- ptr += 4; /* go back to the non-null word after this one */
-
- for (i = 0; i < sizeof(buffer); i++, ptr += 4) {
- buffer[i] = 0; /* just in case it's not read */
- db_trace_get_val(ptr, &buffer[i]);
- }
- return (char *)buffer;
-}
-
diff --git a/sys/arch/mvme88k/ddb/db_sstep.c b/sys/arch/mvme88k/ddb/db_sstep.c
index 5b1563ffb3d..e281eebe6b5 100644
--- a/sys/arch/mvme88k/ddb/db_sstep.c
+++ b/sys/arch/mvme88k/ddb/db_sstep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_sstep.c,v 1.13 2003/12/21 13:23:32 miod Exp $ */
+/* $OpenBSD: db_sstep.c,v 1.14 2004/01/07 17:52:30 miod Exp $ */
/*
* Mach Operating System
* Copyright (c) 1993-1991 Carnegie Mellon University
@@ -28,7 +28,9 @@
#include <sys/param.h>
#include <sys/systm.h>
+
#include <machine/db_machdep.h>
+
#include <ddb/db_access.h> /* db_get_value() */
#include <ddb/db_break.h> /* db_breakpoint_t */
diff --git a/sys/arch/mvme88k/ddb/db_trace.c b/sys/arch/mvme88k/ddb/db_trace.c
index d70d5c31cb1..e62dbc6172b 100644
--- a/sys/arch/mvme88k/ddb/db_trace.c
+++ b/sys/arch/mvme88k/ddb/db_trace.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_trace.c,v 1.22 2004/01/07 16:22:17 miod Exp $ */
+/* $OpenBSD: db_trace.c,v 1.23 2004/01/07 17:52:30 miod Exp $ */
/*
* Mach Operating System
* Copyright (c) 1993-1991 Carnegie Mellon University
@@ -116,7 +116,7 @@ unsigned db_trace_get_val(vaddr_t addr, unsigned *ptr);
/* st r1, r31, IMM */
#define ST_R1_R31_IMM(I) (((I) & 0xffff0000U) == 0x243f0000U)
-static int trace_flags = 0;
+static int trace_flags;
#define TRACE_DEBUG_FLAG 0x01
#define TRACE_SHOWCALLPRESERVED_FLAG 0x02
#define TRACE_SHOWADDRESS_FLAG 0x04
@@ -201,7 +201,7 @@ struct db_variable *db_eregs = db_regs + sizeof(db_regs)/sizeof(db_regs[0]);
static unsigned
m88k_instruction_info(unsigned instruction)
{
- static struct {
+ static const struct {
unsigned mask, value, flags;
} *ptr, control[] = {
/* runs in the same order as 2nd Ed 88100 manual Table 3-14 */
@@ -1144,4 +1144,3 @@ db_stack_trace_print(db_expr_t addr,
}
db_stack_trace_cmd2(regs, pr);
}
-