aboutsummaryrefslogtreecommitdiff
path: root/sys/cddl/dev/dtrace/i386/dtrace_subr.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/cddl/dev/dtrace/i386/dtrace_subr.c')
-rw-r--r--sys/cddl/dev/dtrace/i386/dtrace_subr.c47
1 files changed, 11 insertions, 36 deletions
diff --git a/sys/cddl/dev/dtrace/i386/dtrace_subr.c b/sys/cddl/dev/dtrace/i386/dtrace_subr.c
index 37cc7601bef5..026581f5a899 100644
--- a/sys/cddl/dev/dtrace/i386/dtrace_subr.c
+++ b/sys/cddl/dev/dtrace/i386/dtrace_subr.c
@@ -19,8 +19,6 @@
*
* CDDL HEADER END
*
- * $FreeBSD$
- *
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
@@ -33,14 +31,15 @@
#include <sys/param.h>
#include <sys/systm.h>
-#include <sys/types.h>
#include <sys/cpuset.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/kmem.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>
@@ -68,14 +67,18 @@ dtrace_invop_hdlr_t *dtrace_invop_hdlr;
int
dtrace_invop(uintptr_t addr, struct trapframe *frame, uintptr_t eax)
{
+ struct thread *td;
dtrace_invop_hdlr_t *hdlr;
int rval;
+ rval = 0;
+ td = curthread;
+ td->t_dtrace_trapframe = frame;
for (hdlr = dtrace_invop_hdlr; hdlr != NULL; hdlr = hdlr->dtih_next)
if ((rval = hdlr->dtih_func(addr, frame, eax)) != 0)
- return (rval);
-
- return (0);
+ break;
+ td->t_dtrace_trapframe = NULL;
+ return (rval);
}
void
@@ -280,7 +283,6 @@ dtrace_gethrtime_init_cpu(void *arg)
hst_cpu_tsc = rdtsc();
}
-#ifdef EARLY_AP_STARTUP
static void
dtrace_gethrtime_init(void *arg)
{
@@ -288,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.
@@ -326,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)
-{
- cpuset_t map;
- struct pcpu *pc;
- int i;
-#endif
if (vm_guest != VM_GUEST_NO)
return;
@@ -361,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
@@ -444,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_eip += dtrace_instr_size((u_char *) frame->tf_eip);
+ frame->tf_eip += dtrace_instr_size((uint8_t *) frame->tf_eip);
return (1);
/* Page fault. */
case T_PAGEFLT:
@@ -456,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_eip += dtrace_instr_size((u_char *) frame->tf_eip);
+ frame->tf_eip += dtrace_instr_size((uint8_t *) frame->tf_eip);
return (1);
default:
/* Handle all other traps in the usual way. */