summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/mvme88k/ddb/db_interface.c91
-rw-r--r--sys/arch/mvme88k/ddb/db_trace.c33
-rw-r--r--sys/arch/mvme88k/include/db_machdep.h16
3 files changed, 65 insertions, 75 deletions
diff --git a/sys/arch/mvme88k/ddb/db_interface.c b/sys/arch/mvme88k/ddb/db_interface.c
index ad2c75e906c..12e146b89c5 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.28 2003/10/03 21:46:24 miod Exp $ */
+/* $OpenBSD: db_interface.c,v 1.29 2003/10/05 20:23:52 miod Exp $ */
/*
* Mach Operating System
* Copyright (c) 1993-1991 Carnegie Mellon University
@@ -42,10 +42,11 @@
#include <machine/trap.h> /* current_thread() */
#include <machine/db_machdep.h> /* local ddb stuff */
#include <machine/bugio.h> /* bug routines */
-#include <machine/locore.h>
+#include <machine/locore.h>
#include <machine/cpu_number.h>
#include <machine/m88100.h>
+#include <ddb/db_access.h>
#include <ddb/db_command.h>
#include <ddb/db_extern.h>
#include <ddb/db_interface.h>
@@ -54,19 +55,17 @@
extern label_t *db_recover;
extern unsigned int db_maxoff;
-extern unsigned db_trace_get_val(vm_offset_t addr, unsigned *ptr);
+extern unsigned db_trace_get_val(vaddr_t, unsigned *);
extern int frame_is_sane(db_regs_t *);
extern void cnpollc(int);
-void kdbprinttrap(int type, int code);
-
-void m88k_db_trap(int type, struct m88100_saved_state *regs);
-int ddb_nmi_trap(int level, db_regs_t *eframe);
-void ddb_error_trap(char *error, db_regs_t *eframe);
-void db_read_bytes(vm_offset_t addr, int size, char *data);
-void db_write_bytes(char *addr, int size, char *data);
-void db_putc(int c);
+void kdbprinttrap(int, int);
+
+void m88k_db_trap(int, struct m88100_saved_state *);
+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 cpu_no);
+void cpu_interrupt_to_db(int);
char *db_task_name(void);
int m88k_dmx_print(unsigned, unsigned, unsigned, unsigned);
void m88k_db_pause(unsigned);
@@ -213,8 +212,8 @@ m88k_db_print_frame(addr, have_addr, count, modif)
return;
}
- if (badwordaddr((vm_offset_t)s) ||
- badwordaddr((vm_offset_t)(&((db_regs_t*)s)->mode))) {
+ if (badwordaddr((vaddr_t)s) ||
+ badwordaddr((vaddr_t)(&((db_regs_t*)s)->mode))) {
db_printf("frame at 0x%08x is unreadable\n", s);
return;
}
@@ -379,7 +378,7 @@ m88k_db_pause(ticks)
void
m88k_db_trap(type, regs)
int type;
- register struct m88100_saved_state *regs;
+ struct m88100_saved_state *regs;
{
#if 0
int i;
@@ -392,7 +391,7 @@ m88k_db_trap(type, regs)
db_printf("WARNING: entered debugger with interrupts disabled\n");
switch(type) {
-
+
case T_KDB_BREAK:
case T_KDB_TRACE:
case T_KDB_ENTRY:
@@ -406,9 +405,9 @@ m88k_db_trap(type, regs)
/*NOTREACHED*/
}
}
-
+
ddb_regs = *regs;
-
+
db_active++;
cnpollc(TRUE);
db_trap(type, 0);
@@ -431,14 +430,14 @@ extern int trap_types;
void
kdbprinttrap(type, code)
int type, code;
-{
+{
printf("kernel: ");
if (type >= trap_types || type < 0)
- printf("type %d", type);
- else
+ printf("type %d", type);
+ else
printf("%s", trap_type[type]);
printf(" trap\n");
-}
+}
void
Debugger()
@@ -478,7 +477,7 @@ ddb_break_trap(type, eframe)
if (type == T_KDB_BREAK) {
/*
* back up an instruction and retry the instruction
- * at the breakpoint address. mc88110's exip reg
+ * at the breakpoint address. mc88110's exip reg
* already has the adress of the exception instruction.
*/
if (cputyp != CPU_88110) {
@@ -523,12 +522,9 @@ ddb_error_trap(error, eframe)
* Read bytes from kernel address space for debugger.
*/
void
-db_read_bytes(addr, size, data)
- vm_offset_t addr;
- register int size;
- register char *data;
+db_read_bytes(db_addr_t addr, size_t size, char *data)
{
- register char *src;
+ char *src;
src = (char *)addr;
@@ -544,25 +540,20 @@ db_read_bytes(addr, size, data)
* write access in pmap_bootstrap()). XXX nivas
*/
void
-db_write_bytes(addr, size, data)
- char *addr;
- int size;
- char *data;
+db_write_bytes(db_addr_t addr, size_t size, char *data)
{
- register char *dst;
- vm_offset_t physaddr;
- int i = size;
+ char *dst;
+ paddr_t physaddr;
+ psize_t psize = size;
dst = (char *)addr;
-
+
while (--size >= 0) {
-#if 0
- db_printf("byte %x\n", *data);
-#endif
- *dst++ = *data++;
+ *dst++ = *data++;
}
- pmap_extract(pmap_kernel(), (vm_offset_t)addr, &physaddr);
- cmmu_flush_cache(physaddr, i);
+ /* XXX test return value */
+ pmap_extract(pmap_kernel(), (vaddr_t)addr, &physaddr);
+ cmmu_flush_cache(physaddr, psize);
}
/* to print a character to the console */
@@ -655,7 +646,7 @@ m88k_db_iflush(addr, have_addr, count, modif)
addr = 0;
#ifdef may_be_removed
cmmu_remote_set(addr, CMMU_SCR, 0, CMMU_FLUSH_CACHE_CBI_ALL);
-#endif
+#endif
}
/* flush dcache */
@@ -670,7 +661,7 @@ m88k_db_dflush(addr, have_addr, count, modif)
addr = 0;
#ifdef may_be_removed
cmmu_remote_set(addr, CMMU_SCR, 1, CMMU_FLUSH_CACHE_CBI_ALL);
-#endif
+#endif
}
/* probe my cache */
@@ -708,7 +699,7 @@ m88k_db_peek(addr, have_addr, count, modif)
(unsigned)cmmu_remote_get(0, CMMU_CTP1, 0),
(unsigned)cmmu_remote_get(0, CMMU_CTP2, 0),
(unsigned)cmmu_remote_get(0, CMMU_CTP3, 0));
-#endif
+#endif
}
@@ -766,7 +757,7 @@ m88k_db_translate(addr, have_addr, count, modif)
while (c = *modif++, c != 0) {
switch (c) {
default:
- db_printf("bad modifier [%c]\n", c);
+ db_printf("bad modifier [%c]\n", c);
wanthelp = 1;
break;
case 'h':
@@ -873,14 +864,14 @@ char *
db_task_name()
{
static unsigned buffer[(DB_TASK_NAME_LEN + 5) / sizeof(unsigned)];
- unsigned ptr = (vm_offset_t)(TOP_OF_USER_STACK - 4);
- unsigned limit = ptr - MAX_DISTANCE_TO_LOOK;
+ 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((vm_offset_t)ptr, &word)) && (word == 0)) {
+ (i = db_trace_get_val(ptr, &word)) && (word == 0)) {
ptr -= 4; /* continue looking for a non-null word */
}
@@ -909,7 +900,7 @@ db_task_name()
for (i = 0; i < sizeof(buffer); i++, ptr += 4) {
buffer[i] = 0; /* just in case it's not read */
- db_trace_get_val((vm_offset_t)ptr, &buffer[i]);
+ db_trace_get_val(ptr, &buffer[i]);
}
return (char *)buffer;
}
diff --git a/sys/arch/mvme88k/ddb/db_trace.c b/sys/arch/mvme88k/ddb/db_trace.c
index d865ea7ec23..04769ed11ac 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.18 2003/08/06 21:08:06 millert Exp $ */
+/* $OpenBSD: db_trace.c,v 1.19 2003/10/05 20:23:52 miod Exp $ */
/*
* Mach Operating System
* Copyright (c) 1993-1991 Carnegie Mellon University
@@ -36,6 +36,7 @@
#include <ddb/db_output.h> /* db_printf */
#include <ddb/db_sym.h> /* DB_STGY_PROC, etc. */
#include <ddb/db_command.h> /* db_recover */
+#include <ddb/db_access.h>
union instruction {
unsigned rawbits;
@@ -95,10 +96,9 @@ static inline unsigned br_dest(unsigned addr, union instruction inst)
#define TRACE_DEBUG /* undefine to disable debugging */
-extern void db_read_bytes(vm_offset_t addr, int size, char *data);
int frame_is_sane(db_regs_t *regs);
char *m88k_exception_name(unsigned vector);
-unsigned db_trace_get_val(vm_offset_t addr, unsigned *ptr);
+unsigned db_trace_get_val(vaddr_t addr, unsigned *ptr);
void db_stack_trace_print(db_regs_t *addr, int have_addr,
db_expr_t count, char *modif, int (*pr)(const char *, ...));
@@ -150,7 +150,7 @@ db_setf_regs(struct db_variable *vp,
db_expr_t *valuep,
int op) /* read/write */
{
- register int *regp = (int *) ((char *) DDB_REGS + (int) (vp->valuep));
+ int *regp = (int *) ((char *) DDB_REGS + (int) (vp->valuep));
if (op == DB_VAR_GET)
*valuep = *regp;
@@ -251,7 +251,7 @@ hex_value_needs_0x(unsigned value)
{
int i;
unsigned last = 0;
- unsigned char c;
+ unsigned char c;
unsigned have_a_hex_digit = 0;
if (value <= 9)
@@ -283,7 +283,7 @@ int
frame_is_sane(db_regs_t *regs)
{
/* no good if we can't read the whole frame */
- if (badwordaddr((vm_offset_t)regs) || badwordaddr((vm_offset_t)&regs->mode)) {
+ if (badwordaddr((vaddr_t)regs) || badwordaddr((vaddr_t)&regs->mode)) {
db_printf("[WARNING: frame at 0x%x : unreadable]\n", regs);
return 0;
}
@@ -368,7 +368,7 @@ m88k_exception_name(unsigned vector)
* Return 1 if was able to read, 0 otherwise.
*/
unsigned
-db_trace_get_val(vm_offset_t addr, unsigned *ptr)
+db_trace_get_val(vaddr_t addr, unsigned *ptr)
{
label_t db_jmpbuf;
label_t *prev = db_recover;
@@ -452,7 +452,7 @@ print_args(void)
db_printf("?");
else {
unsigned value = saved_reg_value(reg);
- db_printf("%s%x", hex_value_needs_0x(value) ?
+ db_printf("%s%x", hex_value_needs_0x(value) ?
"0x" : "", value);
}
if (reg == last_arg)
@@ -493,7 +493,7 @@ static int
is_jump_source_ok(unsigned return_to, unsigned jump_to)
{
unsigned flags;
- union instruction instruction;
+ union instruction instruction;
/*
* Delayed branches are most common... look two instructions before
@@ -930,21 +930,20 @@ db_stack_trace_cmd2(db_regs_t *regs, int (*pr)(const char *, ...))
* Here we are just looking for kernel exception frames.
*/
- if (badwordaddr((vm_offset_t)stack) ||
- badwordaddr((vm_offset_t)(stack+4)))
+ if (badwordaddr((vaddr_t)stack) ||
+ badwordaddr((vaddr_t)(stack+4)))
break;
- db_read_bytes((vm_offset_t)stack, 2*sizeof(int), (char *)pair);
+ db_read_bytes((vaddr_t)stack, 2*sizeof(int), (char *)pair);
/* the pairs should match and equal stack+8 */
if (pair[0] == pair[1]) {
if (pair[0] != stack+8) {
/*
- if (!badwordaddr((vm_offset_t)pair[0]) && (pair[0]!=0))
+ if (!badwordaddr((vaddr_t)pair[0]) && (pair[0]!=0))
(*pr)("stack_trace:found pair 0x%x but != to stack+8\n",
pair[0]);
*/
-
}
else if (frame_is_sane((db_regs_t*)pair[0])) {
@@ -980,11 +979,11 @@ db_stack_trace_cmd2(db_regs_t *regs, int (*pr)(const char *, ...))
stack = stack & ~(KERNEL_STACK_SIZE-1); /* point to the bottom */
stack += KERNEL_STACK_SIZE - 8;
- if (badwordaddr((vm_offset_t)stack) ||
- badwordaddr((vm_offset_t)stack))
+ if (badwordaddr((vaddr_t)stack) ||
+ badwordaddr((vaddr_t)stack))
return;
- db_read_bytes((vm_offset_t)stack, 2*sizeof(int), (char *)pair);
+ db_read_bytes((vaddr_t)stack, 2*sizeof(int), (char *)pair);
if (pair[0] != pair[1])
return;
diff --git a/sys/arch/mvme88k/include/db_machdep.h b/sys/arch/mvme88k/include/db_machdep.h
index 166b726a6b7..fe2b8935b0c 100644
--- a/sys/arch/mvme88k/include/db_machdep.h
+++ b/sys/arch/mvme88k/include/db_machdep.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_machdep.h,v 1.23 2003/09/26 19:04:28 miod Exp $ */
+/* $OpenBSD: db_machdep.h,v 1.24 2003/10/05 20:23:53 miod Exp $ */
/*
* Mach Operating System
* Copyright (c) 1993-1991 Carnegie Mellon University
@@ -69,9 +69,9 @@
#ifdef DDB
-/*
+/*
* This is a hack so that mc88100 can use software single step
- * and mc88110 can use the wonderful hardware single step
+ * and mc88110 can use the wonderful hardware single step
* feature. XXX smurph
*/
#define INTERNAL_SSTEP /* Use local Single Step routines */
@@ -83,8 +83,8 @@
/* Entry trap for the debugger - used for inline assembly breaks*/
#define ENTRY_ASM "tb0 0, r0, 132"
-typedef vm_offset_t db_addr_t;
-typedef int db_expr_t;
+typedef vaddr_t db_addr_t;
+typedef int db_expr_t;
typedef struct m88100_saved_state db_regs_t;
extern db_regs_t ddb_regs; /* register state */
#define DDB_REGS (&ddb_regs)
@@ -114,12 +114,12 @@ int ddb_entry_trap(int level, db_regs_t *eframe);
#ifdef INTERNAL_SSTEP
extern register_t getreg_val(db_regs_t *, int);
-void db_set_single_step(register db_regs_t *);
-void db_clear_single_step(register db_regs_t *);
+void db_set_single_step(db_regs_t *);
+void db_clear_single_step(db_regs_t *);
#else
/* need software single step */
#define SOFTWARE_SSTEP 1 /* we need this for mc88100 */
-#endif
+#endif
/*
* Debugger can get to any address space