aboutsummaryrefslogtreecommitdiff
path: root/sys/cddl/dev/dtrace/amd64/dtrace_subr.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/cddl/dev/dtrace/amd64/dtrace_subr.c')
-rw-r--r--sys/cddl/dev/dtrace/amd64/dtrace_subr.c46
1 files changed, 11 insertions, 35 deletions
diff --git a/sys/cddl/dev/dtrace/amd64/dtrace_subr.c b/sys/cddl/dev/dtrace/amd64/dtrace_subr.c
index f4fb70f80a6b..09b820241e50 100644
--- a/sys/cddl/dev/dtrace/amd64/dtrace_subr.c
+++ b/sys/cddl/dev/dtrace/amd64/dtrace_subr.c
@@ -19,8 +19,6 @@
*
* CDDL HEADER END
*
- * $FreeBSD$
- *
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
@@ -33,12 +31,13 @@
#include <sys/param.h>
#include <sys/systm.h>
-#include <sys/types.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
+#include <sys/proc.h>
#include <sys/smp.h>
#include <sys/dtrace_impl.h>
#include <sys/dtrace_bsd.h>
+#include <cddl/dev/dtrace/dtrace_cddl.h>
#include <machine/clock.h>
#include <machine/cpufunc.h>
#include <machine/frame.h>
@@ -65,15 +64,20 @@ dtrace_invop_hdlr_t *dtrace_invop_hdlr;
int
dtrace_invop(uintptr_t addr, struct trapframe *frame, void **scratch)
{
+ struct thread *td;
dtrace_invop_hdlr_t *hdlr;
int rval;
+ td = curthread;
+ td->t_dtrace_trapframe = frame;
+ rval = 0;
for (hdlr = dtrace_invop_hdlr; hdlr != NULL; hdlr = hdlr->dtih_next) {
rval = hdlr->dtih_func(addr, frame, (uintptr_t)scratch);
if (rval != 0)
- return (rval);
+ break;
}
- return (0);
+ td->t_dtrace_trapframe = NULL;
+ return (rval);
}
void
@@ -279,7 +283,6 @@ dtrace_gethrtime_init_cpu(void *arg)
hst_cpu_tsc = rdtsc();
}
-#ifdef EARLY_AP_STARTUP
static void
dtrace_gethrtime_init(void *arg)
{
@@ -287,16 +290,6 @@ dtrace_gethrtime_init(void *arg)
uint64_t tsc_f;
cpuset_t map;
int i;
-#else
-/*
- * Get the frequency and scale factor as early as possible so that they can be
- * used for boot-time tracing.
- */
-static void
-dtrace_gethrtime_init_early(void *arg)
-{
- uint64_t tsc_f;
-#endif
/*
* Get TSC frequency known at this moment.
@@ -325,18 +318,6 @@ dtrace_gethrtime_init_early(void *arg)
* (terahertz) values;
*/
nsec_scale = ((uint64_t)NANOSEC << SCALE_SHIFT) / tsc_f;
-#ifndef EARLY_AP_STARTUP
-}
-SYSINIT(dtrace_gethrtime_init_early, SI_SUB_CPU, SI_ORDER_ANY,
- dtrace_gethrtime_init_early, NULL);
-
-static void
-dtrace_gethrtime_init(void *arg)
-{
- struct pcpu *pc;
- cpuset_t map;
- int i;
-#endif
if (vm_guest != VM_GUEST_NO)
return;
@@ -360,13 +341,8 @@ dtrace_gethrtime_init(void *arg)
}
sched_unpin();
}
-#ifdef EARLY_AP_STARTUP
SYSINIT(dtrace_gethrtime_init, SI_SUB_DTRACE, SI_ORDER_ANY,
dtrace_gethrtime_init, NULL);
-#else
-SYSINIT(dtrace_gethrtime_init, SI_SUB_SMP, SI_ORDER_ANY, dtrace_gethrtime_init,
- NULL);
-#endif
/*
* DTrace needs a high resolution time function which can
@@ -443,7 +419,7 @@ dtrace_trap(struct trapframe *frame, u_int type)
* Offset the instruction pointer to the instruction
* following the one causing the fault.
*/
- frame->tf_rip += dtrace_instr_size((u_char *) frame->tf_rip);
+ frame->tf_rip += dtrace_instr_size((uint8_t *) frame->tf_rip);
return (1);
/* Page fault. */
case T_PAGEFLT:
@@ -455,7 +431,7 @@ dtrace_trap(struct trapframe *frame, u_int type)
* Offset the instruction pointer to the instruction
* following the one causing the fault.
*/
- frame->tf_rip += dtrace_instr_size((u_char *) frame->tf_rip);
+ frame->tf_rip += dtrace_instr_size((uint8_t *) frame->tf_rip);
return (1);
default:
/* Handle all other traps in the usual way. */