fasttrap_impl.h revision b096140d07210b5420ce3b9a738ea89dfa24cb0e
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _FASTTRAP_IMPL_H
#define _FASTTRAP_IMPL_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/fasttrap.h>
#include <sys/fasttrap_isa.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Fasttrap Providers, Probes and Tracepoints
*
* Each Solaris process can have multiple providers -- the pid provider as
* well as any number of user-level statically defined tracing (USDT)
* providers. Those providers are each represented by a fasttrap_provider_t.
* All providers for a given process have a pointer to a shared
* fasttrap_proc_t. The fasttrap_proc_t has two states: active or defunct.
* It becomes defunct when the process performs an exit or an exec.
*
* Each probe is represented by a fasttrap_probe_t which has a pointer to
* its associated provider as well as a list of fasttrap_id_tp_t structures
* which are tuples combining a fasttrap_id_t and a fasttrap_tracepoint_t.
* A fasttrap_tracepoint_t represents the actual point of instrumentation
* and it contains two lists of fasttrap_id_t structures (to be fired pre-
* and post-instruction emulation) that identify the probes attached to the
* tracepoint. Tracepoints also have a pointer to the fasttrap_proc_t for the
* process they trace which is used when looking up a tracepoint both at
* probe fire time and when enabling and disabling probes.
*
* It's important to note that probes are preallocated with the necessary
* number of tracepoints, but that tracepoints can be shared by probes and
* swapped between probes. If a probe's preallocated tracepoint is enabled
* (and, therefore, the associated probe is enabled), and that probe is
* then disabled, ownership of that tracepoint may be exchanged for an
* unused tracepoint belonging to another probe that was attached to the
* enabled tracepoint.
*/
typedef struct fasttrap_proc {
typedef struct fasttrap_provider {
typedef struct fasttrap_id fasttrap_id_t;
typedef struct fasttrap_probe fasttrap_probe_t;
typedef struct fasttrap_tracepoint fasttrap_tracepoint_t;
struct fasttrap_id {
};
typedef struct fasttrap_id_tp {
struct fasttrap_probe {
char *ftp_xtypes; /* translated types index */
char *ftp_ntypes; /* native types index */
};
#define FASTTRAP_ID_INDEX(id) \
struct fasttrap_tracepoint {
};
typedef struct fasttrap_bucket {
void *ftb_data;
typedef struct fasttrap_hash {
/*
* If at some future point these assembly functions become observable by
* DTrace, then these defines should become separate functions so that the
* fasttrap provider doesn't trigger probes during internal operations.
*/
#define fasttrap_copyout copyout
#define fasttrap_fuword32 fuword32
#define fasttrap_suword32 suword32
#define fasttrap_fulword fulword
#define fasttrap_sulword sulword
extern dtrace_id_t fasttrap_probe_id;
extern fasttrap_hash_t fasttrap_tpoints;
/*
* Must be implemented by fasttrap_isa.c
*/
extern int fasttrap_probe(struct regs *);
extern int fasttrap_pid_probe(struct regs *);
extern int fasttrap_return_probe(struct regs *);
#ifdef __cplusplus
}
#endif
#endif /* _FASTTRAP_IMPL_H */