Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/amd64/amd64 If the kernel jumps to NULL, print wher...
details: https://anonhg.NetBSD.org/src/rev/d96f944e2b06
branches: trunk
changeset: 341907:d96f944e2b06
user: dholland <dholland%NetBSD.org@localhost>
date: Sat Nov 28 15:06:55 2015 +0000
description:
If the kernel jumps to NULL, print where it came from instead of trying
to dereference and faulting again.
diffstat:
sys/arch/amd64/amd64/trap.c | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diffs (35 lines):
diff -r 0f14005335db -r d96f944e2b06 sys/arch/amd64/amd64/trap.c
--- a/sys/arch/amd64/amd64/trap.c Sat Nov 28 14:45:24 2015 +0000
+++ b/sys/arch/amd64/amd64/trap.c Sat Nov 28 15:06:55 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.81 2015/11/22 13:41:24 maxv Exp $ */
+/* $NetBSD: trap.c,v 1.82 2015/11/28 15:06:55 dholland Exp $ */
/*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.81 2015/11/22 13:41:24 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.82 2015/11/28 15:06:55 dholland Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@@ -342,6 +342,16 @@
/* Get %rsp value before fault - there may be a pad word
* below the trap frame. */
vframe = (void *)frame->tf_rsp;
+ if (frame->tf_rip == 0) {
+ /*
+ * Assume that if we jumped to null we
+ * probably did it via a null function
+ * pointer, so print the return address.
+ */
+ printf("kernel jumped to null; return addr was %p\n",
+ *(void **)frame->tf_rsp);
+ goto we_re_toast;
+ }
switch (*(uint16_t *)frame->tf_rip) {
case 0xcf48: /* iretq */
/*
Home |
Main Index |
Thread Index |
Old Index