Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Revert my previous change. I hadn't checked careful...
details: https://anonhg.NetBSD.org/src/rev/f344474e685e
branches: trunk
changeset: 355867:f344474e685e
user: maxv <maxv%NetBSD.org@localhost>
date: Fri Aug 18 14:52:19 2017 +0000
description:
Revert my previous change. I hadn't checked carefully enough: the
symbols are used in src/external. There is a number of things that seem
wrong to me here, but I'm not changing them for now.
diffstat:
sys/arch/amd64/amd64/amd64_trap.S | 44 +++++++++++++++++++++++++++++++++++++-
sys/arch/i386/i386/i386_trap.S | 43 ++++++++++++++++++++++++++++++++++++-
sys/arch/i386/i386/vector.S | 21 ++++++++++++++++-
3 files changed, 102 insertions(+), 6 deletions(-)
diffs (175 lines):
diff -r 041783992860 -r f344474e685e sys/arch/amd64/amd64/amd64_trap.S
--- a/sys/arch/amd64/amd64/amd64_trap.S Fri Aug 18 10:28:53 2017 +0000
+++ b/sys/arch/amd64/amd64/amd64_trap.S Fri Aug 18 14:52:19 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: amd64_trap.S,v 1.6 2017/08/18 10:02:37 maxv Exp $ */
+/* $NetBSD: amd64_trap.S,v 1.7 2017/08/18 14:52:19 maxv Exp $ */
/*-
* Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
#if 0
#include <machine/asm.h>
-__KERNEL_RCSID(0, "$NetBSD: amd64_trap.S,v 1.6 2017/08/18 10:02:37 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amd64_trap.S,v 1.7 2017/08/18 14:52:19 maxv Exp $");
#endif
/*
@@ -154,7 +154,47 @@
IDTVEC_END(trap02)
IDTVEC(trap03)
+#ifndef KDTRACE_HOOKS
ZTRAP(T_BPTFLT)
+#else
+ ZTRAP_NJ(T_BPTFLT)
+ INTRENTRY
+ STI(si)
+ /*
+ * DTrace Function Boundary Trace (fbt) probes are triggered
+ * by int3 (0xcc).
+ */
+ /* Check if there is no DTrace hook registered. */
+ cmpq $0,dtrace_invop_jump_addr
+ je calltrap
+
+ /*
+ * Set our jump address for the jump back in the event that
+ * the exception wasn't caused by DTrace at all.
+ */
+ /* XXX: This doesn't look right for SMP - unless it is a
+ * constant - so why set it everytime. (dsl) */
+ movq $calltrap, dtrace_invop_calltrap_addr(%rip)
+
+ /* Jump to the code hooked in by DTrace. */
+ movq dtrace_invop_jump_addr, %rax
+ jmpq *dtrace_invop_jump_addr
+
+ .bss
+ .globl dtrace_invop_jump_addr
+ .align 8
+ .type dtrace_invop_jump_addr, @object
+ .size dtrace_invop_jump_addr, 8
+dtrace_invop_jump_addr:
+ .zero 8
+ .globl dtrace_invop_calltrap_addr
+ .align 8
+ .type dtrace_invop_calltrap_addr, @object
+ .size dtrace_invop_calltrap_addr, 8
+dtrace_invop_calltrap_addr:
+ .zero 8
+ .text
+#endif
IDTVEC_END(trap03)
IDTVEC(trap04)
diff -r 041783992860 -r f344474e685e sys/arch/i386/i386/i386_trap.S
--- a/sys/arch/i386/i386/i386_trap.S Fri Aug 18 10:28:53 2017 +0000
+++ b/sys/arch/i386/i386/i386_trap.S Fri Aug 18 14:52:19 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: i386_trap.S,v 1.10 2017/08/18 10:02:37 maxv Exp $ */
+/* $NetBSD: i386_trap.S,v 1.11 2017/08/18 14:52:19 maxv Exp $ */
/*
* Copyright 2002 (c) Wasabi Systems, Inc.
@@ -66,7 +66,7 @@
#if 0
#include <machine/asm.h>
-__KERNEL_RCSID(0, "$NetBSD: i386_trap.S,v 1.10 2017/08/18 10:02:37 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i386_trap.S,v 1.11 2017/08/18 14:52:19 maxv Exp $");
#endif
/*
@@ -132,9 +132,48 @@
ZTRAP(T_BOUND)
IDTVEC_END(trap05)
+/*
+ * Privileged instruction fault.
+ */
+#ifdef KDTRACE_HOOKS
+ SUPERALIGN_TEXT
+IDTVEC(trap06)
+ /* Check if there is no DTrace hook registered. */
+ cmpl $0,dtrace_invop_jump_addr
+ je norm_ill
+
+ /* Check if this is a user fault. */
+ /* XXX this was 0x0020 in FreeBSD */
+ cmpl $GSEL(GCODE_SEL, SEL_KPL),4(%esp) /* Check code segment. */
+
+ /* If so, just handle it as a normal trap. */
+ jne norm_ill
+
+ /*
+ * This is a kernel instruction fault that might have been caused
+ * by a DTrace provider.
+ */
+
+ /*
+ * Set our jump address for the jump back in the event that
+ * the exception wasn't caused by DTrace at all.
+ */
+ movl $norm_ill,dtrace_invop_calltrap_addr
+
+ /* Jump to the code hooked in by DTrace. */
+ jmpl *dtrace_invop_jump_addr
+
+ /*
+ * Process the instruction fault in the normal way.
+ */
+norm_ill:
+ ZTRAP(T_PRIVINFLT)
+IDTVEC_END(trap06)
+#else
IDTVEC(trap06)
ZTRAP(T_PRIVINFLT)
IDTVEC_END(trap06)
+#endif
IDTVEC(trap07)
pushl $0 /* dummy error code */
diff -r 041783992860 -r f344474e685e sys/arch/i386/i386/vector.S
--- a/sys/arch/i386/i386/vector.S Fri Aug 18 10:28:53 2017 +0000
+++ b/sys/arch/i386/i386/vector.S Fri Aug 18 14:52:19 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vector.S,v 1.72 2017/08/18 10:02:37 maxv Exp $ */
+/* $NetBSD: vector.S,v 1.73 2017/08/18 14:52:19 maxv Exp $ */
/*
* Copyright 2002 (c) Wasabi Systems, Inc.
@@ -65,7 +65,7 @@
*/
#include <machine/asm.h>
-__KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.72 2017/08/18 10:02:37 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.73 2017/08/18 14:52:19 maxv Exp $");
#include "opt_ddb.h"
#include "opt_multiprocessor.h"
@@ -125,6 +125,23 @@
shl $24,%eax ;\
orl %edx,%eax
+#ifdef KDTRACE_HOOKS
+ .bss
+ .globl dtrace_invop_jump_addr
+ .align 4
+ .type dtrace_invop_jump_addr, @object
+ .size dtrace_invop_jump_addr, 4
+dtrace_invop_jump_addr:
+ .zero 4
+ .globl dtrace_invop_calltrap_addr
+ .align 4
+ .type dtrace_invop_calltrap_addr, @object
+ .size dtrace_invop_calltrap_addr, 4
+dtrace_invop_calltrap_addr:
+ .zero 8
+ .text
+#endif
+
#ifndef XEN
#if NLAPIC > 0
#ifdef MULTIPROCESSOR
Home |
Main Index |
Thread Index |
Old Index