Make db_validate_address() work, even when called from within an interrupt

handler.  This should make debugging prefetch aborts slightly simpler.
This commit is contained in:
bjh21 2006-09-27 21:21:09 +00:00
parent b1906bf12d
commit 826ff5f060
3 changed files with 26 additions and 17 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: db_interface.c,v 1.9 2006/04/06 17:29:49 he Exp $ */
/* $NetBSD: db_interface.c,v 1.10 2006/09/27 21:21:09 bjh21 Exp $ */
/*
* Copyright (c) 1996 Scott K. Stevens
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.9 2006/04/06 17:29:49 he Exp $");
__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.10 2006/09/27 21:21:09 bjh21 Exp $");
#include "opt_ddb.h"
@ -169,14 +169,20 @@ kdb_trap(type, regs)
return (1);
}
volatile boolean_t db_validating, db_faulted;
int
db_validate_address(addr)
vm_offset_t addr;
{
volatile uint8_t tmp;
/* FIXME */
return 0;
db_faulted = FALSE;
db_validating = TRUE;
asm("" : : : "r14"); /* Make sure R14 is saved over the page fault */
tmp = *(uint8_t *)addr;
db_validating = FALSE;
return db_faulted;
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: except.c,v 1.15 2006/09/24 23:38:59 bjh21 Exp $ */
/* $NetBSD: except.c,v 1.16 2006/09/27 21:21:09 bjh21 Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000 Ben Harris
* All rights reserved.
@ -31,7 +31,7 @@
#include <sys/param.h>
__KERNEL_RCSID(0, "$NetBSD: except.c,v 1.15 2006/09/24 23:38:59 bjh21 Exp $");
__KERNEL_RCSID(0, "$NetBSD: except.c,v 1.16 2006/09/27 21:21:09 bjh21 Exp $");
#include "opt_ddb.h"
@ -204,16 +204,11 @@ do_fault(struct trapframe *tf, struct lwp *l,
if (pmap_fault(map->pmap, va, atype))
return;
#ifdef DDB
if (current_intr_depth != 0) {
db_printf("Data abort in interrupt handler\n");
kdb_trap(T_FAULT, tf);
}
#else
KASSERT(current_intr_depth == 0);
#endif
error = uvm_fault(map, va, atype);
KASSERT((tf->tf_r15 & R15_MODE) != R15_MODE_USR);
error = EFAULT;
} else
error = uvm_fault(map, va, atype);
if (error != 0) {
ksiginfo_t ksi;
@ -225,7 +220,13 @@ do_fault(struct trapframe *tf, struct lwp *l,
(register_t)cur_pcb->pcb_onfault;
return;
}
#ifdef DDB
if (db_validating) {
db_faulted = TRUE;
tf->tf_r15 += INSN_SIZE;
return;
}
#endif
if ((tf->tf_r15 & R15_MODE) != R15_MODE_USR) {
#ifdef DDB
db_printf("Unhandled data abort in kernel mode\n");

View File

@ -1,4 +1,4 @@
/* $NetBSD: db_machdep.h,v 1.3 2005/12/11 12:16:04 christos Exp $ */
/* $NetBSD: db_machdep.h,v 1.4 2006/09/27 21:21:09 bjh21 Exp $ */
#include <arm/db_machdep.h>
@ -11,3 +11,5 @@ void db_show_panic_cmd __P((db_expr_t, int, db_expr_t, const char *));
void db_show_frame_cmd __P((db_expr_t, int, db_expr_t, const char *));
void db_bus_write_cmd __P((db_expr_t, int, db_expr_t, const char *));
void db_irqstat_cmd __P((db_expr_t, int, db_expr_t, const char *));
extern volatile boolean_t db_validating, db_faulted;