X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/5ba3f43ea354af8ad55bea84372a2bc834d8757c..refs/heads/master:/bsd/sys/dtrace_impl.h diff --git a/bsd/sys/dtrace_impl.h b/bsd/sys/dtrace_impl.h index 125293dbf..e1ab6a060 100644 --- a/bsd/sys/dtrace_impl.h +++ b/bsd/sys/dtrace_impl.h @@ -30,8 +30,6 @@ #ifndef _SYS_DTRACE_IMPL_H #define _SYS_DTRACE_IMPL_H -/* #pragma ident "@(#)dtrace_impl.h 1.23 07/02/16 SMI" */ - #ifdef __cplusplus extern "C" { #endif @@ -52,6 +50,8 @@ extern "C" { /* * DTrace Implementation Locks */ +extern lck_attr_t dtrace_lck_attr; +extern lck_grp_t dtrace_lck_grp; extern lck_mtx_t dtrace_procwaitfor_lock; /* @@ -110,6 +110,8 @@ struct dtrace_probe { char *dtpr_mod; /* probe's module name */ char *dtpr_func; /* probe's function name */ char *dtpr_name; /* probe's name */ + dtrace_probe_t *dtpr_nextprov; /* next in provider hash */ + dtrace_probe_t *dtpr_prevprov; /* previous in provider hash */ dtrace_probe_t *dtpr_nextmod; /* next in module hash */ dtrace_probe_t *dtpr_prevmod; /* previous in module hash */ dtrace_probe_t *dtpr_nextfunc; /* next in function hash */ @@ -135,18 +137,21 @@ typedef struct dtrace_probekey { typedef struct dtrace_hashbucket { struct dtrace_hashbucket *dthb_next; /* next on hash chain */ - dtrace_probe_t *dthb_chain; /* chain of probes */ + void *dthb_chain; /* chain of elements */ int dthb_len; /* number of probes here */ } dtrace_hashbucket_t; +typedef const char* dtrace_strkey_f(void*, uintptr_t); + typedef struct dtrace_hash { - dtrace_hashbucket_t **dth_tab; /* hash table */ - int dth_size; /* size of hash table */ - int dth_mask; /* mask to index into table */ - int dth_nbuckets; /* total number of buckets */ - uintptr_t dth_nextoffs; /* offset of next in probe */ - uintptr_t dth_prevoffs; /* offset of prev in probe */ - uintptr_t dth_stroffs; /* offset of str in probe */ + dtrace_hashbucket_t **dth_tab; /* hash table */ + int dth_size; /* size of hash table */ + int dth_mask; /* mask to index into table */ + int dth_nbuckets; /* total number of buckets */ + uintptr_t dth_nextoffs; /* offset of next in element */ + uintptr_t dth_prevoffs; /* offset of prev in element */ + dtrace_strkey_f *dth_getstr; /* func to retrieve str in element */ + uintptr_t dth_stroffs; /* offset of str in element */ } dtrace_hash_t; /* @@ -912,6 +917,7 @@ typedef struct dtrace_vstate { #define DTRACE_MSTATE_USTACKDEPTH 0x00000200 #define DTRACE_MSTATE_UCALLER 0x00000400 #define DTRACE_MSTATE_MACHTIMESTAMP 0x00000800 +#define DTRACE_MSTATE_MACHCTIMESTAMP 0x00001000 typedef struct dtrace_mstate { uintptr_t dtms_scratch_base; /* base of scratch space */ @@ -923,6 +929,7 @@ typedef struct dtrace_mstate { uint64_t dtms_timestamp; /* cached timestamp */ hrtime_t dtms_walltimestamp; /* cached wall timestamp */ uint64_t dtms_machtimestamp; /* cached mach absolute timestamp */ + uint64_t dtms_machctimestamp; /* cached mach continuous timestamp */ int dtms_stackdepth; /* cached stackdepth */ int dtms_ustackdepth; /* cached ustackdepth */ struct dtrace_probe *dtms_probe; /* current probe */ @@ -1182,6 +1189,13 @@ typedef struct dtrace_cred { uint16_t dcr_action; } dtrace_cred_t; +typedef struct dtrace_format { + uint64_t dtf_refcount; + char dtf_str[]; +} dtrace_format_t; + +#define DTRACE_FORMAT_SIZE(fmt) (strlen(fmt->dtf_str) + 1 + sizeof(dtrace_format_t)) + /* * DTrace Consumer State * @@ -1221,12 +1235,13 @@ struct dtrace_state { char dts_speculates; /* boolean: has speculations */ char dts_destructive; /* boolean: has dest. actions */ int dts_nformats; /* number of formats */ - char **dts_formats; /* format string array */ + dtrace_format_t **dts_formats; /* format string array */ dtrace_optval_t dts_options[DTRACEOPT_MAX]; /* options */ dtrace_cred_t dts_cred; /* credentials */ size_t dts_nretained; /* number of retained enabs */ uint64_t dts_arg_error_illval; uint32_t dts_buf_over_limit; /* number of bufs over dtb_limit */ + uint64_t **dts_rstate; /* per-CPU random state */ }; struct dtrace_provider { @@ -1310,6 +1325,15 @@ typedef struct dtrace_errhash { #endif /* DTRACE_ERRDEBUG */ +typedef struct dtrace_string dtrace_string_t; + +typedef struct dtrace_string { + dtrace_string_t *dtst_next; + dtrace_string_t *dtst_prev; + uint32_t dtst_refcount; + char dtst_str[]; +} dtrace_string_t; + /** * DTrace Matching pre-conditions * @@ -1357,6 +1381,7 @@ extern uint64_t dtrace_load64(uintptr_t); extern int dtrace_canload(uint64_t, size_t, dtrace_mstate_t*, dtrace_vstate_t*); extern uint64_t dtrace_getreg(struct regs *, uint_t); +extern uint64_t dtrace_getvmreg(uint_t); extern int dtrace_getstackdepth(int); extern void dtrace_getupcstack(uint64_t *, int); extern void dtrace_getufpstack(uint64_t *, uint64_t *, int); @@ -1372,11 +1397,18 @@ extern void dtrace_probe_error(dtrace_state_t *, dtrace_epid_t, int, int, extern int dtrace_assfail(const char *, const char *, int); extern int dtrace_attached(void); extern hrtime_t dtrace_gethrestime(void); -extern void dtrace_isa_init(void); + +extern void dtrace_flush_caches(void); extern void dtrace_copy(uintptr_t, uintptr_t, size_t); extern void dtrace_copystr(uintptr_t, uintptr_t, size_t, volatile uint16_t *); +extern void* dtrace_ptrauth_strip(void*, uint64_t); +extern int dtrace_is_valid_ptrauth_key(uint64_t); + +extern uint64_t dtrace_physmem_read(uint64_t, size_t); +extern void dtrace_physmem_write(uint64_t, uint64_t, size_t); + /* * DTrace state handling */