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.
This commit is contained in:
maxv 2017-08-18 14:52:19 +00:00
parent 295e874f10
commit ff63faa14a
3 changed files with 102 additions and 6 deletions

View File

@ -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 @@ nmileave:
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)

View File

@ -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 @@ IDTVEC(trap05)
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 */

View File

@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.72 2017/08/18 10:02:37 maxv Exp $");
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