#include <kern/sched_prim.h>
#include <miscfs/devfs/devfs.h>
#include <mach/vm_param.h>
+#include <machine/pal_routines.h>
+#include <i386/mp.h>
/*
* APPLE NOTE: The regmap is used to decode which 64bit uregs[] register
/*
* MP coordination
*/
-
-extern void mp_broadcast(
- void (*action_func)(void *),
- void *arg);
-
typedef struct xcArg {
processorid_t cpu;
dtrace_xcall_t f;
}
}
+
/*
* dtrace_xcall() is not called from probe context.
*/
xcArg.f = f;
xcArg.arg = arg;
- mp_broadcast( xcRemote, (void *)&xcArg);
+ if (cpu == DTRACE_CPUALL) {
+ mp_cpus_call (CPUMASK_ALL, SYNC, xcRemote, (void*)&xcArg);
+ }
+ else {
+ mp_cpus_call (cpu_to_cpumask((cpu_t)cpu), SYNC, xcRemote, (void*)&xcArg);
+ }
}
/*
- * Runtime and ABI
+ * Initialization
*/
+void
+dtrace_isa_init(void)
+{
+ return;
+}
+/*
+ * Runtime and ABI
+ */
uint64_t
dtrace_getreg(struct regs *savearea, uint_t reg)
{
if (thread == NULL)
goto zero;
+ pal_register_cache_state(thread, VALID);
regs = (x86_saved_state_t *)find_user_regs(thread);
if (regs == NULL)
goto zero;
if (DTRACE_CPUFLAG_ISSET(CPU_DTRACE_FAULT))
return (-1);
+ pal_register_cache_state(thread, VALID);
regs = (x86_saved_state_t *)find_user_regs(thread);
if (regs == NULL)
return 0;
fp = fp->backchain;
pc = fp->retaddr;
- if (pc == (uintptr_t)dtrace_invop_callsite) {
+ if (dtrace_invop_callsite_pre != NULL
+ && pc > (uintptr_t)dtrace_invop_callsite_pre
+ && pc <= (uintptr_t)dtrace_invop_callsite_post) {
#if defined(__i386__)
/*
* If we pass through the invalid op handler, we will
if (arg <= inreg) {
stack = (uintptr_t *)&saved_state->rdi;
} else {
- stack = (uintptr_t *)(saved_state->isf.rsp);
- arg -= inreg;
+ fp = (struct frame *)(saved_state->isf.rsp);
+ stack = (uintptr_t *)&fp[1]; /* Find marshalled
+ arguments */
+ arg -= inreg + 1;
}
#else
#error Unknown arch
}
/*
- * Arrive here when provider has called dtrace_probe directly.
+ * We know that we did not come through a trap to get into
+ * dtrace_probe() -- We arrive here when the provider has
+ * called dtrace_probe() directly.
+ * The probe ID is the first argument to dtrace_probe().
+ * We must advance beyond that to get the argX.
*/
arg++; /* Advance past probeID */
load:
DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT);
- val = *(((uint64_t *)stack) + arg); /* dtrace_probe arguments arg0 .. arg4 are 64bits wide */
+ /* dtrace_probe arguments arg0 ... arg4 are 64bits wide */
+ val = (uint64_t)(*(((uintptr_t *)stack) + arg));
DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT);
return (val);