summaryrefslogtreecommitdiffstats
path: root/sys/amd64/amd64/exception.S
diff options
context:
space:
mode:
authormarkj <markj@FreeBSD.org>2014-07-14 04:38:17 +0000
committermarkj <markj@FreeBSD.org>2014-07-14 04:38:17 +0000
commit880dd1a983b61825a671f8a16103eb480f6ce342 (patch)
treef6f00a8ecef69c372df2dbabbd94de9a70811897 /sys/amd64/amd64/exception.S
parent0b964c341a8548648d88f3097969b1e9b707da2e (diff)
downloadFreeBSD-src-880dd1a983b61825a671f8a16103eb480f6ce342.zip
FreeBSD-src-880dd1a983b61825a671f8a16103eb480f6ce342.tar.gz
Invoke the DTrace trap handler before calling trap() on amd64. This matches
the upstream implementation and helps ensure that a trap induced by tracing fbt::trap:entry is handled without recursively generating another trap. This makes it possible to run most (but not all) of the DTrace tests under common/safety/ without triggering a kernel panic. Submitted by: Anton Rang <anton.rang@isilon.com> (original version) Phabric: D95
Diffstat (limited to 'sys/amd64/amd64/exception.S')
-rw-r--r--sys/amd64/amd64/exception.S17
1 files changed, 17 insertions, 0 deletions
diff --git a/sys/amd64/amd64/exception.S b/sys/amd64/amd64/exception.S
index d51078d..bb5fd56 100644
--- a/sys/amd64/amd64/exception.S
+++ b/sys/amd64/amd64/exception.S
@@ -228,7 +228,24 @@ alltraps_pushregs_no_rdi:
.type calltrap,@function
calltrap:
movq %rsp,%rdi
+#ifdef KDTRACE_HOOKS
+ /*
+ * Give DTrace a chance to vet this trap and skip the call to trap() if
+ * it turns out that it was caused by a DTrace probe.
+ */
+ movq dtrace_trap_func,%rax
+ testq %rax,%rax
+ je skiphook
+ call *%rax
+ testq %rax,%rax
+ jne skiptrap
+ movq %rsp,%rdi
+skiphook:
+#endif
call trap
+#ifdef KDTRACE_HOOKS
+skiptrap:
+#endif
MEXITCOUNT
jmp doreti /* Handle any pending ASTs */
OpenPOWER on IntegriCloud