On a kernel segfault, print the registers from the trapframe.

This commit is contained in:
matt 2012-02-02 14:30:48 +00:00
parent 939c43e3d8
commit f24871cb06

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.128 2011/07/03 02:18:21 matt Exp $ */
/* $NetBSD: trap.c,v 1.129 2012/02/02 14:30:48 matt Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@ -33,7 +33,7 @@
/* All bugs are subject to removal without further notice */
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.128 2011/07/03 02:18:21 matt Exp $");
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.129 2012/02/02 14:30:48 matt Exp $");
#include "opt_ddb.h"
#include "opt_multiprocessor.h"
@ -238,7 +238,17 @@ if(faultdebug)printf("trap accflt type %lx, code %lx, pc %lx, psl %lx\n",
tf->tf_r0 = rv;
return;
}
panic("Segv in kernel mode: pc %#lx addr %#lx",
printf("r0=%08lx r1=%08lx r2=%08lx r3=%08lx ",
tf->tf_r0, tf->tf_r1, tf->tf_r2, tf->tf_r3);
printf("r4=%08lx r5=%08lx r6=%08lx r7=%08lx\n",
tf->tf_r4, tf->tf_r5, tf->tf_r6, tf->tf_r7);
printf(
"r8=%08lx r9=%08lx r10=%08lx r11=%08lx\n",
tf->tf_r8, tf->tf_r9, tf->tf_r10,
tf->tf_r11);
printf("ap=%08lx fp=%08lx sp=%08lx pc=%08lx\n",
tf->tf_ap, tf->tf_fp, tf->tf_sp, tf->tf_pc);
panic("SEGV in kernel mode: pc %#lx addr %#lx",
tf->tf_pc, tf->tf_code);
}
code = SEGV_ACCERR;