*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Portions copyright (c) 2013, Joyent, Inc. All rights reserved.
+ * Portions Copyright (c) 2013 by Delphix. All rights reserved.
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ *
+ * Portions Copyright (c) 2012 by Delphix. All rights reserved.
*/
#ifndef _SYS_DTRACE_H
#define _SYS_DTRACE_H
-/* #pragma ident "@(#)dtrace.h 1.32 06/08/07 SMI" */
+/* #pragma ident "@(#)dtrace.h 1.37 07/06/05 SMI" */
#ifdef __cplusplus
extern "C" {
#include <sys/int_limits.h>
#else /* is Apple Mac OS X */
+#if defined(__LP64__)
+#if !defined(_LP64)
+#define _LP64 /* Solaris vs. Darwin */
+#endif
+#else
+#if !defined(_ILP32)
+#define _ILP32 /* Solaris vs. Darwin */
+#endif
+#endif
+
#ifdef KERNEL
#ifndef _KERNEL
#define _KERNEL /* Solaris vs. Darwin */
#endif
#include <sys/types.h>
+#include <sys/param.h>
#include <stdint.h>
#ifndef NULL
#define S_ROUND(x, a) ((x) + (((a) ? (a) : 1) - 1) & ~(((a) ? (a) : 1) - 1))
#define P2ROUNDUP(x, align) (-(-(x) & -(align)))
+#define P2PHASEUP(x, align, phase) ((phase) - (((phase) - (x)) & -(align)))
#define CTF_MODEL_ILP32 1 /* object data model is ILP32 */
+#define CTF_MODEL_LP64 2 /* object data model is LP64 */
+#ifdef __LP64__
+#define CTF_MODEL_NATIVE CTF_MODEL_LP64
+#else
#define CTF_MODEL_NATIVE CTF_MODEL_ILP32
+#endif
typedef uint8_t uchar_t;
typedef uint16_t ushort_t;
typedef uint32_t uint_t;
-typedef uint32_t ulong_t;
+typedef unsigned long ulong_t;
typedef uint64_t u_longlong_t;
typedef int64_t longlong_t;
typedef int64_t off64_t;
typedef enum { B_FALSE = 0, B_TRUE = 1 } _dtrace_boolean;
+typedef uint8_t UUID[16]; /* For modctl use in dtrace.h */
+
struct modctl; /* In lieu of Solaris <sys/modctl.h> */
/* NOTHING */ /* In lieu of Solaris <sys/processor.h> */
#include <sys/ioctl.h> /* In lieu of Solaris <sys/systm.h> */
#include <stdarg.h>
typedef va_list __va_list;
-#define proc_t struct proc
+/* Solaris proc_t is the struct. Darwin's proc_t is a pointer to it. */
+#define proc_t struct proc /* Steer clear of the Darwin typedef for proc_t */
#endif /* __APPLE__ */
/*
#define DIF_VAR_UID 0x011e /* process user ID */
#define DIF_VAR_GID 0x011f /* process group ID */
#define DIF_VAR_ERRNO 0x0120 /* thread errno */
+#if defined(__APPLE__)
+#define DIF_VAR_PTHREAD_SELF 0x0200 /* Apple specific PTHREAD_SELF (Not currently supported!) */
+#define DIF_VAR_DISPATCHQADDR 0x0201 /* Apple specific dispatch queue addr */
+#define DIF_VAR_MACHTIMESTAMP 0x0202 /* mach_absolute_timestamp() */
+#define DIF_VAR_CPU 0x0203 /* cpu number */
+#endif /* __APPLE __ */
#define DIF_SUBR_RAND 0
#define DIF_SUBR_MUTEX_OWNED 1
#define DIF_SUBR_SUBSTR 32
#define DIF_SUBR_INDEX 33
#define DIF_SUBR_RINDEX 34
-#define DIF_SUBR_CHUD 35
-
-#define DIF_SUBR_MAX 35 /* max subroutine value */
+#define DIF_SUBR_HTONS 35
+#define DIF_SUBR_HTONL 36
+#define DIF_SUBR_HTONLL 37
+#define DIF_SUBR_NTOHS 38
+#define DIF_SUBR_NTOHL 39
+#define DIF_SUBR_NTOHLL 40
+#define DIF_SUBR_INET_NTOP 41
+#define DIF_SUBR_INET_NTOA 42
+#define DIF_SUBR_INET_NTOA6 43
+#define DIF_SUBR_TOUPPER 44
+#define DIF_SUBR_TOLOWER 45
+#define DIF_SUBR_MAX 46 /* max subroutine value */
+
+/* Apple-specific subroutines */
+#if defined(__APPLE__)
+#define DIF_SUBR_APPLE_MIN 200 /* min apple-specific subroutine value */
+#define DIF_SUBR_VM_KERNEL_ADDRPERM 200
+#define DIF_SUBR_KDEBUG_TRACE 201
+#define DIF_SUBR_KDEBUG_TRACE_STRING 202
+#define DIF_SUBR_APPLE_MAX 202 /* max apple-specific subroutine value */
+#endif /* __APPLE__ */
typedef uint32_t dif_instr_t;
#define DIF_TYPE_STRING 1 /* type is a D string */
#define DIF_TF_BYREF 0x1 /* type is passed by reference */
+#define DIF_TF_BYUREF 0x2 /* user type is passed by reference */
/*
* A DTrace Intermediate Format variable record is used to describe each of the
#define DTRACEACT_PRINTF 3 /* printf() action */
#define DTRACEACT_PRINTA 4 /* printa() action */
#define DTRACEACT_LIBACT 5 /* library-controlled action */
+#define DTRACEACT_TRACEMEM 6 /* tracemem() action */
+#define DTRACEACT_TRACEMEM_DYNSIZE 7 /* dynamic tracemem() size */
+
+#if defined(__APPLE__)
+#define DTRACEACT_APPLEBINARY 50 /* Apple DT perf. tool action */
+#endif /* __APPLE__ */
#define DTRACEACT_PROC 0x0100
#define DTRACEACT_USTACK (DTRACEACT_PROC + 1)
#define DTRACEACT_RAISE (DTRACEACT_PROC_DESTRUCTIVE + 2)
#define DTRACEACT_SYSTEM (DTRACEACT_PROC_DESTRUCTIVE + 3)
#define DTRACEACT_FREOPEN (DTRACEACT_PROC_DESTRUCTIVE + 4)
+
+#if defined(__APPLE__)
+/*
+ * Dtrace stop() will task_suspend the currently running process.
+ * Dtrace pidresume(pid) will task_resume it.
+ */
+
+#define DTRACEACT_PIDRESUME (DTRACEACT_PROC_DESTRUCTIVE + 50)
+#endif /* __APPLE__ */
#define DTRACEACT_PROC_CONTROL 0x0300
#define DTRACEAGG_STDDEV (DTRACEACT_AGGREGATION + 6)
#define DTRACEAGG_QUANTIZE (DTRACEACT_AGGREGATION + 7)
#define DTRACEAGG_LQUANTIZE (DTRACEACT_AGGREGATION + 8)
+#define DTRACEAGG_LLQUANTIZE (DTRACEACT_AGGREGATION + 9)
#define DTRACEACT_ISAGG(x) \
(DTRACEACT_CLASS(x) == DTRACEACT_AGGREGATION)
+#if !defined(__APPLE__) /* Quiet compiler warning. */
#define DTRACE_QUANTIZE_NBUCKETS \
(((sizeof (uint64_t) * NBBY) - 1) * 2 + 1)
#define DTRACE_QUANTIZE_ZEROBUCKET ((sizeof (uint64_t) * NBBY) - 1)
+#else
+#define DTRACE_QUANTIZE_NBUCKETS \
+ (int)(((sizeof (uint64_t) * NBBY) - 1) * 2 + 1)
+
+#define DTRACE_QUANTIZE_ZEROBUCKET (int64_t)((sizeof (uint64_t) * NBBY) - 1)
+#endif /* __APPLE __*/
#define DTRACE_QUANTIZE_BUCKETVAL(buck) \
(int64_t)((buck) < DTRACE_QUANTIZE_ZEROBUCKET ? \
(int32_t)(((x) & DTRACE_LQUANTIZE_BASEMASK) >> \
DTRACE_LQUANTIZE_BASESHIFT)
+#define DTRACE_LLQUANTIZE_FACTORSHIFT 48
+#define DTRACE_LLQUANTIZE_FACTORMASK ((uint64_t)UINT16_MAX << 48)
+#define DTRACE_LLQUANTIZE_LOWSHIFT 32
+#define DTRACE_LLQUANTIZE_LOWMASK ((uint64_t)UINT16_MAX << 32)
+#define DTRACE_LLQUANTIZE_HIGHSHIFT 16
+#define DTRACE_LLQUANTIZE_HIGHMASK ((uint64_t)UINT16_MAX << 16)
+#define DTRACE_LLQUANTIZE_NSTEPSHIFT 0
+#define DTRACE_LLQUANTIZE_NSTEPMASK UINT16_MAX
+
+#define DTRACE_LLQUANTIZE_FACTOR(x) \
+ (uint16_t)(((x) & DTRACE_LLQUANTIZE_FACTORMASK) >> \
+ DTRACE_LLQUANTIZE_FACTORSHIFT)
+
+#define DTRACE_LLQUANTIZE_LOW(x) \
+ (uint16_t)(((x) & DTRACE_LLQUANTIZE_LOWMASK) >> \
+ DTRACE_LLQUANTIZE_LOWSHIFT)
+
+#define DTRACE_LLQUANTIZE_HIGH(x) \
+ (uint16_t)(((x) & DTRACE_LLQUANTIZE_HIGHMASK) >> \
+ DTRACE_LLQUANTIZE_HIGHSHIFT)
+
+#define DTRACE_LLQUANTIZE_NSTEP(x) \
+ (uint16_t)(((x) & DTRACE_LLQUANTIZE_NSTEPMASK) >> \
+ DTRACE_LLQUANTIZE_NSTEPSHIFT)
+
#define DTRACE_USTACK_NFRAMES(x) (uint32_t)((x) & UINT32_MAX)
#define DTRACE_USTACK_STRSIZE(x) (uint32_t)((x) >> 32)
#define DTRACE_USTACK_ARG(x, y) \
((((uint64_t)(y)) << 32) | ((x) & UINT32_MAX))
+#if !defined(__APPLE__)
+
#ifndef _LP64
#ifndef _LITTLE_ENDIAN
#define DTRACE_PTR(type, name) uint32_t name##pad; type *name
#define DTRACE_PTR(type, name) type *name
#endif
+#else
+
+#ifndef _LP64
+#define DTRACE_PTR(type, name) user_addr_t name
+#else
+#define DTRACE_PTR(type, name) type *name
+#endif
+
+#endif /* __APPLE__ */
+
/*
* DTrace Object Format (DOF)
*
#define DOF_VERSION_1 1 /* DOF version 1: Solaris 10 FCS */
#define DOF_VERSION_2 2 /* DOF version 2: Solaris Express 6/06 */
+#if !defined(__APPLE__)
+#define DOF_VERSION DOF_VERSION_2 /* Latest DOF version */
+#else
#define DOF_VERSION_3 3 /* DOF version 3: Minimum version for Leopard */
#define DOF_VERSION DOF_VERSION_3 /* Latest DOF version */
+#endif /* __APPLE__ */
#define DOF_FL_VALID 0 /* mask of all valid dofh_flags bits */
int dtad_refcnt; /* reference count */
} dtrace_actdesc_t;
+
typedef struct dtrace_ecbdesc {
dtrace_actdesc_t *dted_action; /* action description(s) */
dtrace_preddesc_t dted_pred; /* predicate description */
dtrace_probedesc_t dted_probe; /* probe description */
uint64_t dted_uarg; /* library argument */
int dted_refcnt; /* reference count */
+ uint64_t dted_probegen; /* matched probe generation */
} dtrace_ecbdesc_t;
+/*
+ * APPLE NOTE: The kernel always rebuild dtrace_ecbdesc structures
+ * coming from userspace, so there is no dted_probegen manipulation risk
+ */
+
/*
* DTrace Metadata Description Structures
*
* DTrace separates the trace data stream from the metadata stream. The only
- * metadata tokens placed in the data stream are enabled probe identifiers
- * (EPIDs) or (in the case of aggregations) aggregation identifiers. In order
- * to determine the structure of the data, DTrace consumers pass the token to
- * the kernel, and receive in return a corresponding description of the enabled
+ * metadata tokens placed in the data stream are the dtrace_rechdr_t (EPID +
+ * timestamp) or (in the case of aggregations) aggregation identifiers. To
+ * determine the structure of the data, DTrace consumers pass the token to the
+ * kernel, and receive in return a corresponding description of the enabled
* probe (via the dtrace_eprobedesc structure) or the aggregation (via the
* dtrace_aggdesc structure). Both of these structures are expressed in terms
* of record descriptions (via the dtrace_recdesc structure) that describe the
#define DTRACEOPT_AGGSORTREV 24 /* reverse-sort aggregations */
#define DTRACEOPT_AGGSORTPOS 25 /* agg. position to sort on */
#define DTRACEOPT_AGGSORTKEYPOS 26 /* agg. key position to sort on */
-#if defined(__APPLE__)
-#define DTRACEOPT_STACKSYMBOLS 27 /* clear to prevent stack symbolication */
-#define DTRACEOPT_MAX 28 /* number of options */
+#define DTRACEOPT_AGGHIST 27 /* histogram aggregation output */
+#define DTRACEOPT_AGGPACK 28 /* packed aggregation output */
+#define DTRACEOPT_AGGZOOM 29 /* zoomed aggregation scaling */
+#define DTRACEOPT_TEMPORAL 30 /* temporally ordered output */
+#if !defined(__APPLE__)
+#define DTRACEOPT_MAX 31 /* number of options */
#else
-#define DTRACEOPT_MAX 27 /* number of options */
-#endif
+#define DTRACEOPT_STACKSYMBOLS 31 /* clear to prevent stack symbolication */
+#define DTRACEOPT_BUFLIMIT 32 /* buffer signaling limit in % of the size */
+#define DTRACEOPT_MAX 33 /* number of options */
+#endif /* __APPLE__ */
#define DTRACEOPT_UNSET (dtrace_optval_t)-2 /* unset option */
* where user-level wishes the kernel to snapshot the buffer to (the
* dtbd_data field). The kernel uses the same structure to pass back some
* information regarding the buffer: the size of data actually copied out, the
- * number of drops, the number of errors, and the offset of the oldest record.
+ * number of drops, the number of errors, the offset of the oldest record,
+ * and the time of the snapshot.
+ *
* If the buffer policy is a "switch" policy, taking a snapshot of the
* principal buffer has the additional effect of switching the active and
* inactive buffers. Taking a snapshot of the aggregation buffer _always_ has
uint64_t dtbd_drops; /* number of drops */
DTRACE_PTR(char, dtbd_data); /* data */
uint64_t dtbd_oldest; /* offset of oldest record */
+ uint64_t dtbd_timestamp; /* hrtime of snapshot */
} dtrace_bufdesc_t;
+/*
+ * Each record in the buffer (dtbd_data) begins with a header that includes
+ * the epid and a timestamp. The timestamp is split into two 4-byte parts
+ * so that we do not require 8-byte alignment.
+ */
+typedef struct dtrace_rechdr {
+ dtrace_epid_t dtrh_epid; /* enabled probe id */
+ uint32_t dtrh_timestamp_hi; /* high bits of hrtime_t */
+ uint32_t dtrh_timestamp_lo; /* low bits of hrtime_t */
+} dtrace_rechdr_t;
+
+#define DTRACE_RECORD_LOAD_TIMESTAMP(dtrh) \
+ ((dtrh)->dtrh_timestamp_lo + \
+ ((uint64_t)(dtrh)->dtrh_timestamp_hi << 32))
+
+#define DTRACE_RECORD_STORE_TIMESTAMP(dtrh, hrtime) { \
+ (dtrh)->dtrh_timestamp_lo = (uint32_t)hrtime; \
+ (dtrh)->dtrh_timestamp_hi = hrtime >> 32; \
+}
+
/*
* DTrace Status
*
#define DTRACEFLT_KPRIV 6 /* Illegal kernel access */
#define DTRACEFLT_UPRIV 7 /* Illegal user access */
#define DTRACEFLT_TUPOFLOW 8 /* Tuple stack overflow */
+#define DTRACEFLT_BADSTACK 9 /* Bad stack */
#define DTRACEFLT_LIBRARY 1000 /* Library-level fault */
#define DTRACEIOC_FORMAT (DTRACEIOC | 16) /* get format str */
#define DTRACEIOC_DOFGET (DTRACEIOC | 17) /* get DOF */
#define DTRACEIOC_REPLICATE (DTRACEIOC | 18) /* replicate enab */
+#define DTRACEIOC_MODUUIDSLIST (DTRACEIOC | 30) /* APPLE ONLY, query for modules with missing symbols */
+#define DTRACEIOC_PROVMODSYMS (DTRACEIOC | 31) /* APPLE ONLY, provide missing symbols for a given module */
+#define DTRACEIOC_PROCWAITFOR (DTRACEIOC | 32) /* APPLE ONLY, wait for process exec */
+#define DTRACEIOC_SLEEP (DTRACEIOC | 33) /* APPLE ONLY, sleep */
+#define DTRACEIOC_SIGNAL (DTRACEIOC | 34) /* APPLE ONLY, signal sleeping process */
+
+/*
+ * The following structs are used to provide symbol information to the kernel from userspace.
+ */
+
+typedef struct dtrace_symbol {
+ uint64_t dtsym_addr; /* address of the symbol */
+ uint64_t dtsym_size; /* size of the symbol, must be uint64_t to maintain alignment when called by 64b uproc in i386 kernel */
+ char dtsym_name[DTRACE_FUNCNAMELEN]; /* symbol name */
+} dtrace_symbol_t;
+
+typedef struct dtrace_module_symbols {
+ UUID dtmodsyms_uuid;
+ uint64_t dtmodsyms_count;
+ dtrace_symbol_t dtmodsyms_symbols[1];
+} dtrace_module_symbols_t;
+
+#define DTRACE_MODULE_SYMBOLS_SIZE(count) (sizeof(dtrace_module_symbols_t) + ((count - 1) * sizeof(dtrace_symbol_t)))
+
+typedef struct dtrace_module_uuids_list {
+ uint64_t dtmul_count;
+ UUID dtmul_uuid[1];
+} dtrace_module_uuids_list_t;
+
+#define DTRACE_MODULE_UUIDS_LIST_SIZE(count) (sizeof(dtrace_module_uuids_list_t) + ((count - 1) * sizeof(UUID)))
+
+typedef struct dtrace_procdesc {
+ /* Must be specified by user-space */
+ char p_name[128];
+ /* Set or modified by the Kernel */
+ int p_name_length;
+ pid_t p_pid;
+} dtrace_procdesc_t;
+
+/**
+ * DTrace wake reasons.
+ * This is used in userspace to determine what's the reason why it woke up,
+ * to start aggregating / switching buffer right away if it is because a buffer
+ * got over its limit
+ */
+#define DTRACE_WAKE_TIMEOUT 0 /* dtrace client woke up because of a timeout */
+#define DTRACE_WAKE_BUF_LIMIT 1 /* dtrace client woke up because of a over limit buffer */
+
#endif /* __APPLE__ */
/*
#endif
#define DTRACEMNR_DTRACE "dtrace" /* node for DTrace ops */
+#if !defined(__APPLE__)
+#define DTRACEMNR_HELPER "helper" /* node for helpers */
+#else
#define DTRACEMNR_HELPER "dtracehelper" /* node for helpers */
+#endif /* __APPLE__ */
#define DTRACEMNRN_DTRACE 0 /* minor for DTrace ops */
#define DTRACEMNRN_HELPER 1 /* minor for helpers */
#define DTRACEMNRN_CLONE 2 /* first clone minor */
* dtps_provide_module(); see "Arguments and Notes" for dtrace_register(),
* below.
*
- * 1.4 void dtps_enable(void *arg, dtrace_id_t id, void *parg)
+ * 1.4 int dtps_enable(void *arg, dtrace_id_t id, void *parg)
*
* 1.4.1 Overview
*
*
* 1.4.3 Return value
*
- * None.
+ * On success, dtps_enable() should return 0. On failure, -1 should be
+ * returned.
*
* 1.4.4 Caller's context
*
typedef struct dtrace_pops {
void (*dtps_provide)(void *arg, const dtrace_probedesc_t *spec);
void (*dtps_provide_module)(void *arg, struct modctl *mp);
- void (*dtps_enable)(void *arg, dtrace_id_t id, void *parg);
+ int (*dtps_enable)(void *arg, dtrace_id_t id, void *parg);
void (*dtps_disable)(void *arg, dtrace_id_t id, void *parg);
void (*dtps_suspend)(void *arg, dtrace_id_t id, void *parg);
void (*dtps_resume)(void *arg, dtrace_id_t id, void *parg);
* a meta provider. This structure consists of the following members:
*
* dtms_create_probe() <-- Add a new probe to a created provider
- * dtms_provide_pid() <-- Create a new provider for a given process
- * dtms_remove_pid() <-- Remove a previously created provider
+ * dtms_provide_proc() <-- Create a new provider for a given process
+ * dtms_remove_proc() <-- Remove a previously created provider
*
* 1.2 void dtms_create_probe(void *arg, void *parg,
* dtrace_helper_probedesc_t *probedesc);
*
* The first argument is the cookie as passed to dtrace_meta_register().
* The second argument is the provider cookie for the associated provider;
- * this is obtained from the return value of dtms_provide_pid(). The third
+ * this is obtained from the return value of dtms_provide_proc(). The third
* argument is the helper probe description.
*
* 1.2.3 Return value
* such that the provider may (and is expected to) call provider-related
* DTrace provider APIs including dtrace_probe_create().
*
- * 1.3 void *dtms_provide_pid(void *arg, dtrace_meta_provider_t *mprov,
- * pid_t pid)
+ * 1.3 void *dtms_provide_proc(void *arg, dtrace_meta_provider_t *mprov,
+ * proc_t *proc)
*
* 1.3.1 Overview
*
*
* 1.3.4 Caller's context
*
- * dtms_provide_pid() is called from either ioctl() or module load context.
+ * dtms_provide_proc() is called from either ioctl() or module load context.
* The DTrace framework is locked in such a way that meta providers may not
* register or unregister. This means that the meta provider cannot call
* dtrace_meta_register() or dtrace_meta_unregister(). However, the context
* is such that the provider may -- and is expected to -- call
* provider-related DTrace provider APIs including dtrace_register().
*
- * 1.4 void dtms_remove_pid(void *arg, dtrace_meta_provider_t *mprov,
- * pid_t pid)
+ * 1.4 void dtms_remove_proc(void *arg, dtrace_meta_provider_t *mprov,
+ * proc_t proc)
*
* 1.4.1 Overview
*
*
* 1.4.4 Caller's context
*
- * dtms_remove_pid() is called from either ioctl() or exit() context.
+ * dtms_remove_proc() is called from either ioctl() or exit() context.
* The DTrace framework is locked in such a way that meta providers may not
* register or unregister. This means that the meta provider cannot call
* dtrace_meta_register() or dtrace_meta_unregister(). However, the context
dtrace_pattr_t dthpv_pattr; /* stability attributes */
} dtrace_helper_provdesc_t;
+/*
+ * APPLE NOTE: dtms_provide_pid and dtms_remove_pid are replaced with
+ * dtms_provide_proc on Darwin, and a proc reference need to be held
+ * for the duration of the call.
+ *
+ * This is due to the fact that proc_find is not re-entrant on Darwin.
+ */
+
typedef struct dtrace_mops {
void (*dtms_create_probe)(void *, void *, dtrace_helper_probedesc_t *);
- void *(*dtms_provide_pid)(void *, dtrace_helper_provdesc_t *, pid_t);
- void (*dtms_remove_pid)(void *, dtrace_helper_provdesc_t *, pid_t);
+ void *(*dtms_provide_proc)(void *, dtrace_helper_provdesc_t *, proc_t*);
+ void (*dtms_remove_proc)(void *, dtrace_helper_provdesc_t *, proc_t*);
+ char* (*dtms_provider_name)(void *);
} dtrace_mops_t;
typedef uintptr_t dtrace_meta_provider_id_t;
extern void dtrace_vtime_enable(void);
extern void dtrace_vtime_disable(void);
-#if defined (__ppc__) || defined (__ppc64__)
-extern int (*dtrace_pid_probe_ptr)(ppc_saved_state_t *regs);
-extern int (*dtrace_return_probe_ptr)(ppc_saved_state_t* regs);
-#elif defined (__i386__) || defined(__x86_64__)
+#if !defined(__APPLE__)
+struct regs;
+
+extern int (*dtrace_pid_probe_ptr)(struct regs *);
+extern int (*dtrace_return_probe_ptr)(struct regs *);
+#else
+#if defined (__i386__) || defined(__x86_64__)
extern int (*dtrace_pid_probe_ptr)(x86_saved_state_t *regs);
extern int (*dtrace_return_probe_ptr)(x86_saved_state_t* regs);
#else
#error architecture not supported
#endif
-
+#endif /* __APPLE__ */
extern void (*dtrace_fasttrap_fork_ptr)(proc_t *, proc_t *);
extern void (*dtrace_fasttrap_exec_ptr)(proc_t *);
extern void (*dtrace_fasttrap_exit_ptr)(proc_t *);
extern void dtrace_membar_consumer(void);
extern void (*dtrace_cpu_init)(processorid_t);
+#if !defined(__APPLE__)
extern void (*dtrace_modload)(struct modctl *);
extern void (*dtrace_modunload)(struct modctl *);
+#else
+extern int (*dtrace_modload)(struct kmod_info *, uint32_t);
+extern int (*dtrace_modunload)(struct kmod_info *);
+#endif /* __APPLE__ */
extern void (*dtrace_helpers_cleanup)(proc_t*);
extern void (*dtrace_helpers_fork)(proc_t *parent, proc_t *child);
extern void (*dtrace_cpustart_init)(void);
extern void dtrace_sync(void);
extern void dtrace_toxic_ranges(void (*)(uintptr_t, uintptr_t));
extern void dtrace_xcall(processorid_t, dtrace_xcall_t, void *);
-extern void dtrace_vpanic(const char *, __va_list);
-extern void dtrace_panic(const char *, ...);
extern int dtrace_safe_defer_signal(void);
extern void dtrace_safe_synchronous_signal(void);
-#if defined(__i386__) || defined(__x86_64__)
+extern int dtrace_mach_aframes(void);
+
+#if !defined(__APPLE__)
+#if defined(__i386) || defined(__amd64)
extern int dtrace_instr_size(uchar_t *instr);
extern int dtrace_instr_size_isa(uchar_t *, model_t, int *);
extern void dtrace_invop_add(int (*)(uintptr_t, uintptr_t *, uintptr_t));
extern int dtrace_blksuword32(uintptr_t, uint32_t *, int);
extern void dtrace_getfsr(uint64_t *);
#endif
-
-#if defined(__APPLE__)
-#if defined (__ppc__) || defined (__ppc64__)
+#else
+#if defined(__i386__) || defined(__x86_64__)
+extern int dtrace_instr_size(uchar_t *instr);
+extern int dtrace_instr_size_isa(uchar_t *, model_t, int *);
extern void dtrace_invop_add(int (*)(uintptr_t, uintptr_t *, uintptr_t));
extern void dtrace_invop_remove(int (*)(uintptr_t, uintptr_t *, uintptr_t));
+extern void *dtrace_invop_callsite_pre;
+extern void *dtrace_invop_callsite_post;
#endif
+
+
#undef proc_t
#endif /* __APPLE__ */
#endif /* _ASM */
+#if !defined(__APPLE__)
+#if defined(__i386) || defined(__amd64)
+
+#define DTRACE_INVOP_PUSHL_EBP 1
+#define DTRACE_INVOP_POPL_EBP 2
+#define DTRACE_INVOP_LEAVE 3
+#define DTRACE_INVOP_NOP 4
+#define DTRACE_INVOP_RET 5
+
+#endif
+#else
#if defined(__i386__) || defined(__x86_64__)
#define DTRACE_INVOP_PUSHL_EBP 1
#endif
-#if defined(__APPLE__)
-#if defined (__ppc__) || defined (__ppc64__)
-#define DTRACE_INVOP_NOP 4
-#define DTRACE_INVOP_RET 5
-#define DTRACE_INVOP_BCTR 6
-#define DTRACE_INVOP_TAILJUMP 7
-#endif
+
#endif /* __APPLE__ */
#ifdef __cplusplus