Oops, these files belonged under src/sys, not src. Sorry.

This commit is contained in:
John Birrell 2008-05-22 07:46:01 +00:00
parent 5a1b490d50
commit 3c659d488d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=179199
18 changed files with 0 additions and 25785 deletions

View File

@ -1,177 +0,0 @@
/*
* 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
* or http://www.opensolaris.org/os/licensing.
* 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 2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/sysmacros.h>
#include <sys/modctl.h>
#include <sys/debug.h>
#include <sys/mman.h>
#include <sys/modctl.h>
#include <sys/kobj.h>
#include <ctf_impl.h>
int ctf_leave_compressed = 0;
static struct modlmisc modlmisc = {
&mod_miscops, "Compact C Type Format routines"
};
static struct modlinkage modlinkage = {
MODREV_1, &modlmisc, NULL
};
int
_init(void)
{
return (mod_install(&modlinkage));
}
int
_info(struct modinfo *mip)
{
return (mod_info(&modlinkage, mip));
}
int
_fini(void)
{
return (mod_remove(&modlinkage));
}
/*ARGSUSED*/
void *
ctf_zopen(int *errp)
{
return ((void *)1); /* zmod is always loaded because we depend on it */
}
/*ARGSUSED*/
const void *
ctf_sect_mmap(ctf_sect_t *sp, int fd)
{
return (MAP_FAILED); /* we don't support this in the kernel */
}
/*ARGSUSED*/
void
ctf_sect_munmap(const ctf_sect_t *sp)
{
/* we don't support this in the kernel */
}
/*ARGSUSED*/
ctf_file_t *
ctf_fdopen(int fd, int *errp)
{
return (ctf_set_open_errno(errp, ENOTSUP));
}
/*ARGSUSED*/
ctf_file_t *
ctf_open(const char *filename, int *errp)
{
return (ctf_set_open_errno(errp, ENOTSUP));
}
/*ARGSUSED*/
int
ctf_write(ctf_file_t *fp, int fd)
{
return (ctf_set_errno(fp, ENOTSUP));
}
int
ctf_version(int version)
{
ASSERT(version > 0 && version <= CTF_VERSION);
if (version > 0)
_libctf_version = MIN(CTF_VERSION, version);
return (_libctf_version);
}
/*ARGSUSED*/
ctf_file_t *
ctf_modopen(struct module *mp, int *error)
{
ctf_sect_t ctfsect, symsect, strsect;
ctf_file_t *fp = NULL;
int err;
if (error == NULL)
error = &err;
ctfsect.cts_name = ".SUNW_ctf";
ctfsect.cts_type = SHT_PROGBITS;
ctfsect.cts_flags = SHF_ALLOC;
ctfsect.cts_data = mp->ctfdata;
ctfsect.cts_size = mp->ctfsize;
ctfsect.cts_entsize = 1;
ctfsect.cts_offset = 0;
symsect.cts_name = ".symtab";
symsect.cts_type = SHT_SYMTAB;
symsect.cts_flags = 0;
symsect.cts_data = mp->symtbl;
symsect.cts_size = mp->symhdr->sh_size;
#ifdef _LP64
symsect.cts_entsize = sizeof (Elf64_Sym);
#else
symsect.cts_entsize = sizeof (Elf32_Sym);
#endif
symsect.cts_offset = 0;
strsect.cts_name = ".strtab";
strsect.cts_type = SHT_STRTAB;
strsect.cts_flags = 0;
strsect.cts_data = mp->strings;
strsect.cts_size = mp->strhdr->sh_size;
strsect.cts_entsize = 1;
strsect.cts_offset = 0;
ASSERT(MUTEX_HELD(&mod_lock));
if ((fp = ctf_bufopen(&ctfsect, &symsect, &strsect, error)) == NULL)
return (NULL);
if (!ctf_leave_compressed && (caddr_t)fp->ctf_base != mp->ctfdata) {
/*
* We must have just uncompressed the CTF data. To avoid
* others having to pay the (substantial) cost of decompressing
* the data, we're going to substitute the uncompressed version
* for the compressed version. Note that this implies that the
* first CTF consumer will induce memory impact on the system
* (but in the name of performance of future CTF consumers).
*/
kobj_set_ctf(mp, (caddr_t)fp->ctf_base, fp->ctf_size);
fp->ctf_data.cts_data = fp->ctf_base;
fp->ctf_data.cts_size = fp->ctf_size;
}
return (fp);
}

View File

@ -1,96 +0,0 @@
/*
* 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
* or http://www.opensolaris.org/os/licensing.
* 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 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <ctf_impl.h>
#include <sys/kobj.h>
#include <sys/kobj_impl.h>
/*
* This module is used both during the normal operation of the kernel (i.e.
* after kmem has been initialized) and during boot (before unix`_start has
* been called). kobj_alloc is able to tell the difference between the two
* cases, and as such must be used instead of kmem_alloc.
*/
void *
ctf_data_alloc(size_t size)
{
void *buf = kobj_alloc(size, KM_NOWAIT|KM_SCRATCH);
if (buf == NULL)
return (MAP_FAILED);
return (buf);
}
void
ctf_data_free(void *buf, size_t size)
{
kobj_free(buf, size);
}
/*ARGSUSED*/
void
ctf_data_protect(void *buf, size_t size)
{
/* we don't support this operation in the kernel */
}
void *
ctf_alloc(size_t size)
{
return (kobj_alloc(size, KM_NOWAIT|KM_TMP));
}
/*ARGSUSED*/
void
ctf_free(void *buf, size_t size)
{
kobj_free(buf, size);
}
/*ARGSUSED*/
const char *
ctf_strerror(int err)
{
return (NULL); /* we don't support this operation in the kernel */
}
/*PRINTFLIKE1*/
void
ctf_dprintf(const char *format, ...)
{
if (_libctf_debug) {
va_list alist;
va_start(alist, format);
(void) printf("ctf DEBUG: ");
(void) vprintf(format, alist);
va_end(alist);
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,341 +0,0 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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
* or http://www.opensolaris.org/os/licensing.
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/types.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <sys/open.h>
#include <sys/file.h>
#include <sys/conf.h>
#include <sys/modctl.h>
#include <sys/cmn_err.h>
#include <sys/bitmap.h>
#include <sys/debug.h>
#include <sys/kmem.h>
#include <sys/errno.h>
#include <sys/sysmacros.h>
#include <sys/lockstat.h>
#include <sys/atomic.h>
#include <sys/dtrace.h>
#include <sys/ddi.h>
#include <sys/sunddi.h>
typedef struct lockstat_probe {
const char *lsp_func;
const char *lsp_name;
int lsp_probe;
dtrace_id_t lsp_id;
} lockstat_probe_t;
lockstat_probe_t lockstat_probes[] =
{
{ LS_MUTEX_ENTER, LSA_ACQUIRE, LS_MUTEX_ENTER_ACQUIRE },
{ LS_MUTEX_ENTER, LSA_BLOCK, LS_MUTEX_ENTER_BLOCK },
{ LS_MUTEX_ENTER, LSA_SPIN, LS_MUTEX_ENTER_SPIN },
{ LS_MUTEX_EXIT, LSA_RELEASE, LS_MUTEX_EXIT_RELEASE },
{ LS_MUTEX_DESTROY, LSA_RELEASE, LS_MUTEX_DESTROY_RELEASE },
{ LS_MUTEX_TRYENTER, LSA_ACQUIRE, LS_MUTEX_TRYENTER_ACQUIRE },
{ LS_LOCK_SET, LSS_ACQUIRE, LS_LOCK_SET_ACQUIRE },
{ LS_LOCK_SET, LSS_SPIN, LS_LOCK_SET_SPIN },
{ LS_LOCK_SET_SPL, LSS_ACQUIRE, LS_LOCK_SET_SPL_ACQUIRE },
{ LS_LOCK_SET_SPL, LSS_SPIN, LS_LOCK_SET_SPL_SPIN },
{ LS_LOCK_TRY, LSS_ACQUIRE, LS_LOCK_TRY_ACQUIRE },
{ LS_LOCK_CLEAR, LSS_RELEASE, LS_LOCK_CLEAR_RELEASE },
{ LS_LOCK_CLEAR_SPLX, LSS_RELEASE, LS_LOCK_CLEAR_SPLX_RELEASE },
{ LS_CLOCK_UNLOCK, LSS_RELEASE, LS_CLOCK_UNLOCK_RELEASE },
{ LS_RW_ENTER, LSR_ACQUIRE, LS_RW_ENTER_ACQUIRE },
{ LS_RW_ENTER, LSR_BLOCK, LS_RW_ENTER_BLOCK },
{ LS_RW_EXIT, LSR_RELEASE, LS_RW_EXIT_RELEASE },
{ LS_RW_TRYENTER, LSR_ACQUIRE, LS_RW_TRYENTER_ACQUIRE },
{ LS_RW_TRYUPGRADE, LSR_UPGRADE, LS_RW_TRYUPGRADE_UPGRADE },
{ LS_RW_DOWNGRADE, LSR_DOWNGRADE, LS_RW_DOWNGRADE_DOWNGRADE },
{ LS_THREAD_LOCK, LST_SPIN, LS_THREAD_LOCK_SPIN },
{ LS_THREAD_LOCK_HIGH, LST_SPIN, LS_THREAD_LOCK_HIGH_SPIN },
{ NULL }
};
static dev_info_t *lockstat_devi; /* saved in xxattach() for xxinfo() */
static kmutex_t lockstat_test; /* for testing purposes only */
static dtrace_provider_id_t lockstat_id;
/*ARGSUSED*/
static void
lockstat_enable(void *arg, dtrace_id_t id, void *parg)
{
lockstat_probe_t *probe = parg;
ASSERT(!lockstat_probemap[probe->lsp_probe]);
lockstat_probemap[probe->lsp_probe] = id;
membar_producer();
lockstat_hot_patch();
membar_producer();
/*
* Immediately generate a record for the lockstat_test mutex
* to verify that the mutex hot-patch code worked as expected.
*/
mutex_enter(&lockstat_test);
mutex_exit(&lockstat_test);
}
/*ARGSUSED*/
static void
lockstat_disable(void *arg, dtrace_id_t id, void *parg)
{
lockstat_probe_t *probe = parg;
int i;
ASSERT(lockstat_probemap[probe->lsp_probe]);
lockstat_probemap[probe->lsp_probe] = 0;
lockstat_hot_patch();
membar_producer();
/*
* See if we have any probes left enabled.
*/
for (i = 0; i < LS_NPROBES; i++) {
if (lockstat_probemap[i]) {
/*
* This probe is still enabled. We don't need to deal
* with waiting for all threads to be out of the
* lockstat critical sections; just return.
*/
return;
}
}
/*
* The delay() here isn't as cheesy as you might think. We don't
* want to busy-loop in the kernel, so we have to give up the
* CPU between calls to lockstat_active_threads(); that much is
* obvious. But the reason it's a do..while loop rather than a
* while loop is subtle. The memory barrier above guarantees that
* no threads will enter the lockstat code from this point forward.
* However, another thread could already be executing lockstat code
* without our knowledge if the update to its t_lockstat field hasn't
* cleared its CPU's store buffer. Delaying for one clock tick
* guarantees that either (1) the thread will have *ample* time to
* complete its work, or (2) the thread will be preempted, in which
* case it will have to grab and release a dispatcher lock, which
* will flush that CPU's store buffer. Either way we're covered.
*/
do {
delay(1);
} while (lockstat_active_threads());
}
/*ARGSUSED*/
static int
lockstat_open(dev_t *devp, int flag, int otyp, cred_t *cred_p)
{
return (0);
}
/* ARGSUSED */
static int
lockstat_info(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg, void **result)
{
int error;
switch (infocmd) {
case DDI_INFO_DEVT2DEVINFO:
*result = (void *) lockstat_devi;
error = DDI_SUCCESS;
break;
case DDI_INFO_DEVT2INSTANCE:
*result = (void *)0;
error = DDI_SUCCESS;
break;
default:
error = DDI_FAILURE;
}
return (error);
}
/*ARGSUSED*/
static void
lockstat_provide(void *arg, const dtrace_probedesc_t *desc)
{
int i = 0;
for (i = 0; lockstat_probes[i].lsp_func != NULL; i++) {
lockstat_probe_t *probe = &lockstat_probes[i];
if (dtrace_probe_lookup(lockstat_id, "genunix",
probe->lsp_func, probe->lsp_name) != 0)
continue;
ASSERT(!probe->lsp_id);
probe->lsp_id = dtrace_probe_create(lockstat_id,
"genunix", probe->lsp_func, probe->lsp_name,
1, probe);
}
}
/*ARGSUSED*/
static void
lockstat_destroy(void *arg, dtrace_id_t id, void *parg)
{
lockstat_probe_t *probe = parg;
ASSERT(!lockstat_probemap[probe->lsp_probe]);
probe->lsp_id = 0;
}
static dtrace_pattr_t lockstat_attr = {
{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON },
{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON },
{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON },
};
static dtrace_pops_t lockstat_pops = {
lockstat_provide,
NULL,
lockstat_enable,
lockstat_disable,
NULL,
NULL,
NULL,
NULL,
NULL,
lockstat_destroy
};
static int
lockstat_attach(dev_info_t *devi, ddi_attach_cmd_t cmd)
{
switch (cmd) {
case DDI_ATTACH:
break;
case DDI_RESUME:
return (DDI_SUCCESS);
default:
return (DDI_FAILURE);
}
if (ddi_create_minor_node(devi, "lockstat", S_IFCHR, 0,
DDI_PSEUDO, 0) == DDI_FAILURE ||
dtrace_register("lockstat", &lockstat_attr, DTRACE_PRIV_KERNEL,
NULL, &lockstat_pops, NULL, &lockstat_id) != 0) {
ddi_remove_minor_node(devi, NULL);
return (DDI_FAILURE);
}
lockstat_probe = dtrace_probe;
membar_producer();
ddi_report_dev(devi);
lockstat_devi = devi;
return (DDI_SUCCESS);
}
static int
lockstat_detach(dev_info_t *devi, ddi_detach_cmd_t cmd)
{
switch (cmd) {
case DDI_DETACH:
break;
case DDI_SUSPEND:
return (DDI_SUCCESS);
default:
return (DDI_FAILURE);
}
if (dtrace_unregister(lockstat_id) != 0)
return (DDI_FAILURE);
ddi_remove_minor_node(devi, NULL);
return (DDI_SUCCESS);
}
/*
* Configuration data structures
*/
static struct cb_ops lockstat_cb_ops = {
lockstat_open, /* open */
nodev, /* close */
nulldev, /* strategy */
nulldev, /* print */
nodev, /* dump */
nodev, /* read */
nodev, /* write */
nodev, /* ioctl */
nodev, /* devmap */
nodev, /* mmap */
nodev, /* segmap */
nochpoll, /* poll */
ddi_prop_op, /* cb_prop_op */
0, /* streamtab */
D_MP | D_NEW /* Driver compatibility flag */
};
static struct dev_ops lockstat_ops = {
DEVO_REV, /* devo_rev, */
0, /* refcnt */
lockstat_info, /* getinfo */
nulldev, /* identify */
nulldev, /* probe */
lockstat_attach, /* attach */
lockstat_detach, /* detach */
nulldev, /* reset */
&lockstat_cb_ops, /* cb_ops */
NULL, /* bus_ops */
};
static struct modldrv modldrv = {
&mod_driverops, /* Type of module. This one is a driver */
"Lock Statistics %I%", /* name of module */
&lockstat_ops, /* driver ops */
};
static struct modlinkage modlinkage = {
MODREV_1, (void *)&modldrv, NULL
};
int
_init(void)
{
return (mod_install(&modlinkage));
}
int
_fini(void)
{
return (mod_remove(&modlinkage));
}
int
_info(struct modinfo *modinfop)
{
return (mod_info(&modlinkage, modinfop));
}

View File

@ -1,576 +0,0 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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
* or http://www.opensolaris.org/os/licensing.
* 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 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/errno.h>
#include <sys/stat.h>
#include <sys/modctl.h>
#include <sys/conf.h>
#include <sys/systm.h>
#include <sys/ddi.h>
#include <sys/sunddi.h>
#include <sys/cpuvar.h>
#include <sys/kmem.h>
#include <sys/strsubr.h>
#include <sys/dtrace.h>
#include <sys/cyclic.h>
#include <sys/atomic.h>
static dev_info_t *profile_devi;
static dtrace_provider_id_t profile_id;
/*
* Regardless of platform, the stack frames look like this in the case of the
* profile provider:
*
* profile_fire
* cyclic_expire
* cyclic_fire
* [ cbe ]
* [ interrupt code ]
*
* On x86, there are five frames from the generic interrupt code; further, the
* interrupted instruction appears as its own stack frame, giving us a total of
* 10.
*
* On SPARC, the picture is further complicated because the compiler
* optimizes away tail-calls -- so the following frames are optimized away:
*
* profile_fire
* cyclic_expire
*
* This gives three frames. However, on DEBUG kernels, the cyclic_expire
* frame cannot be tail-call eliminated, yielding four frames in this case.
*
* All of the above constraints lead to the mess below. Yes, the profile
* provider should ideally figure this out on-the-fly by hitting one of its own
* probes and then walking its own stack trace. This is complicated, however,
* and the static definition doesn't seem to be overly brittle. Still, we
* allow for a manual override in case we get it completely wrong.
*/
#ifdef __x86
#define PROF_ARTIFICIAL_FRAMES 10
#else
#ifdef __sparc
#ifdef DEBUG
#define PROF_ARTIFICIAL_FRAMES 4
#else
#define PROF_ARTIFICIAL_FRAMES 3
#endif
#endif
#endif
#define PROF_NAMELEN 15
#define PROF_PROFILE 0
#define PROF_TICK 1
#define PROF_PREFIX_PROFILE "profile-"
#define PROF_PREFIX_TICK "tick-"
typedef struct profile_probe {
char prof_name[PROF_NAMELEN];
dtrace_id_t prof_id;
int prof_kind;
hrtime_t prof_interval;
cyclic_id_t prof_cyclic;
} profile_probe_t;
typedef struct profile_probe_percpu {
hrtime_t profc_expected;
hrtime_t profc_interval;
profile_probe_t *profc_probe;
} profile_probe_percpu_t;
hrtime_t profile_interval_min = NANOSEC / 5000; /* 5000 hz */
int profile_aframes = 0; /* override */
static int profile_rates[] = {
97, 199, 499, 997, 1999,
4001, 4999, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0
};
static int profile_ticks[] = {
1, 10, 100, 500, 1000,
5000, 0, 0, 0, 0,
0, 0, 0, 0, 0
};
/*
* profile_max defines the upper bound on the number of profile probes that
* can exist (this is to prevent malicious or clumsy users from exhausing
* system resources by creating a slew of profile probes). At mod load time,
* this gets its value from PROFILE_MAX_DEFAULT or profile-max-probes if it's
* present in the profile.conf file.
*/
#define PROFILE_MAX_DEFAULT 1000 /* default max. number of probes */
static uint32_t profile_max; /* maximum number of profile probes */
static uint32_t profile_total; /* current number of profile probes */
static void
profile_fire(void *arg)
{
profile_probe_percpu_t *pcpu = arg;
profile_probe_t *prof = pcpu->profc_probe;
hrtime_t late;
late = dtrace_gethrtime() - pcpu->profc_expected;
pcpu->profc_expected += pcpu->profc_interval;
dtrace_probe(prof->prof_id, CPU->cpu_profile_pc,
CPU->cpu_profile_upc, late, 0, 0);
}
static void
profile_tick(void *arg)
{
profile_probe_t *prof = arg;
dtrace_probe(prof->prof_id, CPU->cpu_profile_pc,
CPU->cpu_profile_upc, 0, 0, 0);
}
static void
profile_create(hrtime_t interval, const char *name, int kind)
{
profile_probe_t *prof;
int nr_frames = PROF_ARTIFICIAL_FRAMES + dtrace_mach_aframes();
if (profile_aframes)
nr_frames = profile_aframes;
if (interval < profile_interval_min)
return;
if (dtrace_probe_lookup(profile_id, NULL, NULL, name) != 0)
return;
atomic_add_32(&profile_total, 1);
if (profile_total > profile_max) {
atomic_add_32(&profile_total, -1);
return;
}
prof = kmem_zalloc(sizeof (profile_probe_t), KM_SLEEP);
(void) strcpy(prof->prof_name, name);
prof->prof_interval = interval;
prof->prof_cyclic = CYCLIC_NONE;
prof->prof_kind = kind;
prof->prof_id = dtrace_probe_create(profile_id,
NULL, NULL, name, nr_frames, prof);
}
/*ARGSUSED*/
static void
profile_provide(void *arg, const dtrace_probedesc_t *desc)
{
int i, j, rate, kind;
hrtime_t val = 0, mult = 1, len;
const char *name, *suffix = NULL;
const struct {
char *prefix;
int kind;
} types[] = {
{ PROF_PREFIX_PROFILE, PROF_PROFILE },
{ PROF_PREFIX_TICK, PROF_TICK },
{ NULL, NULL }
};
const struct {
char *name;
hrtime_t mult;
} suffixes[] = {
{ "ns", NANOSEC / NANOSEC },
{ "nsec", NANOSEC / NANOSEC },
{ "us", NANOSEC / MICROSEC },
{ "usec", NANOSEC / MICROSEC },
{ "ms", NANOSEC / MILLISEC },
{ "msec", NANOSEC / MILLISEC },
{ "s", NANOSEC / SEC },
{ "sec", NANOSEC / SEC },
{ "m", NANOSEC * (hrtime_t)60 },
{ "min", NANOSEC * (hrtime_t)60 },
{ "h", NANOSEC * (hrtime_t)(60 * 60) },
{ "hour", NANOSEC * (hrtime_t)(60 * 60) },
{ "d", NANOSEC * (hrtime_t)(24 * 60 * 60) },
{ "day", NANOSEC * (hrtime_t)(24 * 60 * 60) },
{ "hz", 0 },
{ NULL }
};
if (desc == NULL) {
char n[PROF_NAMELEN];
/*
* If no description was provided, provide all of our probes.
*/
for (i = 0; i < sizeof (profile_rates) / sizeof (int); i++) {
if ((rate = profile_rates[i]) == 0)
continue;
(void) snprintf(n, PROF_NAMELEN, "%s%d",
PROF_PREFIX_PROFILE, rate);
profile_create(NANOSEC / rate, n, PROF_PROFILE);
}
for (i = 0; i < sizeof (profile_ticks) / sizeof (int); i++) {
if ((rate = profile_ticks[i]) == 0)
continue;
(void) snprintf(n, PROF_NAMELEN, "%s%d",
PROF_PREFIX_TICK, rate);
profile_create(NANOSEC / rate, n, PROF_TICK);
}
return;
}
name = desc->dtpd_name;
for (i = 0; types[i].prefix != NULL; i++) {
len = strlen(types[i].prefix);
if (strncmp(name, types[i].prefix, len) != 0)
continue;
break;
}
if (types[i].prefix == NULL)
return;
kind = types[i].kind;
j = strlen(name) - len;
/*
* We need to start before any time suffix.
*/
for (j = strlen(name); j >= len; j--) {
if (name[j] >= '0' && name[j] <= '9')
break;
suffix = &name[j];
}
ASSERT(suffix != NULL);
/*
* Now determine the numerical value present in the probe name.
*/
for (; j >= len; j--) {
if (name[j] < '0' || name[j] > '9')
return;
val += (name[j] - '0') * mult;
mult *= (hrtime_t)10;
}
if (val == 0)
return;
/*
* Look-up the suffix to determine the multiplier.
*/
for (i = 0, mult = 0; suffixes[i].name != NULL; i++) {
if (strcasecmp(suffixes[i].name, suffix) == 0) {
mult = suffixes[i].mult;
break;
}
}
if (suffixes[i].name == NULL && *suffix != '\0')
return;
if (mult == 0) {
/*
* The default is frequency-per-second.
*/
val = NANOSEC / val;
} else {
val *= mult;
}
profile_create(val, name, kind);
}
/*ARGSUSED*/
static void
profile_destroy(void *arg, dtrace_id_t id, void *parg)
{
profile_probe_t *prof = parg;
ASSERT(prof->prof_cyclic == CYCLIC_NONE);
kmem_free(prof, sizeof (profile_probe_t));
ASSERT(profile_total >= 1);
atomic_add_32(&profile_total, -1);
}
/*ARGSUSED*/
static void
profile_online(void *arg, cpu_t *cpu, cyc_handler_t *hdlr, cyc_time_t *when)
{
profile_probe_t *prof = arg;
profile_probe_percpu_t *pcpu;
pcpu = kmem_zalloc(sizeof (profile_probe_percpu_t), KM_SLEEP);
pcpu->profc_probe = prof;
hdlr->cyh_func = profile_fire;
hdlr->cyh_arg = pcpu;
hdlr->cyh_level = CY_HIGH_LEVEL;
when->cyt_interval = prof->prof_interval;
when->cyt_when = dtrace_gethrtime() + when->cyt_interval;
pcpu->profc_expected = when->cyt_when;
pcpu->profc_interval = when->cyt_interval;
}
/*ARGSUSED*/
static void
profile_offline(void *arg, cpu_t *cpu, void *oarg)
{
profile_probe_percpu_t *pcpu = oarg;
ASSERT(pcpu->profc_probe == arg);
kmem_free(pcpu, sizeof (profile_probe_percpu_t));
}
/*ARGSUSED*/
static void
profile_enable(void *arg, dtrace_id_t id, void *parg)
{
profile_probe_t *prof = parg;
cyc_omni_handler_t omni;
cyc_handler_t hdlr;
cyc_time_t when;
ASSERT(prof->prof_interval != 0);
ASSERT(MUTEX_HELD(&cpu_lock));
if (prof->prof_kind == PROF_TICK) {
hdlr.cyh_func = profile_tick;
hdlr.cyh_arg = prof;
hdlr.cyh_level = CY_HIGH_LEVEL;
when.cyt_interval = prof->prof_interval;
when.cyt_when = dtrace_gethrtime() + when.cyt_interval;
} else {
ASSERT(prof->prof_kind == PROF_PROFILE);
omni.cyo_online = profile_online;
omni.cyo_offline = profile_offline;
omni.cyo_arg = prof;
}
if (prof->prof_kind == PROF_TICK) {
prof->prof_cyclic = cyclic_add(&hdlr, &when);
} else {
prof->prof_cyclic = cyclic_add_omni(&omni);
}
}
/*ARGSUSED*/
static void
profile_disable(void *arg, dtrace_id_t id, void *parg)
{
profile_probe_t *prof = parg;
ASSERT(prof->prof_cyclic != CYCLIC_NONE);
ASSERT(MUTEX_HELD(&cpu_lock));
cyclic_remove(prof->prof_cyclic);
prof->prof_cyclic = CYCLIC_NONE;
}
/*ARGSUSED*/
static int
profile_usermode(void *arg, dtrace_id_t id, void *parg)
{
return (CPU->cpu_profile_pc == 0);
}
static dtrace_pattr_t profile_attr = {
{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON },
{ DTRACE_STABILITY_UNSTABLE, DTRACE_STABILITY_UNSTABLE, DTRACE_CLASS_UNKNOWN },
{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON },
{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON },
};
static dtrace_pops_t profile_pops = {
profile_provide,
NULL,
profile_enable,
profile_disable,
NULL,
NULL,
NULL,
NULL,
profile_usermode,
profile_destroy
};
static int
profile_attach(dev_info_t *devi, ddi_attach_cmd_t cmd)
{
switch (cmd) {
case DDI_ATTACH:
break;
case DDI_RESUME:
return (DDI_SUCCESS);
default:
return (DDI_FAILURE);
}
if (ddi_create_minor_node(devi, "profile", S_IFCHR, 0,
DDI_PSEUDO, NULL) == DDI_FAILURE ||
dtrace_register("profile", &profile_attr,
DTRACE_PRIV_KERNEL | DTRACE_PRIV_USER, NULL,
&profile_pops, NULL, &profile_id) != 0) {
ddi_remove_minor_node(devi, NULL);
return (DDI_FAILURE);
}
profile_max = ddi_getprop(DDI_DEV_T_ANY, devi, DDI_PROP_DONTPASS,
"profile-max-probes", PROFILE_MAX_DEFAULT);
ddi_report_dev(devi);
profile_devi = devi;
return (DDI_SUCCESS);
}
static int
profile_detach(dev_info_t *devi, ddi_detach_cmd_t cmd)
{
switch (cmd) {
case DDI_DETACH:
break;
case DDI_SUSPEND:
return (DDI_SUCCESS);
default:
return (DDI_FAILURE);
}
if (dtrace_unregister(profile_id) != 0)
return (DDI_FAILURE);
ddi_remove_minor_node(devi, NULL);
return (DDI_SUCCESS);
}
/*ARGSUSED*/
static int
profile_info(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg, void **result)
{
int error;
switch (infocmd) {
case DDI_INFO_DEVT2DEVINFO:
*result = (void *)profile_devi;
error = DDI_SUCCESS;
break;
case DDI_INFO_DEVT2INSTANCE:
*result = (void *)0;
error = DDI_SUCCESS;
break;
default:
error = DDI_FAILURE;
}
return (error);
}
/*ARGSUSED*/
static int
profile_open(dev_t *devp, int flag, int otyp, cred_t *cred_p)
{
return (0);
}
static struct cb_ops profile_cb_ops = {
profile_open, /* open */
nodev, /* close */
nulldev, /* strategy */
nulldev, /* print */
nodev, /* dump */
nodev, /* read */
nodev, /* write */
nodev, /* ioctl */
nodev, /* devmap */
nodev, /* mmap */
nodev, /* segmap */
nochpoll, /* poll */
ddi_prop_op, /* cb_prop_op */
0, /* streamtab */
D_NEW | D_MP /* Driver compatibility flag */
};
static struct dev_ops profile_ops = {
DEVO_REV, /* devo_rev, */
0, /* refcnt */
profile_info, /* get_dev_info */
nulldev, /* identify */
nulldev, /* probe */
profile_attach, /* attach */
profile_detach, /* detach */
nodev, /* reset */
&profile_cb_ops, /* driver operations */
NULL, /* bus operations */
nodev /* dev power */
};
/*
* Module linkage information for the kernel.
*/
static struct modldrv modldrv = {
&mod_driverops, /* module type (this is a pseudo driver) */
"Profile Interrupt Tracing", /* name of module */
&profile_ops, /* driver ops */
};
static struct modlinkage modlinkage = {
MODREV_1,
(void *)&modldrv,
NULL
};
int
_init(void)
{
return (mod_install(&modlinkage));
}
int
_info(struct modinfo *modinfop)
{
return (mod_info(&modlinkage, modinfop));
}
int
_fini(void)
{
return (mod_remove(&modlinkage));
}

View File

@ -1,888 +0,0 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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
* or http://www.opensolaris.org/os/licensing.
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/sdt_impl.h>
static dtrace_pattr_t vtrace_attr = {
{ DTRACE_STABILITY_UNSTABLE, DTRACE_STABILITY_UNSTABLE, DTRACE_CLASS_ISA },
{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
{ DTRACE_STABILITY_UNSTABLE, DTRACE_STABILITY_UNSTABLE, DTRACE_CLASS_ISA },
};
static dtrace_pattr_t info_attr = {
{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA },
{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA },
{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA },
};
static dtrace_pattr_t fpu_attr = {
{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA },
{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_CPU },
{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA },
};
static dtrace_pattr_t fsinfo_attr = {
{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA },
{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA },
};
static dtrace_pattr_t stab_attr = {
{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA },
{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA },
{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA },
};
static dtrace_pattr_t sdt_attr = {
{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA },
{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA },
{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA },
};
static dtrace_pattr_t xpv_attr = {
{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_PLATFORM },
{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_PLATFORM },
{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_PLATFORM },
};
sdt_provider_t sdt_providers[] = {
{ "vtrace", "__vtrace_", &vtrace_attr, 0 },
{ "sysinfo", "__cpu_sysinfo_", &info_attr, 0 },
{ "vminfo", "__cpu_vminfo_", &info_attr, 0 },
{ "fpuinfo", "__fpuinfo_", &fpu_attr, 0 },
{ "sched", "__sched_", &stab_attr, 0 },
{ "proc", "__proc_", &stab_attr, 0 },
{ "io", "__io_", &stab_attr, 0 },
{ "mib", "__mib_", &stab_attr, 0 },
{ "fsinfo", "__fsinfo_", &fsinfo_attr, 0 },
{ "nfsv3", "__nfsv3_", &stab_attr, 0 },
{ "nfsv4", "__nfsv4_", &stab_attr, 0 },
{ "xpv", "__xpv_", &xpv_attr, 0 },
{ "sysevent", "__sysevent_", &stab_attr, 0 },
{ "sdt", NULL, &sdt_attr, 0 },
{ NULL }
};
sdt_argdesc_t sdt_args[] = {
{ "sched", "wakeup", 0, 0, "kthread_t *", "lwpsinfo_t *" },
{ "sched", "wakeup", 1, 0, "kthread_t *", "psinfo_t *" },
{ "sched", "dequeue", 0, 0, "kthread_t *", "lwpsinfo_t *" },
{ "sched", "dequeue", 1, 0, "kthread_t *", "psinfo_t *" },
{ "sched", "dequeue", 2, 1, "disp_t *", "cpuinfo_t *" },
{ "sched", "enqueue", 0, 0, "kthread_t *", "lwpsinfo_t *" },
{ "sched", "enqueue", 1, 0, "kthread_t *", "psinfo_t *" },
{ "sched", "enqueue", 2, 1, "disp_t *", "cpuinfo_t *" },
{ "sched", "enqueue", 3, 2, "int" },
{ "sched", "off-cpu", 0, 0, "kthread_t *", "lwpsinfo_t *" },
{ "sched", "off-cpu", 1, 0, "kthread_t *", "psinfo_t *" },
{ "sched", "tick", 0, 0, "kthread_t *", "lwpsinfo_t *" },
{ "sched", "tick", 1, 0, "kthread_t *", "psinfo_t *" },
{ "sched", "change-pri", 0, 0, "kthread_t *", "lwpsinfo_t *" },
{ "sched", "change-pri", 1, 0, "kthread_t *", "psinfo_t *" },
{ "sched", "change-pri", 2, 1, "pri_t" },
{ "sched", "schedctl-nopreempt", 0, 0, "kthread_t *", "lwpsinfo_t *" },
{ "sched", "schedctl-nopreempt", 1, 0, "kthread_t *", "psinfo_t *" },
{ "sched", "schedctl-nopreempt", 2, 1, "int" },
{ "sched", "schedctl-preempt", 0, 0, "kthread_t *", "lwpsinfo_t *" },
{ "sched", "schedctl-preempt", 1, 0, "kthread_t *", "psinfo_t *" },
{ "sched", "schedctl-yield", 0, 0, "int" },
{ "sched", "surrender", 0, 0, "kthread_t *", "lwpsinfo_t *" },
{ "sched", "surrender", 1, 0, "kthread_t *", "psinfo_t *" },
{ "sched", "cpucaps-sleep", 0, 0, "kthread_t *", "lwpsinfo_t *" },
{ "sched", "cpucaps-sleep", 1, 0, "kthread_t *", "psinfo_t *" },
{ "sched", "cpucaps-wakeup", 0, 0, "kthread_t *", "lwpsinfo_t *" },
{ "sched", "cpucaps-wakeup", 1, 0, "kthread_t *", "psinfo_t *" },
{ "proc", "create", 0, 0, "proc_t *", "psinfo_t *" },
{ "proc", "exec", 0, 0, "string" },
{ "proc", "exec-failure", 0, 0, "int" },
{ "proc", "exit", 0, 0, "int" },
{ "proc", "fault", 0, 0, "int" },
{ "proc", "fault", 1, 1, "siginfo_t *" },
{ "proc", "lwp-create", 0, 0, "kthread_t *", "lwpsinfo_t *" },
{ "proc", "lwp-create", 1, 0, "kthread_t *", "psinfo_t *" },
{ "proc", "signal-clear", 0, 0, "int" },
{ "proc", "signal-clear", 1, 1, "siginfo_t *" },
{ "proc", "signal-discard", 0, 0, "kthread_t *", "lwpsinfo_t *" },
{ "proc", "signal-discard", 1, 1, "proc_t *", "psinfo_t *" },
{ "proc", "signal-discard", 2, 2, "int" },
{ "proc", "signal-handle", 0, 0, "int" },
{ "proc", "signal-handle", 1, 1, "siginfo_t *" },
{ "proc", "signal-handle", 2, 2, "void (*)(void)" },
{ "proc", "signal-send", 0, 0, "kthread_t *", "lwpsinfo_t *" },
{ "proc", "signal-send", 1, 0, "kthread_t *", "psinfo_t *" },
{ "proc", "signal-send", 2, 1, "int" },
{ "io", "start", 0, 0, "buf_t *", "bufinfo_t *" },
{ "io", "start", 1, 0, "buf_t *", "devinfo_t *" },
{ "io", "start", 2, 0, "buf_t *", "fileinfo_t *" },
{ "io", "done", 0, 0, "buf_t *", "bufinfo_t *" },
{ "io", "done", 1, 0, "buf_t *", "devinfo_t *" },
{ "io", "done", 2, 0, "buf_t *", "fileinfo_t *" },
{ "io", "wait-start", 0, 0, "buf_t *", "bufinfo_t *" },
{ "io", "wait-start", 1, 0, "buf_t *", "devinfo_t *" },
{ "io", "wait-start", 2, 0, "buf_t *", "fileinfo_t *" },
{ "io", "wait-done", 0, 0, "buf_t *", "bufinfo_t *" },
{ "io", "wait-done", 1, 0, "buf_t *", "devinfo_t *" },
{ "io", "wait-done", 2, 0, "buf_t *", "fileinfo_t *" },
{ "mib", NULL, 0, 0, "int" },
{ "fsinfo", NULL, 0, 0, "vnode_t *", "fileinfo_t *" },
{ "fsinfo", NULL, 1, 1, "int", "int" },
{ "nfsv3", "op-getattr-start", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-getattr-start", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-getattr-start", 2, 3, "GETATTR3args *" },
{ "nfsv3", "op-getattr-done", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-getattr-done", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-getattr-done", 2, 3, "GETATTR3res *" },
{ "nfsv3", "op-setattr-start", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-setattr-start", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-setattr-start", 2, 3, "SETATTR3args *" },
{ "nfsv3", "op-setattr-done", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-setattr-done", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-setattr-done", 2, 3, "SETATTR3res *" },
{ "nfsv3", "op-lookup-start", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-lookup-start", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-lookup-start", 2, 3, "LOOKUP3args *" },
{ "nfsv3", "op-lookup-done", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-lookup-done", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-lookup-done", 2, 3, "LOOKUP3res *" },
{ "nfsv3", "op-access-start", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-access-start", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-access-start", 2, 3, "ACCESS3args *" },
{ "nfsv3", "op-access-done", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-access-done", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-access-done", 2, 3, "ACCESS3res *" },
{ "nfsv3", "op-commit-start", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-commit-start", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-commit-start", 2, 3, "COMMIT3args *" },
{ "nfsv3", "op-commit-done", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-commit-done", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-commit-done", 2, 3, "COMMIT3res *" },
{ "nfsv3", "op-create-start", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-create-start", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-create-start", 2, 3, "CREATE3args *" },
{ "nfsv3", "op-create-done", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-create-done", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-create-done", 2, 3, "CREATE3res *" },
{ "nfsv3", "op-fsinfo-start", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-fsinfo-start", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-fsinfo-start", 2, 3, "FSINFO3args *" },
{ "nfsv3", "op-fsinfo-done", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-fsinfo-done", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-fsinfo-done", 2, 3, "FSINFO3res *" },
{ "nfsv3", "op-fsstat-start", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-fsstat-start", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-fsstat-start", 2, 3, "FSSTAT3args *" },
{ "nfsv3", "op-fsstat-done", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-fsstat-done", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-fsstat-done", 2, 3, "FSSTAT3res *" },
{ "nfsv3", "op-link-start", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-link-start", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-link-start", 2, 3, "LINK3args *" },
{ "nfsv3", "op-link-done", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-link-done", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-link-done", 2, 3, "LINK3res *" },
{ "nfsv3", "op-mkdir-start", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-mkdir-start", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-mkdir-start", 2, 3, "MKDIR3args *" },
{ "nfsv3", "op-mkdir-done", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-mkdir-done", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-mkdir-done", 2, 3, "MKDIR3res *" },
{ "nfsv3", "op-mknod-start", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-mknod-start", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-mknod-start", 2, 3, "MKNOD3args *" },
{ "nfsv3", "op-mknod-done", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-mknod-done", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-mknod-done", 2, 3, "MKNOD3res *" },
{ "nfsv3", "op-null-start", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-null-start", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-null-done", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-null-done", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-pathconf-start", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-pathconf-start", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-pathconf-start", 2, 3, "PATHCONF3args *" },
{ "nfsv3", "op-pathconf-done", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-pathconf-done", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-pathconf-done", 2, 3, "PATHCONF3res *" },
{ "nfsv3", "op-read-start", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-read-start", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-read-start", 2, 3, "READ3args *" },
{ "nfsv3", "op-read-done", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-read-done", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-read-done", 2, 3, "READ3res *" },
{ "nfsv3", "op-readdir-start", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-readdir-start", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-readdir-start", 2, 3, "READDIR3args *" },
{ "nfsv3", "op-readdir-done", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-readdir-done", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-readdir-done", 2, 3, "READDIR3res *" },
{ "nfsv3", "op-readdirplus-start", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-readdirplus-start", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-readdirplus-start", 2, 3, "READDIRPLUS3args *" },
{ "nfsv3", "op-readdirplus-done", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-readdirplus-done", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-readdirplus-done", 2, 3, "READDIRPLUS3res *" },
{ "nfsv3", "op-readlink-start", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-readlink-start", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-readlink-start", 2, 3, "READLINK3args *" },
{ "nfsv3", "op-readlink-done", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-readlink-done", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-readlink-done", 2, 3, "READLINK3res *" },
{ "nfsv3", "op-remove-start", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-remove-start", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-remove-start", 2, 3, "REMOVE3args *" },
{ "nfsv3", "op-remove-done", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-remove-done", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-remove-done", 2, 3, "REMOVE3res *" },
{ "nfsv3", "op-rename-start", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-rename-start", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-rename-start", 2, 3, "RENAME3args *" },
{ "nfsv3", "op-rename-done", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-rename-done", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-rename-done", 2, 3, "RENAME3res *" },
{ "nfsv3", "op-rmdir-start", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-rmdir-start", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-rmdir-start", 2, 3, "RMDIR3args *" },
{ "nfsv3", "op-rmdir-done", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-rmdir-done", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-rmdir-done", 2, 3, "RMDIR3res *" },
{ "nfsv3", "op-setattr-start", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-setattr-start", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-setattr-start", 2, 3, "SETATTR3args *" },
{ "nfsv3", "op-setattr-done", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-setattr-done", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-setattr-done", 2, 3, "SETATTR3res *" },
{ "nfsv3", "op-symlink-start", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-symlink-start", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-symlink-start", 2, 3, "SYMLINK3args *" },
{ "nfsv3", "op-symlink-done", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-symlink-done", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-symlink-done", 2, 3, "SYMLINK3res *" },
{ "nfsv3", "op-write-start", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-write-start", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-write-start", 2, 3, "WRITE3args *" },
{ "nfsv3", "op-write-done", 0, 0, "struct svc_req *",
"conninfo_t *" },
{ "nfsv3", "op-write-done", 1, 1, "nfsv3oparg_t *",
"nfsv3opinfo_t *" },
{ "nfsv3", "op-write-done", 2, 3, "WRITE3res *" },
{ "nfsv4", "null-start", 0, 0, "struct svc_req *", "conninfo_t *" },
{ "nfsv4", "null-done", 0, 0, "struct svc_req *", "conninfo_t *" },
{ "nfsv4", "compound-start", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "compound-start", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "compound-start", 2, 1, "COMPOUND4args *" },
{ "nfsv4", "compound-done", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "compound-done", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "compound-done", 2, 1, "COMPOUND4res *" },
{ "nfsv4", "op-access-start", 0, 0, "struct compound_state *",
"conninfo_t *"},
{ "nfsv4", "op-access-start", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-access-start", 2, 1, "ACCESS4args *" },
{ "nfsv4", "op-access-done", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-access-done", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-access-done", 2, 1, "ACCESS4res *" },
{ "nfsv4", "op-close-start", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-close-start", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-close-start", 2, 1, "CLOSE4args *" },
{ "nfsv4", "op-close-done", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-close-done", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-close-done", 2, 1, "CLOSE4res *" },
{ "nfsv4", "op-commit-start", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-commit-start", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-commit-start", 2, 1, "COMMIT4args *" },
{ "nfsv4", "op-commit-done", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-commit-done", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-commit-done", 2, 1, "COMMIT4res *" },
{ "nfsv4", "op-create-start", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-create-start", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-create-start", 2, 1, "CREATE4args *" },
{ "nfsv4", "op-create-done", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-create-done", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-create-done", 2, 1, "CREATE4res *" },
{ "nfsv4", "op-delegpurge-start", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-delegpurge-start", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-delegpurge-start", 2, 1, "DELEGPURGE4args *" },
{ "nfsv4", "op-delegpurge-done", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-delegpurge-done", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-delegpurge-done", 2, 1, "DELEGPURGE4res *" },
{ "nfsv4", "op-delegreturn-start", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-delegreturn-start", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-delegreturn-start", 2, 1, "DELEGRETURN4args *" },
{ "nfsv4", "op-delegreturn-done", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-delegreturn-done", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-delegreturn-done", 2, 1, "DELEGRETURN4res *" },
{ "nfsv4", "op-getattr-start", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-getattr-start", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-getattr-start", 2, 1, "GETATTR4args *" },
{ "nfsv4", "op-getattr-done", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-getattr-done", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-getattr-done", 2, 1, "GETATTR4res *" },
{ "nfsv4", "op-getfh-start", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-getfh-start", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-getfh-done", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-getfh-done", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-getfh-done", 2, 1, "GETFH4res *" },
{ "nfsv4", "op-link-start", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-link-start", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-link-start", 2, 1, "LINK4args *" },
{ "nfsv4", "op-link-done", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-link-done", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-link-done", 2, 1, "LINK4res *" },
{ "nfsv4", "op-lock-start", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-lock-start", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-lock-start", 2, 1, "LOCK4args *" },
{ "nfsv4", "op-lock-done", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-lock-done", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-lock-done", 2, 1, "LOCK4res *" },
{ "nfsv4", "op-lockt-start", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-lockt-start", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-lockt-start", 2, 1, "LOCKT4args *" },
{ "nfsv4", "op-lockt-done", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-lockt-done", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-lockt-done", 2, 1, "LOCKT4res *" },
{ "nfsv4", "op-locku-start", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-locku-start", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-locku-start", 2, 1, "LOCKU4args *" },
{ "nfsv4", "op-locku-done", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-locku-done", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-locku-done", 2, 1, "LOCKU4res *" },
{ "nfsv4", "op-lookup-start", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-lookup-start", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-lookup-start", 2, 1, "LOOKUP4args *" },
{ "nfsv4", "op-lookup-done", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-lookup-done", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-lookup-done", 2, 1, "LOOKUP4res *" },
{ "nfsv4", "op-lookupp-start", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-lookupp-start", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-lookupp-done", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-lookupp-done", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-lookupp-done", 2, 1, "LOOKUPP4res *" },
{ "nfsv4", "op-nverify-start", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-nverify-start", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-nverify-start", 2, 1, "NVERIFY4args *" },
{ "nfsv4", "op-nverify-done", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-nverify-done", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-nverify-done", 2, 1, "NVERIFY4res *" },
{ "nfsv4", "op-open-start", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-open-start", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-open-start", 2, 1, "OPEN4args *" },
{ "nfsv4", "op-open-done", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-open-done", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-open-done", 2, 1, "OPEN4res *" },
{ "nfsv4", "op-open-confirm-start", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-open-confirm-start", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-open-confirm-start", 2, 1, "OPEN_CONFIRM4args *" },
{ "nfsv4", "op-open-confirm-done", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-open-confirm-done", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-open-confirm-done", 2, 1, "OPEN_CONFIRM4res *" },
{ "nfsv4", "op-open-downgrade-start", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-open-downgrade-start", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-open-downgrade-start", 2, 1, "OPEN_DOWNGRADE4args *" },
{ "nfsv4", "op-open-downgrade-done", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-open-downgrade-done", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-open-downgrade-done", 2, 1, "OPEN_DOWNGRADE4res *" },
{ "nfsv4", "op-openattr-start", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-openattr-start", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-openattr-start", 2, 1, "OPENATTR4args *" },
{ "nfsv4", "op-openattr-done", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-openattr-done", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-openattr-done", 2, 1, "OPENATTR4res *" },
{ "nfsv4", "op-putfh-start", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-putfh-start", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-putfh-start", 2, 1, "PUTFH4args *" },
{ "nfsv4", "op-putfh-done", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-putfh-done", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-putfh-done", 2, 1, "PUTFH4res *" },
{ "nfsv4", "op-putpubfh-start", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-putpubfh-start", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-putpubfh-done", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-putpubfh-done", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-putpubfh-done", 2, 1, "PUTPUBFH4res *" },
{ "nfsv4", "op-putrootfh-start", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-putrootfh-start", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-putrootfh-done", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-putrootfh-done", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-putrootfh-done", 2, 1, "PUTROOTFH4res *" },
{ "nfsv4", "op-read-start", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-read-start", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-read-start", 2, 1, "READ4args *" },
{ "nfsv4", "op-read-done", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-read-done", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-read-done", 2, 1, "READ4res *" },
{ "nfsv4", "op-readdir-start", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-readdir-start", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-readdir-start", 2, 1, "READDIR4args *" },
{ "nfsv4", "op-readdir-done", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-readdir-done", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-readdir-done", 2, 1, "READDIR4res *" },
{ "nfsv4", "op-readlink-start", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-readlink-start", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-readlink-done", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-readlink-done", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-readlink-done", 2, 1, "READLINK4res *" },
{ "nfsv4", "op-release-lockowner-start", 0, 0,
"struct compound_state *", "conninfo_t *" },
{ "nfsv4", "op-release-lockowner-start", 1, 0,
"struct compound_state *", "nfsv4opinfo_t *" },
{ "nfsv4", "op-release-lockowner-start", 2, 1,
"RELEASE_LOCKOWNER4args *" },
{ "nfsv4", "op-release-lockowner-done", 0, 0,
"struct compound_state *", "conninfo_t *" },
{ "nfsv4", "op-release-lockowner-done", 1, 0,
"struct compound_state *", "nfsv4opinfo_t *" },
{ "nfsv4", "op-release-lockowner-done", 2, 1,
"RELEASE_LOCKOWNER4res *" },
{ "nfsv4", "op-remove-start", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-remove-start", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-remove-start", 2, 1, "REMOVE4args *" },
{ "nfsv4", "op-remove-done", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-remove-done", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-remove-done", 2, 1, "REMOVE4res *" },
{ "nfsv4", "op-rename-start", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-rename-start", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-rename-start", 2, 1, "RENAME4args *" },
{ "nfsv4", "op-rename-done", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-rename-done", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-rename-done", 2, 1, "RENAME4res *" },
{ "nfsv4", "op-renew-start", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-renew-start", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-renew-start", 2, 1, "RENEW4args *" },
{ "nfsv4", "op-renew-done", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-renew-done", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-renew-done", 2, 1, "RENEW4res *" },
{ "nfsv4", "op-restorefh-start", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-restorefh-start", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-restorefh-done", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-restorefh-done", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-restorefh-done", 2, 1, "RESTOREFH4res *" },
{ "nfsv4", "op-savefh-start", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-savefh-start", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-savefh-done", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-savefh-done", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-savefh-done", 2, 1, "SAVEFH4res *" },
{ "nfsv4", "op-secinfo-start", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-secinfo-start", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-secinfo-start", 2, 1, "SECINFO4args *" },
{ "nfsv4", "op-secinfo-done", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-secinfo-done", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-secinfo-done", 2, 1, "SECINFO4res *" },
{ "nfsv4", "op-setattr-start", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-setattr-start", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-setattr-start", 2, 1, "SETATTR4args *" },
{ "nfsv4", "op-setattr-done", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-setattr-done", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-setattr-done", 2, 1, "SETATTR4res *" },
{ "nfsv4", "op-setclientid-start", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-setclientid-start", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-setclientid-start", 2, 1, "SETCLIENTID4args *" },
{ "nfsv4", "op-setclientid-done", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-setclientid-done", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-setclientid-done", 2, 1, "SETCLIENTID4res *" },
{ "nfsv4", "op-setclientid-confirm-start", 0, 0,
"struct compound_state *", "conninfo_t *" },
{ "nfsv4", "op-setclientid-confirm-start", 1, 0,
"struct compound_state *", "nfsv4opinfo_t *" },
{ "nfsv4", "op-setclientid-confirm-start", 2, 1,
"SETCLIENTID_CONFIRM4args *" },
{ "nfsv4", "op-setclientid-confirm-done", 0, 0,
"struct compound_state *", "conninfo_t *" },
{ "nfsv4", "op-setclientid-confirm-done", 1, 0,
"struct compound_state *", "nfsv4opinfo_t *" },
{ "nfsv4", "op-setclientid-confirm-done", 2, 1,
"SETCLIENTID_CONFIRM4res *" },
{ "nfsv4", "op-verify-start", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-verify-start", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-verify-start", 2, 1, "VERIFY4args *" },
{ "nfsv4", "op-verify-done", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-verify-done", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-verify-done", 2, 1, "VERIFY4res *" },
{ "nfsv4", "op-write-start", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-write-start", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-write-start", 2, 1, "WRITE4args *" },
{ "nfsv4", "op-write-done", 0, 0, "struct compound_state *",
"conninfo_t *" },
{ "nfsv4", "op-write-done", 1, 0, "struct compound_state *",
"nfsv4opinfo_t *" },
{ "nfsv4", "op-write-done", 2, 1, "WRITE4res *" },
{ "nfsv4", "cb-recall-start", 0, 0, "rfs4_client_t *",
"conninfo_t *" },
{ "nfsv4", "cb-recall-start", 1, 1, "rfs4_deleg_state_t *",
"nfsv4cbinfo_t *" },
{ "nfsv4", "cb-recall-start", 2, 2, "CB_RECALL4args *" },
{ "nfsv4", "cb-recall-done", 0, 0, "rfs4_client_t *",
"conninfo_t *" },
{ "nfsv4", "cb-recall-done", 1, 1, "rfs4_deleg_state_t *",
"nfsv4cbinfo_t *" },
{ "nfsv4", "cb-recall-done", 2, 2, "CB_RECALL4res *" },
{ "sysevent", "post", 0, 0, "evch_bind_t *", "syseventchaninfo_t *" },
{ "sysevent", "post", 1, 1, "sysevent_impl_t *", "syseventinfo_t *" },
{ "xpv", "add-to-physmap-end", 0, 0, "int" },
{ "xpv", "add-to-physmap-start", 0, 0, "domid_t" },
{ "xpv", "add-to-physmap-start", 1, 1, "uint_t" },
{ "xpv", "add-to-physmap-start", 2, 2, "ulong_t" },
{ "xpv", "add-to-physmap-start", 3, 3, "ulong_t" },
{ "xpv", "decrease-reservation-end", 0, 0, "int" },
{ "xpv", "decrease-reservation-start", 0, 0, "domid_t" },
{ "xpv", "decrease-reservation-start", 1, 1, "ulong_t" },
{ "xpv", "decrease-reservation-start", 2, 2, "uint_t" },
{ "xpv", "decrease-reservation-start", 3, 3, "ulong_t *" },
{ "xpv", "dom-create-start", 0, 0, "xen_domctl_t *" },
{ "xpv", "dom-destroy-start", 0, 0, "domid_t" },
{ "xpv", "dom-pause-start", 0, 0, "domid_t" },
{ "xpv", "dom-unpause-start", 0, 0, "domid_t" },
{ "xpv", "dom-create-end", 0, 0, "int" },
{ "xpv", "dom-destroy-end", 0, 0, "int" },
{ "xpv", "dom-pause-end", 0, 0, "int" },
{ "xpv", "dom-unpause-end", 0, 0, "int" },
{ "xpv", "evtchn-op-end", 0, 0, "int" },
{ "xpv", "evtchn-op-start", 0, 0, "int" },
{ "xpv", "evtchn-op-start", 1, 1, "void *" },
{ "xpv", "increase-reservation-end", 0, 0, "int" },
{ "xpv", "increase-reservation-start", 0, 0, "domid_t" },
{ "xpv", "increase-reservation-start", 1, 1, "ulong_t" },
{ "xpv", "increase-reservation-start", 2, 2, "uint_t" },
{ "xpv", "increase-reservation-start", 3, 3, "ulong_t *" },
{ "xpv", "mmap-end", 0, 0, "int" },
{ "xpv", "mmap-entry", 0, 0, "ulong_t" },
{ "xpv", "mmap-entry", 1, 1, "ulong_t" },
{ "xpv", "mmap-entry", 2, 2, "ulong_t" },
{ "xpv", "mmap-start", 0, 0, "domid_t" },
{ "xpv", "mmap-start", 1, 1, "int" },
{ "xpv", "mmap-start", 2, 2, "privcmd_mmap_entry_t *" },
{ "xpv", "mmapbatch-end", 0, 0, "int" },
{ "xpv", "mmapbatch-end", 1, 1, "struct seg *" },
{ "xpv", "mmapbatch-end", 2, 2, "caddr_t" },
{ "xpv", "mmapbatch-start", 0, 0, "domid_t" },
{ "xpv", "mmapbatch-start", 1, 1, "int" },
{ "xpv", "mmapbatch-start", 2, 2, "caddr_t" },
{ "xpv", "mmu-ext-op-end", 0, 0, "int" },
{ "xpv", "mmu-ext-op-start", 0, 0, "int" },
{ "xpv", "mmu-ext-op-start", 1, 1, "struct mmuext_op *" },
{ "xpv", "mmu-update-start", 0, 0, "int" },
{ "xpv", "mmu-update-start", 1, 1, "int" },
{ "xpv", "mmu-update-start", 2, 2, "mmu_update_t *" },
{ "xpv", "mmu-update-end", 0, 0, "int" },
{ "xpv", "populate-physmap-end", 0, 0, "int" },
{ "xpv", "populate-physmap-start", 0, 0, "domid_t" },
{ "xpv", "populate-physmap-start", 1, 1, "ulong_t" },
{ "xpv", "populate-physmap-start", 2, 2, "ulong_t *" },
{ "xpv", "set-memory-map-end", 0, 0, "int" },
{ "xpv", "set-memory-map-start", 0, 0, "domid_t" },
{ "xpv", "set-memory-map-start", 1, 1, "int" },
{ "xpv", "set-memory-map-start", 2, 2, "struct xen_memory_map *" },
{ "xpv", "setvcpucontext-end", 0, 0, "int" },
{ "xpv", "setvcpucontext-start", 0, 0, "domid_t" },
{ "xpv", "setvcpucontext-start", 1, 1, "vcpu_guest_context_t *" },
{ NULL }
};
/*ARGSUSED*/
void
sdt_getargdesc(void *arg, dtrace_id_t id, void *parg, dtrace_argdesc_t *desc)
{
sdt_probe_t *sdp = parg;
int i;
desc->dtargd_native[0] = '\0';
desc->dtargd_xlate[0] = '\0';
for (i = 0; sdt_args[i].sda_provider != NULL; i++) {
sdt_argdesc_t *a = &sdt_args[i];
if (strcmp(sdp->sdp_provider->sdtp_name, a->sda_provider) != 0)
continue;
if (a->sda_name != NULL &&
strcmp(sdp->sdp_name, a->sda_name) != 0)
continue;
if (desc->dtargd_ndx != a->sda_ndx)
continue;
if (a->sda_native != NULL)
(void) strcpy(desc->dtargd_native, a->sda_native);
if (a->sda_xlate != NULL)
(void) strcpy(desc->dtargd_xlate, a->sda_xlate);
desc->dtargd_mapping = a->sda_mapping;
return;
}
desc->dtargd_ndx = DTRACE_ARGNONE;
}

View File

@ -1,373 +0,0 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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
* or http://www.opensolaris.org/os/licensing.
* 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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/dtrace.h>
#include <sys/systrace.h>
#include <sys/stat.h>
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/ddi.h>
#include <sys/sunddi.h>
#include <sys/atomic.h>
#define SYSTRACE_ARTIFICIAL_FRAMES 1
#define SYSTRACE_SHIFT 16
#define SYSTRACE_ISENTRY(x) ((int)(x) >> SYSTRACE_SHIFT)
#define SYSTRACE_SYSNUM(x) ((int)(x) & ((1 << SYSTRACE_SHIFT) - 1))
#define SYSTRACE_ENTRY(id) ((1 << SYSTRACE_SHIFT) | (id))
#define SYSTRACE_RETURN(id) (id)
#if ((1 << SYSTRACE_SHIFT) <= NSYSCALL)
#error 1 << SYSTRACE_SHIFT must exceed number of system calls
#endif
static dev_info_t *systrace_devi;
static dtrace_provider_id_t systrace_id;
static void
systrace_init(struct sysent *actual, systrace_sysent_t **interposed)
{
systrace_sysent_t *sysent = *interposed;
int i;
if (sysent == NULL) {
*interposed = sysent = kmem_zalloc(sizeof (systrace_sysent_t) *
NSYSCALL, KM_SLEEP);
}
for (i = 0; i < NSYSCALL; i++) {
struct sysent *a = &actual[i];
systrace_sysent_t *s = &sysent[i];
if (LOADABLE_SYSCALL(a) && !LOADED_SYSCALL(a))
continue;
if (a->sy_callc == dtrace_systrace_syscall)
continue;
#ifdef _SYSCALL32_IMPL
if (a->sy_callc == dtrace_systrace_syscall32)
continue;
#endif
s->stsy_underlying = a->sy_callc;
}
}
/*ARGSUSED*/
static void
systrace_provide(void *arg, const dtrace_probedesc_t *desc)
{
int i;
if (desc != NULL)
return;
systrace_init(sysent, &systrace_sysent);
#ifdef _SYSCALL32_IMPL
systrace_init(sysent32, &systrace_sysent32);
#endif
for (i = 0; i < NSYSCALL; i++) {
if (systrace_sysent[i].stsy_underlying == NULL)
continue;
if (dtrace_probe_lookup(systrace_id, NULL,
syscallnames[i], "entry") != 0)
continue;
(void) dtrace_probe_create(systrace_id, NULL, syscallnames[i],
"entry", SYSTRACE_ARTIFICIAL_FRAMES,
(void *)((uintptr_t)SYSTRACE_ENTRY(i)));
(void) dtrace_probe_create(systrace_id, NULL, syscallnames[i],
"return", SYSTRACE_ARTIFICIAL_FRAMES,
(void *)((uintptr_t)SYSTRACE_RETURN(i)));
systrace_sysent[i].stsy_entry = DTRACE_IDNONE;
systrace_sysent[i].stsy_return = DTRACE_IDNONE;
#ifdef _SYSCALL32_IMPL
systrace_sysent32[i].stsy_entry = DTRACE_IDNONE;
systrace_sysent32[i].stsy_return = DTRACE_IDNONE;
#endif
}
}
/*ARGSUSED*/
static void
systrace_destroy(void *arg, dtrace_id_t id, void *parg)
{
int sysnum = SYSTRACE_SYSNUM((uintptr_t)parg);
/*
* There's nothing to do here but assert that we have actually been
* disabled.
*/
if (SYSTRACE_ISENTRY((uintptr_t)parg)) {
ASSERT(systrace_sysent[sysnum].stsy_entry == DTRACE_IDNONE);
#ifdef _SYSCALL32_IMPL
ASSERT(systrace_sysent32[sysnum].stsy_entry == DTRACE_IDNONE);
#endif
} else {
ASSERT(systrace_sysent[sysnum].stsy_return == DTRACE_IDNONE);
#ifdef _SYSCALL32_IMPL
ASSERT(systrace_sysent32[sysnum].stsy_return == DTRACE_IDNONE);
#endif
}
}
/*ARGSUSED*/
static void
systrace_enable(void *arg, dtrace_id_t id, void *parg)
{
int sysnum = SYSTRACE_SYSNUM((uintptr_t)parg);
int enabled = (systrace_sysent[sysnum].stsy_entry != DTRACE_IDNONE ||
systrace_sysent[sysnum].stsy_return != DTRACE_IDNONE);
if (SYSTRACE_ISENTRY((uintptr_t)parg)) {
systrace_sysent[sysnum].stsy_entry = id;
#ifdef _SYSCALL32_IMPL
systrace_sysent32[sysnum].stsy_entry = id;
#endif
} else {
systrace_sysent[sysnum].stsy_return = id;
#ifdef _SYSCALL32_IMPL
systrace_sysent32[sysnum].stsy_return = id;
#endif
}
if (enabled) {
ASSERT(sysent[sysnum].sy_callc == dtrace_systrace_syscall);
return;
}
(void) casptr(&sysent[sysnum].sy_callc,
(void *)systrace_sysent[sysnum].stsy_underlying,
(void *)dtrace_systrace_syscall);
#ifdef _SYSCALL32_IMPL
(void) casptr(&sysent32[sysnum].sy_callc,
(void *)systrace_sysent32[sysnum].stsy_underlying,
(void *)dtrace_systrace_syscall32);
#endif
}
/*ARGSUSED*/
static void
systrace_disable(void *arg, dtrace_id_t id, void *parg)
{
int sysnum = SYSTRACE_SYSNUM((uintptr_t)parg);
int disable = (systrace_sysent[sysnum].stsy_entry == DTRACE_IDNONE ||
systrace_sysent[sysnum].stsy_return == DTRACE_IDNONE);
if (disable) {
(void) casptr(&sysent[sysnum].sy_callc,
(void *)dtrace_systrace_syscall,
(void *)systrace_sysent[sysnum].stsy_underlying);
#ifdef _SYSCALL32_IMPL
(void) casptr(&sysent32[sysnum].sy_callc,
(void *)dtrace_systrace_syscall32,
(void *)systrace_sysent32[sysnum].stsy_underlying);
#endif
}
if (SYSTRACE_ISENTRY((uintptr_t)parg)) {
systrace_sysent[sysnum].stsy_entry = DTRACE_IDNONE;
#ifdef _SYSCALL32_IMPL
systrace_sysent32[sysnum].stsy_entry = DTRACE_IDNONE;
#endif
} else {
systrace_sysent[sysnum].stsy_return = DTRACE_IDNONE;
#ifdef _SYSCALL32_IMPL
systrace_sysent32[sysnum].stsy_return = DTRACE_IDNONE;
#endif
}
}
static dtrace_pattr_t systrace_attr = {
{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON },
{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA },
{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON },
{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA },
};
static dtrace_pops_t systrace_pops = {
systrace_provide,
NULL,
systrace_enable,
systrace_disable,
NULL,
NULL,
NULL,
NULL,
NULL,
systrace_destroy
};
static int
systrace_attach(dev_info_t *devi, ddi_attach_cmd_t cmd)
{
switch (cmd) {
case DDI_ATTACH:
break;
case DDI_RESUME:
return (DDI_SUCCESS);
default:
return (DDI_FAILURE);
}
systrace_probe = (void (*)())dtrace_probe;
membar_enter();
if (ddi_create_minor_node(devi, "systrace", S_IFCHR, 0,
DDI_PSEUDO, NULL) == DDI_FAILURE ||
dtrace_register("syscall", &systrace_attr, DTRACE_PRIV_USER, NULL,
&systrace_pops, NULL, &systrace_id) != 0) {
systrace_probe = systrace_stub;
ddi_remove_minor_node(devi, NULL);
return (DDI_FAILURE);
}
ddi_report_dev(devi);
systrace_devi = devi;
return (DDI_SUCCESS);
}
static int
systrace_detach(dev_info_t *devi, ddi_detach_cmd_t cmd)
{
switch (cmd) {
case DDI_DETACH:
break;
case DDI_SUSPEND:
return (DDI_SUCCESS);
default:
return (DDI_FAILURE);
}
if (dtrace_unregister(systrace_id) != 0)
return (DDI_FAILURE);
ddi_remove_minor_node(devi, NULL);
systrace_probe = systrace_stub;
return (DDI_SUCCESS);
}
/*ARGSUSED*/
static int
systrace_info(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg, void **result)
{
int error;
switch (infocmd) {
case DDI_INFO_DEVT2DEVINFO:
*result = (void *)systrace_devi;
error = DDI_SUCCESS;
break;
case DDI_INFO_DEVT2INSTANCE:
*result = (void *)0;
error = DDI_SUCCESS;
break;
default:
error = DDI_FAILURE;
}
return (error);
}
/*ARGSUSED*/
static int
systrace_open(dev_t *devp, int flag, int otyp, cred_t *cred_p)
{
return (0);
}
static struct cb_ops systrace_cb_ops = {
systrace_open, /* open */
nodev, /* close */
nulldev, /* strategy */
nulldev, /* print */
nodev, /* dump */
nodev, /* read */
nodev, /* write */
nodev, /* ioctl */
nodev, /* devmap */
nodev, /* mmap */
nodev, /* segmap */
nochpoll, /* poll */
ddi_prop_op, /* cb_prop_op */
0, /* streamtab */
D_NEW | D_MP /* Driver compatibility flag */
};
static struct dev_ops systrace_ops = {
DEVO_REV, /* devo_rev, */
0, /* refcnt */
systrace_info, /* get_dev_info */
nulldev, /* identify */
nulldev, /* probe */
systrace_attach, /* attach */
systrace_detach, /* detach */
nodev, /* reset */
&systrace_cb_ops, /* driver operations */
NULL, /* bus operations */
nodev /* dev power */
};
/*
* Module linkage information for the kernel.
*/
static struct modldrv modldrv = {
&mod_driverops, /* module type (this is a pseudo driver) */
"System Call Tracing", /* name of module */
&systrace_ops, /* driver ops */
};
static struct modlinkage modlinkage = {
MODREV_1,
(void *)&modldrv,
NULL
};
int
_init(void)
{
return (mod_install(&modlinkage));
}
int
_info(struct modinfo *modinfop)
{
return (mod_info(&modlinkage, modinfop));
}
int
_fini(void)
{
return (mod_remove(&modlinkage));
}

View File

@ -1,128 +0,0 @@
/*
* 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
* or http://www.opensolaris.org/os/licensing.
* 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 (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_CMN_ERR_H
#define _SYS_CMN_ERR_H
#pragma ident "%Z%%M% %I% %E% SMI"
#if defined(_KERNEL) && !defined(_ASM)
#include <sys/va_list.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* Common error handling severity levels */
#define CE_CONT 0 /* continuation */
#define CE_NOTE 1 /* notice */
#define CE_WARN 2 /* warning */
#define CE_PANIC 3 /* panic */
#define CE_IGNORE 4 /* print nothing */
#ifndef _ASM
#ifdef _KERNEL
/*PRINTFLIKE2*/
extern void cmn_err(int, const char *, ...)
__KPRINTFLIKE(2);
#pragma rarely_called(cmn_err)
extern void vzcmn_err(zoneid_t, int, const char *, __va_list)
__KVPRINTFLIKE(3);
#pragma rarely_called(vzcmn_err)
extern void vcmn_err(int, const char *, __va_list)
__KVPRINTFLIKE(2);
#pragma rarely_called(vcmn_err)
/*PRINTFLIKE3*/
extern void zcmn_err(zoneid_t, int, const char *, ...)
__KPRINTFLIKE(3);
#pragma rarely_called(zcmn_err)
/*PRINTFLIKE1*/
extern void printf(const char *, ...)
__KPRINTFLIKE(1);
#pragma rarely_called(printf)
extern void vzprintf(zoneid_t, const char *, __va_list)
__KVPRINTFLIKE(2);
#pragma rarely_called(vzprintf)
/*PRINTFLIKE2*/
extern void zprintf(zoneid_t, const char *, ...)
__KPRINTFLIKE(2);
#pragma rarely_called(zprintf)
extern void vprintf(const char *, __va_list)
__KVPRINTFLIKE(1);
#pragma rarely_called(vprintf)
/*PRINTFLIKE1*/
extern void uprintf(const char *, ...)
__KPRINTFLIKE(1);
#pragma rarely_called(uprintf)
extern void vuprintf(const char *, __va_list)
__KVPRINTFLIKE(1);
#pragma rarely_called(vuprintf)
/*PRINTFLIKE3*/
extern size_t snprintf(char *, size_t, const char *, ...)
__KPRINTFLIKE(3);
extern size_t vsnprintf(char *, size_t, const char *, __va_list)
__KVPRINTFLIKE(3);
/*PRINTFLIKE2*/
extern char *sprintf(char *, const char *, ...)
__KPRINTFLIKE(2);
extern char *vsprintf(char *, const char *, __va_list)
__KVPRINTFLIKE(2);
/*PRINTFLIKE1*/
extern void panic(const char *, ...)
__KPRINTFLIKE(1) __NORETURN;
#pragma rarely_called(panic)
extern void vpanic(const char *, __va_list)
__KVPRINTFLIKE(1) __NORETURN;
#pragma rarely_called(vpanic)
#endif /* _KERNEL */
#endif /* !_ASM */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_CMN_ERR_H */

View File

@ -1,162 +0,0 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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
* or http://www.opensolaris.org/os/licensing.
* 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 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_CPUPART_H
#define _SYS_CPUPART_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/types.h>
#include <sys/processor.h>
#include <sys/cpuvar.h>
#include <sys/disp.h>
#include <sys/pset.h>
#include <sys/lgrp.h>
#include <sys/lgrp_user.h>
#include <sys/pg.h>
#include <sys/bitset.h>
#include <sys/time.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _KERNEL
typedef int cpupartid_t;
/*
* Special partition id.
*/
#define CP_DEFAULT 0
/*
* Flags for cpupart_list()
*/
#define CP_ALL 0 /* return all cpu partitions */
#define CP_NONEMPTY 1 /* return only non-empty ones */
#if defined(_MACHDEP)
struct mach_cpupart {
cpuset_t mc_haltset;
};
extern struct mach_cpupart cp_default_mach;
#else
struct mach_cpupart;
#endif
typedef struct cpupart {
disp_t cp_kp_queue; /* partition-wide kpreempt queue */
cpupartid_t cp_id; /* partition ID */
int cp_ncpus; /* number of online processors */
struct cpupart *cp_next; /* next partition in list */
struct cpupart *cp_prev; /* previous partition in list */
struct cpu *cp_cpulist; /* processor list */
struct kstat *cp_kstat; /* per-partition statistics */
/*
* cp_nrunnable and cp_nrunning are used to calculate load average.
*/
uint_t cp_nrunnable; /* current # of runnable threads */
uint_t cp_nrunning; /* current # of running threads */
/*
* cp_updates, cp_nrunnable_cum, cp_nwaiting_cum, and cp_hp_avenrun
* are used to generate kstat information on an as-needed basis.
*/
uint64_t cp_updates; /* number of statistics updates */
uint64_t cp_nrunnable_cum; /* cum. # of runnable threads */
uint64_t cp_nwaiting_cum; /* cum. # of waiting threads */
struct loadavg_s cp_loadavg; /* cpupart loadavg */
klgrpset_t cp_lgrpset; /* set of lgroups on which this */
/* partition has cpus */
lpl_t *cp_lgrploads; /* table of load averages for this */
/* partition, indexed by lgrp ID */
int cp_nlgrploads; /* size of cp_lgrploads table */
uint64_t cp_hp_avenrun[3]; /* high-precision load average */
uint_t cp_attr; /* bitmask of attributes */
lgrp_gen_t cp_gen; /* generation number */
lgrp_id_t cp_lgrp_hint; /* last home lgroup chosen */
bitset_t cp_cmt_pgs; /* CMT PGs represented */
struct mach_cpupart *cp_mach; /* mach-specific */
} cpupart_t;
typedef struct cpupart_kstat {
kstat_named_t cpk_updates; /* number of updates */
kstat_named_t cpk_runnable; /* cum # of runnable threads */
kstat_named_t cpk_waiting; /* cum # waiting for I/O */
kstat_named_t cpk_ncpus; /* current # of CPUs */
kstat_named_t cpk_avenrun_1min; /* 1-minute load average */
kstat_named_t cpk_avenrun_5min; /* 5-minute load average */
kstat_named_t cpk_avenrun_15min; /* 15-minute load average */
} cpupart_kstat_t;
/*
* Macro to obtain the maximum run priority for the global queue associated
* with given cpu partition.
*/
#define CP_MAXRUNPRI(cp) ((cp)->cp_kp_queue.disp_maxrunpri)
/*
* This macro is used to determine if the given thread must surrender
* CPU to higher priority runnable threads on one of its dispatch queues.
* This should really be defined in <sys/disp.h> but it is not because
* including <sys/cpupart.h> there would cause recursive includes.
*/
#define DISP_MUST_SURRENDER(t) \
((DISP_MAXRUNPRI(t) > DISP_PRIO(t)) || \
(CP_MAXRUNPRI(t->t_cpupart) > DISP_PRIO(t)))
extern cpupart_t cp_default;
extern cpupart_t *cp_list_head;
extern uint_t cp_numparts;
extern uint_t cp_numparts_nonempty;
extern void cpupart_initialize_default();
extern cpupart_t *cpupart_find(psetid_t);
extern int cpupart_create(psetid_t *);
extern int cpupart_destroy(psetid_t);
extern psetid_t cpupart_query_cpu(cpu_t *);
extern int cpupart_attach_cpu(psetid_t, cpu_t *, int);
extern int cpupart_get_cpus(psetid_t *, processorid_t *, uint_t *);
extern int cpupart_bind_thread(kthread_id_t, psetid_t, int, void *,
void *);
extern void cpupart_kpqalloc(pri_t);
extern int cpupart_get_loadavg(psetid_t, int *, int);
extern uint_t cpupart_list(psetid_t *, uint_t, int);
extern int cpupart_setattr(psetid_t, uint_t);
extern int cpupart_getattr(psetid_t, uint_t *);
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_CPUPART_H */

View File

@ -1,737 +0,0 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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
* or http://www.opensolaris.org/os/licensing.
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_CPUVAR_H
#define _SYS_CPUVAR_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/thread.h>
#include <sys/sysinfo.h> /* has cpu_stat_t definition */
#include <sys/disp.h>
#include <sys/processor.h>
#if (defined(_KERNEL) || defined(_KMEMUSER)) && defined(_MACHDEP)
#include <sys/machcpuvar.h>
#endif
#include <sys/types.h>
#include <sys/file.h>
#include <sys/bitmap.h>
#include <sys/rwlock.h>
#include <sys/msacct.h>
#if defined(__GNUC__) && defined(_ASM_INLINES) && defined(_KERNEL) && \
(defined(__i386) || defined(__amd64))
#include <asm/cpuvar.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
struct squeue_set_s;
#define CPU_CACHE_COHERENCE_SIZE 64
#define S_LOADAVG_SZ 11
#define S_MOVAVG_SZ 10
struct loadavg_s {
int lg_cur; /* current loadavg entry */
unsigned int lg_len; /* number entries recorded */
hrtime_t lg_total; /* used to temporarily hold load totals */
hrtime_t lg_loads[S_LOADAVG_SZ]; /* table of recorded entries */
};
/*
* For fast event tracing.
*/
struct ftrace_record;
typedef struct ftrace_data {
int ftd_state; /* ftrace flags */
kmutex_t ftd_unused; /* ftrace buffer lock, unused */
struct ftrace_record *ftd_cur; /* current record */
struct ftrace_record *ftd_first; /* first record */
struct ftrace_record *ftd_last; /* last record */
} ftrace_data_t;
struct cyc_cpu;
struct nvlist;
/*
* Per-CPU data.
*
* Be careful adding new members: if they are not the same in all modules (e.g.
* change size depending on a #define), CTF uniquification can fail to work
* properly. Furthermore, this is transitive in that it applies recursively to
* all types pointed to by cpu_t.
*/
typedef struct cpu {
processorid_t cpu_id; /* CPU number */
processorid_t cpu_seqid; /* sequential CPU id (0..ncpus-1) */
volatile cpu_flag_t cpu_flags; /* flags indicating CPU state */
struct cpu *cpu_self; /* pointer to itself */
kthread_t *cpu_thread; /* current thread */
kthread_t *cpu_idle_thread; /* idle thread for this CPU */
kthread_t *cpu_pause_thread; /* pause thread for this CPU */
klwp_id_t cpu_lwp; /* current lwp (if any) */
klwp_id_t cpu_fpowner; /* currently loaded fpu owner */
struct cpupart *cpu_part; /* partition with this CPU */
struct lgrp_ld *cpu_lpl; /* pointer to this cpu's load */
int cpu_cache_offset; /* see kmem.c for details */
/*
* Links to other CPUs. It is safe to walk these lists if
* one of the following is true:
* - cpu_lock held
* - preemption disabled via kpreempt_disable
* - PIL >= DISP_LEVEL
* - acting thread is an interrupt thread
* - all other CPUs are paused
*/
struct cpu *cpu_next; /* next existing CPU */
struct cpu *cpu_prev; /* prev existing CPU */
struct cpu *cpu_next_onln; /* next online (enabled) CPU */
struct cpu *cpu_prev_onln; /* prev online (enabled) CPU */
struct cpu *cpu_next_part; /* next CPU in partition */
struct cpu *cpu_prev_part; /* prev CPU in partition */
struct cpu *cpu_next_lgrp; /* next CPU in latency group */
struct cpu *cpu_prev_lgrp; /* prev CPU in latency group */
struct cpu *cpu_next_lpl; /* next CPU in lgrp partition */
struct cpu *cpu_prev_lpl;
struct cpu_pg *cpu_pg; /* cpu's processor groups */
void *cpu_reserved[4]; /* reserved for future use */
/*
* Scheduling variables.
*/
disp_t *cpu_disp; /* dispatch queue data */
/*
* Note that cpu_disp is set before the CPU is added to the system
* and is never modified. Hence, no additional locking is needed
* beyond what's necessary to access the cpu_t structure.
*/
char cpu_runrun; /* scheduling flag - set to preempt */
char cpu_kprunrun; /* force kernel preemption */
pri_t cpu_chosen_level; /* priority at which cpu */
/* was chosen for scheduling */
kthread_t *cpu_dispthread; /* thread selected for dispatch */
disp_lock_t cpu_thread_lock; /* dispatcher lock on current thread */
uint8_t cpu_disp_flags; /* flags used by dispatcher */
/*
* The following field is updated when ever the cpu_dispthread
* changes. Also in places, where the current thread(cpu_dispthread)
* priority changes. This is used in disp_lowpri_cpu()
*/
pri_t cpu_dispatch_pri; /* priority of cpu_dispthread */
clock_t cpu_last_swtch; /* last time switched to new thread */
/*
* Interrupt data.
*/
caddr_t cpu_intr_stack; /* interrupt stack */
kthread_t *cpu_intr_thread; /* interrupt thread list */
uint_t cpu_intr_actv; /* interrupt levels active (bitmask) */
int cpu_base_spl; /* priority for highest rupt active */
/*
* Statistics.
*/
cpu_stats_t cpu_stats; /* per-CPU statistics */
struct kstat *cpu_info_kstat; /* kstat for cpu info */
uintptr_t cpu_profile_pc; /* kernel PC in profile interrupt */
uintptr_t cpu_profile_upc; /* user PC in profile interrupt */
uintptr_t cpu_profile_pil; /* PIL when profile interrupted */
ftrace_data_t cpu_ftrace; /* per cpu ftrace data */
clock_t cpu_deadman_lbolt; /* used by deadman() */
uint_t cpu_deadman_countdown; /* used by deadman() */
kmutex_t cpu_cpc_ctxlock; /* protects context for idle thread */
kcpc_ctx_t *cpu_cpc_ctx; /* performance counter context */
/*
* Configuration information for the processor_info system call.
*/
processor_info_t cpu_type_info; /* config info */
time_t cpu_state_begin; /* when CPU entered current state */
char cpu_cpr_flags; /* CPR related info */
struct cyc_cpu *cpu_cyclic; /* per cpu cyclic subsystem data */
struct squeue_set_s *cpu_squeue_set; /* per cpu squeue set */
struct nvlist *cpu_props; /* pool-related properties */
krwlock_t cpu_ft_lock; /* DTrace: fasttrap lock */
uintptr_t cpu_dtrace_caller; /* DTrace: caller, if any */
hrtime_t cpu_dtrace_chillmark; /* DTrace: chill mark time */
hrtime_t cpu_dtrace_chilled; /* DTrace: total chill time */
volatile uint16_t cpu_mstate; /* cpu microstate */
volatile uint16_t cpu_mstate_gen; /* generation counter */
volatile hrtime_t cpu_mstate_start; /* cpu microstate start time */
volatile hrtime_t cpu_acct[NCMSTATES]; /* cpu microstate data */
hrtime_t cpu_intracct[NCMSTATES]; /* interrupt mstate data */
hrtime_t cpu_waitrq; /* cpu run-queue wait time */
struct loadavg_s cpu_loadavg; /* loadavg info for this cpu */
char *cpu_idstr; /* for printing and debugging */
char *cpu_brandstr; /* for printing */
/*
* Sum of all device interrupt weights that are currently directed at
* this cpu. Cleared at start of interrupt redistribution.
*/
int32_t cpu_intr_weight;
void *cpu_vm_data;
struct cpu_physid *cpu_physid; /* physical associations */
uint64_t cpu_curr_clock; /* current clock freq in Hz */
char *cpu_supp_freqs; /* supported freqs in Hz */
/*
* Interrupt load factor used by dispatcher & softcall
*/
hrtime_t cpu_intrlast; /* total interrupt time (nsec) */
int cpu_intrload; /* interrupt load factor (0-99%) */
/*
* New members must be added /before/ this member, as the CTF tools
* rely on this being the last field before cpu_m, so they can
* correctly calculate the offset when synthetically adding the cpu_m
* member in objects that do not have it. This fixup is required for
* uniquification to work correctly.
*/
uintptr_t cpu_m_pad;
#if (defined(_KERNEL) || defined(_KMEMUSER)) && defined(_MACHDEP)
struct machcpu cpu_m; /* per architecture info */
#endif
} cpu_t;
/*
* The cpu_core structure consists of per-CPU state available in any context.
* On some architectures, this may mean that the page(s) containing the
* NCPU-sized array of cpu_core structures must be locked in the TLB -- it
* is up to the platform to assure that this is performed properly. Note that
* the structure is sized to avoid false sharing.
*/
#define CPUC_SIZE (sizeof (uint16_t) + sizeof (uintptr_t) + \
sizeof (kmutex_t))
#define CPUC_PADSIZE CPU_CACHE_COHERENCE_SIZE - CPUC_SIZE
typedef struct cpu_core {
uint16_t cpuc_dtrace_flags; /* DTrace flags */
uint8_t cpuc_pad[CPUC_PADSIZE]; /* padding */
uintptr_t cpuc_dtrace_illval; /* DTrace illegal value */
kmutex_t cpuc_pid_lock; /* DTrace pid provider lock */
} cpu_core_t;
#ifdef _KERNEL
extern cpu_core_t cpu_core[];
#endif /* _KERNEL */
/*
* CPU_ON_INTR() macro. Returns non-zero if currently on interrupt stack.
* Note that this isn't a test for a high PIL. For example, cpu_intr_actv
* does not get updated when we go through sys_trap from TL>0 at high PIL.
* getpil() should be used instead to check for PIL levels.
*/
#define CPU_ON_INTR(cpup) ((cpup)->cpu_intr_actv >> (LOCK_LEVEL + 1))
#if defined(_KERNEL) || defined(_KMEMUSER)
#define INTR_STACK_SIZE MAX(DEFAULTSTKSZ, PAGESIZE)
/* MEMBERS PROTECTED BY "atomicity": cpu_flags */
/*
* Flags in the CPU structure.
*
* These are protected by cpu_lock (except during creation).
*
* Offlined-CPUs have three stages of being offline:
*
* CPU_ENABLE indicates that the CPU is participating in I/O interrupts
* that can be directed at a number of different CPUs. If CPU_ENABLE
* is off, the CPU will not be given interrupts that can be sent elsewhere,
* but will still get interrupts from devices associated with that CPU only,
* and from other CPUs.
*
* CPU_OFFLINE indicates that the dispatcher should not allow any threads
* other than interrupt threads to run on that CPU. A CPU will not have
* CPU_OFFLINE set if there are any bound threads (besides interrupts).
*
* CPU_QUIESCED is set if p_offline was able to completely turn idle the
* CPU and it will not have to run interrupt threads. In this case it'll
* stay in the idle loop until CPU_QUIESCED is turned off.
*
* CPU_FROZEN is used only by CPR to mark CPUs that have been successfully
* suspended (in the suspend path), or have yet to be resumed (in the resume
* case).
*
* On some platforms CPUs can be individually powered off.
* The following flags are set for powered off CPUs: CPU_QUIESCED,
* CPU_OFFLINE, and CPU_POWEROFF. The following flags are cleared:
* CPU_RUNNING, CPU_READY, CPU_EXISTS, and CPU_ENABLE.
*/
#define CPU_RUNNING 0x001 /* CPU running */
#define CPU_READY 0x002 /* CPU ready for cross-calls */
#define CPU_QUIESCED 0x004 /* CPU will stay in idle */
#define CPU_EXISTS 0x008 /* CPU is configured */
#define CPU_ENABLE 0x010 /* CPU enabled for interrupts */
#define CPU_OFFLINE 0x020 /* CPU offline via p_online */
#define CPU_POWEROFF 0x040 /* CPU is powered off */
#define CPU_FROZEN 0x080 /* CPU is frozen via CPR suspend */
#define CPU_SPARE 0x100 /* CPU offline available for use */
#define CPU_FAULTED 0x200 /* CPU offline diagnosed faulty */
#define FMT_CPU_FLAGS \
"\20\12fault\11spare\10frozen" \
"\7poweroff\6offline\5enable\4exist\3quiesced\2ready\1run"
#define CPU_ACTIVE(cpu) (((cpu)->cpu_flags & CPU_OFFLINE) == 0)
/*
* Flags for cpu_offline(), cpu_faulted(), and cpu_spare().
*/
#define CPU_FORCED 0x0001 /* Force CPU offline */
/*
* DTrace flags.
*/
#define CPU_DTRACE_NOFAULT 0x0001 /* Don't fault */
#define CPU_DTRACE_DROP 0x0002 /* Drop this ECB */
#define CPU_DTRACE_BADADDR 0x0004 /* DTrace fault: bad address */
#define CPU_DTRACE_BADALIGN 0x0008 /* DTrace fault: bad alignment */
#define CPU_DTRACE_DIVZERO 0x0010 /* DTrace fault: divide by zero */
#define CPU_DTRACE_ILLOP 0x0020 /* DTrace fault: illegal operation */
#define CPU_DTRACE_NOSCRATCH 0x0040 /* DTrace fault: out of scratch */
#define CPU_DTRACE_KPRIV 0x0080 /* DTrace fault: bad kernel access */
#define CPU_DTRACE_UPRIV 0x0100 /* DTrace fault: bad user access */
#define CPU_DTRACE_TUPOFLOW 0x0200 /* DTrace fault: tuple stack overflow */
#if defined(__sparc)
#define CPU_DTRACE_FAKERESTORE 0x0400 /* pid provider hint to getreg */
#endif
#define CPU_DTRACE_ENTRY 0x0800 /* pid provider hint to ustack() */
#define CPU_DTRACE_BADSTACK 0x1000 /* DTrace fault: bad stack */
#define CPU_DTRACE_FAULT (CPU_DTRACE_BADADDR | CPU_DTRACE_BADALIGN | \
CPU_DTRACE_DIVZERO | CPU_DTRACE_ILLOP | \
CPU_DTRACE_NOSCRATCH | CPU_DTRACE_KPRIV | \
CPU_DTRACE_UPRIV | CPU_DTRACE_TUPOFLOW | \
CPU_DTRACE_BADSTACK)
#define CPU_DTRACE_ERROR (CPU_DTRACE_FAULT | CPU_DTRACE_DROP)
/*
* Dispatcher flags
* These flags must be changed only by the current CPU.
*/
#define CPU_DISP_DONTSTEAL 0x01 /* CPU undergoing context swtch */
#define CPU_DISP_HALTED 0x02 /* CPU halted waiting for interrupt */
#endif /* _KERNEL || _KMEMUSER */
#if (defined(_KERNEL) || defined(_KMEMUSER)) && defined(_MACHDEP)
/*
* Macros for manipulating sets of CPUs as a bitmap. Note that this
* bitmap may vary in size depending on the maximum CPU id a specific
* platform supports. This may be different than the number of CPUs
* the platform supports, since CPU ids can be sparse. We define two
* sets of macros; one for platforms where the maximum CPU id is less
* than the number of bits in a single word (32 in a 32-bit kernel,
* 64 in a 64-bit kernel), and one for platforms that require bitmaps
* of more than one word.
*/
#define CPUSET_WORDS BT_BITOUL(NCPU)
#define CPUSET_NOTINSET ((uint_t)-1)
#if CPUSET_WORDS > 1
typedef struct cpuset {
ulong_t cpub[CPUSET_WORDS];
} cpuset_t;
/*
* Private functions for manipulating cpusets that do not fit in a
* single word. These should not be used directly; instead the
* CPUSET_* macros should be used so the code will be portable
* across different definitions of NCPU.
*/
extern void cpuset_all(cpuset_t *);
extern void cpuset_all_but(cpuset_t *, uint_t);
extern int cpuset_isnull(cpuset_t *);
extern int cpuset_cmp(cpuset_t *, cpuset_t *);
extern void cpuset_only(cpuset_t *, uint_t);
extern uint_t cpuset_find(cpuset_t *);
extern void cpuset_bounds(cpuset_t *, uint_t *, uint_t *);
#define CPUSET_ALL(set) cpuset_all(&(set))
#define CPUSET_ALL_BUT(set, cpu) cpuset_all_but(&(set), cpu)
#define CPUSET_ONLY(set, cpu) cpuset_only(&(set), cpu)
#define CPU_IN_SET(set, cpu) BT_TEST((set).cpub, cpu)
#define CPUSET_ADD(set, cpu) BT_SET((set).cpub, cpu)
#define CPUSET_DEL(set, cpu) BT_CLEAR((set).cpub, cpu)
#define CPUSET_ISNULL(set) cpuset_isnull(&(set))
#define CPUSET_ISEQUAL(set1, set2) cpuset_cmp(&(set1), &(set2))
/*
* Find one CPU in the cpuset.
* Sets "cpu" to the id of the found CPU, or CPUSET_NOTINSET if no cpu
* could be found. (i.e. empty set)
*/
#define CPUSET_FIND(set, cpu) { \
cpu = cpuset_find(&(set)); \
}
/*
* Determine the smallest and largest CPU id in the set. Returns
* CPUSET_NOTINSET in smallest and largest when set is empty.
*/
#define CPUSET_BOUNDS(set, smallest, largest) { \
cpuset_bounds(&(set), &(smallest), &(largest)); \
}
/*
* Atomic cpuset operations
* These are safe to use for concurrent cpuset manipulations.
* "xdel" and "xadd" are exclusive operations, that set "result" to "0"
* if the add or del was successful, or "-1" if not successful.
* (e.g. attempting to add a cpu to a cpuset that's already there, or
* deleting a cpu that's not in the cpuset)
*/
#define CPUSET_ATOMIC_DEL(set, cpu) BT_ATOMIC_CLEAR((set).cpub, (cpu))
#define CPUSET_ATOMIC_ADD(set, cpu) BT_ATOMIC_SET((set).cpub, (cpu))
#define CPUSET_ATOMIC_XADD(set, cpu, result) \
BT_ATOMIC_SET_EXCL((set).cpub, cpu, result)
#define CPUSET_ATOMIC_XDEL(set, cpu, result) \
BT_ATOMIC_CLEAR_EXCL((set).cpub, cpu, result)
#define CPUSET_OR(set1, set2) { \
int _i; \
for (_i = 0; _i < CPUSET_WORDS; _i++) \
(set1).cpub[_i] |= (set2).cpub[_i]; \
}
#define CPUSET_XOR(set1, set2) { \
int _i; \
for (_i = 0; _i < CPUSET_WORDS; _i++) \
(set1).cpub[_i] ^= (set2).cpub[_i]; \
}
#define CPUSET_AND(set1, set2) { \
int _i; \
for (_i = 0; _i < CPUSET_WORDS; _i++) \
(set1).cpub[_i] &= (set2).cpub[_i]; \
}
#define CPUSET_ZERO(set) { \
int _i; \
for (_i = 0; _i < CPUSET_WORDS; _i++) \
(set).cpub[_i] = 0; \
}
#elif CPUSET_WORDS == 1
typedef ulong_t cpuset_t; /* a set of CPUs */
#define CPUSET(cpu) (1UL << (cpu))
#define CPUSET_ALL(set) ((void)((set) = ~0UL))
#define CPUSET_ALL_BUT(set, cpu) ((void)((set) = ~CPUSET(cpu)))
#define CPUSET_ONLY(set, cpu) ((void)((set) = CPUSET(cpu)))
#define CPU_IN_SET(set, cpu) ((set) & CPUSET(cpu))
#define CPUSET_ADD(set, cpu) ((void)((set) |= CPUSET(cpu)))
#define CPUSET_DEL(set, cpu) ((void)((set) &= ~CPUSET(cpu)))
#define CPUSET_ISNULL(set) ((set) == 0)
#define CPUSET_ISEQUAL(set1, set2) ((set1) == (set2))
#define CPUSET_OR(set1, set2) ((void)((set1) |= (set2)))
#define CPUSET_XOR(set1, set2) ((void)((set1) ^= (set2)))
#define CPUSET_AND(set1, set2) ((void)((set1) &= (set2)))
#define CPUSET_ZERO(set) ((void)((set) = 0))
#define CPUSET_FIND(set, cpu) { \
cpu = (uint_t)(lowbit(set) - 1); \
}
#define CPUSET_BOUNDS(set, smallest, largest) { \
smallest = (uint_t)(lowbit(set) - 1); \
largest = (uint_t)(highbit(set) - 1); \
}
#define CPUSET_ATOMIC_DEL(set, cpu) atomic_and_long(&(set), ~CPUSET(cpu))
#define CPUSET_ATOMIC_ADD(set, cpu) atomic_or_long(&(set), CPUSET(cpu))
#define CPUSET_ATOMIC_XADD(set, cpu, result) \
{ result = atomic_set_long_excl(&(set), (cpu)); }
#define CPUSET_ATOMIC_XDEL(set, cpu, result) \
{ result = atomic_clear_long_excl(&(set), (cpu)); }
#else /* CPUSET_WORDS <= 0 */
#error NCPU is undefined or invalid
#endif /* CPUSET_WORDS */
extern cpuset_t cpu_seqid_inuse;
#endif /* (_KERNEL || _KMEMUSER) && _MACHDEP */
#define CPU_CPR_OFFLINE 0x0
#define CPU_CPR_ONLINE 0x1
#define CPU_CPR_IS_OFFLINE(cpu) (((cpu)->cpu_cpr_flags & CPU_CPR_ONLINE) == 0)
#define CPU_CPR_IS_ONLINE(cpu) ((cpu)->cpu_cpr_flags & CPU_CPR_ONLINE)
#define CPU_SET_CPR_FLAGS(cpu, flag) ((cpu)->cpu_cpr_flags |= flag)
#if defined(_KERNEL) || defined(_KMEMUSER)
extern struct cpu *cpu[]; /* indexed by CPU number */
extern cpu_t *cpu_list; /* list of CPUs */
extern cpu_t *cpu_active; /* list of active CPUs */
extern int ncpus; /* number of CPUs present */
extern int ncpus_online; /* number of CPUs not quiesced */
extern int max_ncpus; /* max present before ncpus is known */
extern int boot_max_ncpus; /* like max_ncpus but for real */
extern processorid_t max_cpuid; /* maximum CPU number */
extern struct cpu *cpu_inmotion; /* offline or partition move target */
extern cpu_t *clock_cpu_list;
#if defined(__i386) || defined(__amd64)
extern struct cpu *curcpup(void);
#define CPU (curcpup()) /* Pointer to current CPU */
#else
#define CPU (curthread->t_cpu) /* Pointer to current CPU */
#endif
/*
* CPU_CURRENT indicates to thread_affinity_set to use CPU->cpu_id
* as the target and to grab cpu_lock instead of requiring the caller
* to grab it.
*/
#define CPU_CURRENT -3
/*
* Per-CPU statistics
*
* cpu_stats_t contains numerous system and VM-related statistics, in the form
* of gauges or monotonically-increasing event occurrence counts.
*/
#define CPU_STATS_ENTER_K() kpreempt_disable()
#define CPU_STATS_EXIT_K() kpreempt_enable()
#define CPU_STATS_ADD_K(class, stat, amount) \
{ kpreempt_disable(); /* keep from switching CPUs */\
CPU_STATS_ADDQ(CPU, class, stat, amount); \
kpreempt_enable(); \
}
#define CPU_STATS_ADDQ(cp, class, stat, amount) { \
extern void __dtrace_probe___cpu_##class##info_##stat(uint_t, \
uint64_t *, cpu_t *); \
uint64_t *stataddr = &((cp)->cpu_stats.class.stat); \
__dtrace_probe___cpu_##class##info_##stat((amount), \
stataddr, cp); \
*(stataddr) += (amount); \
}
#define CPU_STATS(cp, stat) \
((cp)->cpu_stats.stat)
#endif /* _KERNEL || _KMEMUSER */
/*
* CPU support routines.
*/
#if defined(_KERNEL) && defined(__STDC__) /* not for genassym.c */
struct zone;
void cpu_list_init(cpu_t *);
void cpu_add_unit(cpu_t *);
void cpu_del_unit(int cpuid);
void cpu_add_active(cpu_t *);
void cpu_kstat_init(cpu_t *);
void cpu_visibility_add(cpu_t *, struct zone *);
void cpu_visibility_remove(cpu_t *, struct zone *);
void cpu_visibility_configure(cpu_t *, struct zone *);
void cpu_visibility_unconfigure(cpu_t *, struct zone *);
void cpu_visibility_online(cpu_t *, struct zone *);
void cpu_visibility_offline(cpu_t *, struct zone *);
void cpu_create_intrstat(cpu_t *);
void cpu_delete_intrstat(cpu_t *);
int cpu_kstat_intrstat_update(kstat_t *, int);
void cpu_intr_swtch_enter(kthread_t *);
void cpu_intr_swtch_exit(kthread_t *);
void mbox_lock_init(void); /* initialize cross-call locks */
void mbox_init(int cpun); /* initialize cross-calls */
void poke_cpu(int cpun); /* interrupt another CPU (to preempt) */
/*
* values for safe_list. Pause state that CPUs are in.
*/
#define PAUSE_IDLE 0 /* normal state */
#define PAUSE_READY 1 /* paused thread ready to spl */
#define PAUSE_WAIT 2 /* paused thread is spl-ed high */
#define PAUSE_DIE 3 /* tell pause thread to leave */
#define PAUSE_DEAD 4 /* pause thread has left */
void mach_cpu_pause(volatile char *);
void pause_cpus(cpu_t *off_cp);
void start_cpus(void);
int cpus_paused(void);
void cpu_pause_init(void);
cpu_t *cpu_get(processorid_t cpun); /* get the CPU struct associated */
int cpu_online(cpu_t *cp); /* take cpu online */
int cpu_offline(cpu_t *cp, int flags); /* take cpu offline */
int cpu_spare(cpu_t *cp, int flags); /* take cpu to spare */
int cpu_faulted(cpu_t *cp, int flags); /* take cpu to faulted */
int cpu_poweron(cpu_t *cp); /* take powered-off cpu to offline */
int cpu_poweroff(cpu_t *cp); /* take offline cpu to powered-off */
cpu_t *cpu_intr_next(cpu_t *cp); /* get next online CPU taking intrs */
int cpu_intr_count(cpu_t *cp); /* count # of CPUs handling intrs */
int cpu_intr_on(cpu_t *cp); /* CPU taking I/O interrupts? */
void cpu_intr_enable(cpu_t *cp); /* enable I/O interrupts */
int cpu_intr_disable(cpu_t *cp); /* disable I/O interrupts */
void cpu_intr_alloc(cpu_t *cp, int n); /* allocate interrupt threads */
/*
* Routines for checking CPU states.
*/
int cpu_is_online(cpu_t *); /* check if CPU is online */
int cpu_is_nointr(cpu_t *); /* check if CPU can service intrs */
int cpu_is_active(cpu_t *); /* check if CPU can run threads */
int cpu_is_offline(cpu_t *); /* check if CPU is offline */
int cpu_is_poweredoff(cpu_t *); /* check if CPU is powered off */
int cpu_flagged_online(cpu_flag_t); /* flags show CPU is online */
int cpu_flagged_nointr(cpu_flag_t); /* flags show CPU not handling intrs */
int cpu_flagged_active(cpu_flag_t); /* flags show CPU scheduling threads */
int cpu_flagged_offline(cpu_flag_t); /* flags show CPU is offline */
int cpu_flagged_poweredoff(cpu_flag_t); /* flags show CPU is powered off */
/*
* The processor_info(2) state of a CPU is a simplified representation suitable
* for use by an application program. Kernel subsystems should utilize the
* internal per-CPU state as given by the cpu_flags member of the cpu structure,
* as this information may include platform- or architecture-specific state
* critical to a subsystem's disposition of a particular CPU.
*/
void cpu_set_state(cpu_t *); /* record/timestamp current state */
int cpu_get_state(cpu_t *); /* get current cpu state */
const char *cpu_get_state_str(cpu_t *); /* get current cpu state as string */
void cpu_set_supp_freqs(cpu_t *, const char *); /* set the CPU supported */
/* frequencies */
int cpu_configure(int);
int cpu_unconfigure(int);
void cpu_destroy_bound_threads(cpu_t *cp);
extern int cpu_bind_thread(kthread_t *tp, processorid_t bind,
processorid_t *obind, int *error);
extern int cpu_unbind(processorid_t cpu_id);
extern void thread_affinity_set(kthread_t *t, int cpu_id);
extern void thread_affinity_clear(kthread_t *t);
extern void affinity_set(int cpu_id);
extern void affinity_clear(void);
extern void init_cpu_mstate(struct cpu *, int);
extern void term_cpu_mstate(struct cpu *);
extern void new_cpu_mstate(int, hrtime_t);
extern void get_cpu_mstate(struct cpu *, hrtime_t *);
extern void thread_nomigrate(void);
extern void thread_allowmigrate(void);
extern void weakbinding_stop(void);
extern void weakbinding_start(void);
/*
* The following routines affect the CPUs participation in interrupt processing,
* if that is applicable on the architecture. This only affects interrupts
* which aren't directed at the processor (not cross calls).
*
* cpu_disable_intr returns non-zero if interrupts were previously enabled.
*/
int cpu_disable_intr(struct cpu *cp); /* stop issuing interrupts to cpu */
void cpu_enable_intr(struct cpu *cp); /* start issuing interrupts to cpu */
/*
* The mutex cpu_lock protects cpu_flags for all CPUs, as well as the ncpus
* and ncpus_online counts.
*/
extern kmutex_t cpu_lock; /* lock protecting CPU data */
typedef enum {
CPU_INIT,
CPU_CONFIG,
CPU_UNCONFIG,
CPU_ON,
CPU_OFF,
CPU_CPUPART_IN,
CPU_CPUPART_OUT
} cpu_setup_t;
typedef int cpu_setup_func_t(cpu_setup_t, int, void *);
/*
* Routines used to register interest in cpu's being added to or removed
* from the system.
*/
extern void register_cpu_setup_func(cpu_setup_func_t *, void *);
extern void unregister_cpu_setup_func(cpu_setup_func_t *, void *);
extern void cpu_state_change_notify(int, cpu_setup_t);
/*
* Create various strings that describe the given CPU for the
* processor_info system call and configuration-related kstats.
*/
#define CPU_IDSTRLEN 100
extern void init_cpu_info(struct cpu *);
extern void cpu_vm_data_init(struct cpu *);
extern void cpu_vm_data_destroy(struct cpu *);
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_CPUVAR_H */

View File

@ -1,358 +0,0 @@
/*
* 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
* or http://www.opensolaris.org/os/licensing.
* 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 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _CTF_H
#define _CTF_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* CTF - Compact ANSI-C Type Format
*
* This file format can be used to compactly represent the information needed
* by a debugger to interpret the ANSI-C types used by a given program.
* Traditionally, this kind of information is generated by the compiler when
* invoked with the -g flag and is stored in "stabs" strings or in the more
* modern DWARF format. CTF provides a representation of only the information
* that is relevant to debugging a complex, optimized C program such as the
* operating system kernel in a form that is significantly more compact than
* the equivalent stabs or DWARF representation. The format is data-model
* independent, so consumers do not need different code depending on whether
* they are 32-bit or 64-bit programs. CTF assumes that a standard ELF symbol
* table is available for use in the debugger, and uses the structure and data
* of the symbol table to avoid storing redundant information. The CTF data
* may be compressed on disk or in memory, indicated by a bit in the header.
* CTF may be interpreted in a raw disk file, or it may be stored in an ELF
* section, typically named .SUNW_ctf. Data structures are aligned so that
* a raw CTF file or CTF ELF section may be manipulated using mmap(2).
*
* The CTF file or section itself has the following structure:
*
* +--------+--------+---------+----------+-------+--------+
* | file | type | data | function | data | string |
* | header | labels | objects | info | types | table |
* +--------+--------+---------+----------+-------+--------+
*
* The file header stores a magic number and version information, encoding
* flags, and the byte offset of each of the sections relative to the end of the
* header itself. If the CTF data has been uniquified against another set of
* CTF data, a reference to that data also appears in the the header. This
* reference is the name of the label corresponding to the types uniquified
* against.
*
* Following the header is a list of labels, used to group the types included in
* the data types section. Each label is accompanied by a type ID i. A given
* label refers to the group of types whose IDs are in the range [0, i].
*
* Data object and function records are stored in the same order as they appear
* in the corresponding symbol table, except that symbols marked SHN_UNDEF are
* not stored and symbols that have no type data are padded out with zeroes.
* For each data object, the type ID (a small integer) is recorded. For each
* function, the type ID of the return type and argument types is recorded.
*
* The data types section is a list of variable size records that represent each
* type, in order by their ID. The types themselves form a directed graph,
* where each node may contain one or more outgoing edges to other type nodes,
* denoted by their ID.
*
* Strings are recorded as a string table ID (0 or 1) and a byte offset into the
* string table. String table 0 is the internal CTF string table. String table
* 1 is the external string table, which is the string table associated with the
* ELF symbol table for this object. CTF does not record any strings that are
* already in the symbol table, and the CTF string table does not contain any
* duplicated strings.
*
* If the CTF data has been merged with another parent CTF object, some outgoing
* edges may refer to type nodes that exist in another CTF object. The debugger
* and libctf library are responsible for connecting the appropriate objects
* together so that the full set of types can be explored and manipulated.
*/
#define CTF_MAX_TYPE 0xffff /* max type identifier value */
#define CTF_MAX_NAME 0x7fffffff /* max offset into a string table */
#define CTF_MAX_VLEN 0x3ff /* max struct, union, enum members or args */
#define CTF_MAX_INTOFF 0xff /* max offset of intrinsic value in bits */
#define CTF_MAX_INTBITS 0xffff /* max size of an intrinsic in bits */
/* See ctf_type_t */
#define CTF_MAX_SIZE 0xfffe /* max size of a type in bytes */
#define CTF_LSIZE_SENT 0xffff /* sentinel for ctt_size */
#define CTF_MAX_LSIZE UINT64_MAX
typedef struct ctf_preamble {
ushort_t ctp_magic; /* magic number (CTF_MAGIC) */
uchar_t ctp_version; /* data format version number (CTF_VERSION) */
uchar_t ctp_flags; /* flags (see below) */
} ctf_preamble_t;
typedef struct ctf_header {
ctf_preamble_t cth_preamble;
uint_t cth_parlabel; /* ref to name of parent lbl uniq'd against */
uint_t cth_parname; /* ref to basename of parent */
uint_t cth_lbloff; /* offset of label section */
uint_t cth_objtoff; /* offset of object section */
uint_t cth_funcoff; /* offset of function section */
uint_t cth_typeoff; /* offset of type section */
uint_t cth_stroff; /* offset of string section */
uint_t cth_strlen; /* length of string section in bytes */
} ctf_header_t;
#define cth_magic cth_preamble.ctp_magic
#define cth_version cth_preamble.ctp_version
#define cth_flags cth_preamble.ctp_flags
#ifdef CTF_OLD_VERSIONS
typedef struct ctf_header_v1 {
ctf_preamble_t cth_preamble;
uint_t cth_objtoff;
uint_t cth_funcoff;
uint_t cth_typeoff;
uint_t cth_stroff;
uint_t cth_strlen;
} ctf_header_v1_t;
#endif /* CTF_OLD_VERSIONS */
#define CTF_MAGIC 0xcff1 /* magic number identifying header */
/* data format version number */
#define CTF_VERSION_1 1
#define CTF_VERSION_2 2
#define CTF_VERSION CTF_VERSION_2 /* current version */
#define CTF_F_COMPRESS 0x1 /* data buffer is compressed */
typedef struct ctf_lblent {
uint_t ctl_label; /* ref to name of label */
uint_t ctl_typeidx; /* last type associated with this label */
} ctf_lblent_t;
typedef struct ctf_stype {
uint_t ctt_name; /* reference to name in string table */
ushort_t ctt_info; /* encoded kind, variant length (see below) */
union {
ushort_t _size; /* size of entire type in bytes */
ushort_t _type; /* reference to another type */
} _u;
} ctf_stype_t;
/*
* type sizes, measured in bytes, come in two flavors. 99% of them fit within
* (USHRT_MAX - 1), and thus can be stored in the ctt_size member of a
* ctf_stype_t. The maximum value for these sizes is CTF_MAX_SIZE. The sizes
* larger than CTF_MAX_SIZE must be stored in the ctt_lsize member of a
* ctf_type_t. Use of this member is indicated by the presence of
* CTF_LSIZE_SENT in ctt_size.
*/
typedef struct ctf_type {
uint_t ctt_name; /* reference to name in string table */
ushort_t ctt_info; /* encoded kind, variant length (see below) */
union {
ushort_t _size; /* always CTF_LSIZE_SENT */
ushort_t _type; /* do not use */
} _u;
uint_t ctt_lsizehi; /* high 32 bits of type size in bytes */
uint_t ctt_lsizelo; /* low 32 bits of type size in bytes */
} ctf_type_t;
#define ctt_size _u._size /* for fundamental types that have a size */
#define ctt_type _u._type /* for types that reference another type */
/*
* The following macros compose and decompose values for ctt_info and
* ctt_name, as well as other structures that contain name references.
*
* ------------------------
* ctt_info: | kind | isroot | vlen |
* ------------------------
* 15 11 10 9 0
*
* kind = CTF_INFO_KIND(c.ctt_info); <-- CTF_K_* value (see below)
* vlen = CTF_INFO_VLEN(c.ctt_info); <-- length of variable data list
*
* stid = CTF_NAME_STID(c.ctt_name); <-- string table id number (0 or 1)
* offset = CTF_NAME_OFFSET(c.ctt_name); <-- string table byte offset
*
* c.ctt_info = CTF_TYPE_INFO(kind, vlen);
* c.ctt_name = CTF_TYPE_NAME(stid, offset);
*/
#define CTF_INFO_KIND(info) (((info) & 0xf800) >> 11)
#define CTF_INFO_ISROOT(info) (((info) & 0x0400) >> 10)
#define CTF_INFO_VLEN(info) (((info) & CTF_MAX_VLEN))
#define CTF_NAME_STID(name) ((name) >> 31)
#define CTF_NAME_OFFSET(name) ((name) & 0x7fffffff)
#define CTF_TYPE_INFO(kind, isroot, vlen) \
(((kind) << 11) | (((isroot) ? 1 : 0) << 10) | ((vlen) & CTF_MAX_VLEN))
#define CTF_TYPE_NAME(stid, offset) \
(((stid) << 31) | ((offset) & 0x7fffffff))
#define CTF_TYPE_ISPARENT(id) ((id) < 0x8000)
#define CTF_TYPE_ISCHILD(id) ((id) > 0x7fff)
#define CTF_TYPE_TO_INDEX(id) ((id) & 0x7fff)
#define CTF_INDEX_TO_TYPE(id, child) ((child) ? ((id) | 0x8000) : (id))
#define CTF_PARENT_SHIFT 15
#define CTF_STRTAB_0 0 /* symbolic define for string table id 0 */
#define CTF_STRTAB_1 1 /* symbolic define for string table id 1 */
#define CTF_TYPE_LSIZE(cttp) \
(((uint64_t)(cttp)->ctt_lsizehi) << 32 | (cttp)->ctt_lsizelo)
#define CTF_SIZE_TO_LSIZE_HI(size) ((uint32_t)((uint64_t)(size) >> 32))
#define CTF_SIZE_TO_LSIZE_LO(size) ((uint32_t)(size))
#ifdef CTF_OLD_VERSIONS
#define CTF_INFO_KIND_V1(info) (((info) & 0xf000) >> 12)
#define CTF_INFO_ISROOT_V1(info) (((info) & 0x0800) >> 11)
#define CTF_INFO_VLEN_V1(info) (((info) & 0x07ff))
#define CTF_TYPE_INFO_V1(kind, isroot, vlen) \
(((kind) << 12) | (((isroot) ? 1 : 0) << 11) | ((vlen) & 0x07ff))
#endif /* CTF_OLD_VERSIONS */
/*
* Values for CTF_TYPE_KIND(). If the kind has an associated data list,
* CTF_INFO_VLEN() will extract the number of elements in the list, and
* the type of each element is shown in the comments below.
*/
#define CTF_K_UNKNOWN 0 /* unknown type (used for padding) */
#define CTF_K_INTEGER 1 /* variant data is CTF_INT_DATA() (see below) */
#define CTF_K_FLOAT 2 /* variant data is CTF_FP_DATA() (see below) */
#define CTF_K_POINTER 3 /* ctt_type is referenced type */
#define CTF_K_ARRAY 4 /* variant data is single ctf_array_t */
#define CTF_K_FUNCTION 5 /* ctt_type is return type, variant data is */
/* list of argument types (ushort_t's) */
#define CTF_K_STRUCT 6 /* variant data is list of ctf_member_t's */
#define CTF_K_UNION 7 /* variant data is list of ctf_member_t's */
#define CTF_K_ENUM 8 /* variant data is list of ctf_enum_t's */
#define CTF_K_FORWARD 9 /* no additional data; ctt_name is tag */
#define CTF_K_TYPEDEF 10 /* ctt_type is referenced type */
#define CTF_K_VOLATILE 11 /* ctt_type is base type */
#define CTF_K_CONST 12 /* ctt_type is base type */
#define CTF_K_RESTRICT 13 /* ctt_type is base type */
#define CTF_K_MAX 31 /* Maximum possible CTF_K_* value */
/*
* Values for ctt_type when kind is CTF_K_INTEGER. The flags, offset in bits,
* and size in bits are encoded as a single word using the following macros.
*/
#define CTF_INT_ENCODING(data) (((data) & 0xff000000) >> 24)
#define CTF_INT_OFFSET(data) (((data) & 0x00ff0000) >> 16)
#define CTF_INT_BITS(data) (((data) & 0x0000ffff))
#define CTF_INT_DATA(encoding, offset, bits) \
(((encoding) << 24) | ((offset) << 16) | (bits))
#define CTF_INT_SIGNED 0x01 /* integer is signed (otherwise unsigned) */
#define CTF_INT_CHAR 0x02 /* character display format */
#define CTF_INT_BOOL 0x04 /* boolean display format */
#define CTF_INT_VARARGS 0x08 /* varargs display format */
/*
* Values for ctt_type when kind is CTF_K_FLOAT. The encoding, offset in bits,
* and size in bits are encoded as a single word using the following macros.
*/
#define CTF_FP_ENCODING(data) (((data) & 0xff000000) >> 24)
#define CTF_FP_OFFSET(data) (((data) & 0x00ff0000) >> 16)
#define CTF_FP_BITS(data) (((data) & 0x0000ffff))
#define CTF_FP_DATA(encoding, offset, bits) \
(((encoding) << 24) | ((offset) << 16) | (bits))
#define CTF_FP_SINGLE 1 /* IEEE 32-bit float encoding */
#define CTF_FP_DOUBLE 2 /* IEEE 64-bit float encoding */
#define CTF_FP_CPLX 3 /* Complex encoding */
#define CTF_FP_DCPLX 4 /* Double complex encoding */
#define CTF_FP_LDCPLX 5 /* Long double complex encoding */
#define CTF_FP_LDOUBLE 6 /* Long double encoding */
#define CTF_FP_INTRVL 7 /* Interval (2x32-bit) encoding */
#define CTF_FP_DINTRVL 8 /* Double interval (2x64-bit) encoding */
#define CTF_FP_LDINTRVL 9 /* Long double interval (2x128-bit) encoding */
#define CTF_FP_IMAGRY 10 /* Imaginary (32-bit) encoding */
#define CTF_FP_DIMAGRY 11 /* Long imaginary (64-bit) encoding */
#define CTF_FP_LDIMAGRY 12 /* Long double imaginary (128-bit) encoding */
#define CTF_FP_MAX 12 /* Maximum possible CTF_FP_* value */
typedef struct ctf_array {
ushort_t cta_contents; /* reference to type of array contents */
ushort_t cta_index; /* reference to type of array index */
uint_t cta_nelems; /* number of elements */
} ctf_array_t;
/*
* Most structure members have bit offsets that can be expressed using a
* short. Some don't. ctf_member_t is used for structs which cannot
* contain any of these large offsets, whereas ctf_lmember_t is used in the
* latter case. If ctt_size for a given struct is >= 8192 bytes, all members
* will be stored as type ctf_lmember_t.
*/
#define CTF_LSTRUCT_THRESH 8192
typedef struct ctf_member {
uint_t ctm_name; /* reference to name in string table */
ushort_t ctm_type; /* reference to type of member */
ushort_t ctm_offset; /* offset of this member in bits */
} ctf_member_t;
typedef struct ctf_lmember {
uint_t ctlm_name; /* reference to name in string table */
ushort_t ctlm_type; /* reference to type of member */
ushort_t ctlm_pad; /* padding */
uint_t ctlm_offsethi; /* high 32 bits of member offset in bits */
uint_t ctlm_offsetlo; /* low 32 bits of member offset in bits */
} ctf_lmember_t;
#define CTF_LMEM_OFFSET(ctlmp) \
(((uint64_t)(ctlmp)->ctlm_offsethi) << 32 | (ctlmp)->ctlm_offsetlo)
#define CTF_OFFSET_TO_LMEMHI(offset) ((uint32_t)((uint64_t)(offset) >> 32))
#define CTF_OFFSET_TO_LMEMLO(offset) ((uint32_t)(offset))
typedef struct ctf_enum {
uint_t cte_name; /* reference to name in string table */
int cte_value; /* value associated with this name */
} ctf_enum_t;
#ifdef __cplusplus
}
#endif
#endif /* _CTF_H */

View File

@ -1,241 +0,0 @@
/*
* 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
* or http://www.opensolaris.org/os/licensing.
* 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.
*/
/*
* This header file defines the interfaces available from the CTF debugger
* library, libctf, and an equivalent kernel module. This API can be used by
* a debugger to operate on data in the Compact ANSI-C Type Format (CTF).
* This is NOT a public interface, although it may eventually become one in
* the fullness of time after we gain more experience with the interfaces.
*
* In the meantime, be aware that any program linked with this API in this
* release of Solaris is almost guaranteed to break in the next release.
*
* In short, do not user this header file or the CTF routines for any purpose.
*/
#ifndef _CTF_API_H
#define _CTF_API_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/types.h>
#include <sys/param.h>
#include <sys/elf.h>
#include <sys/ctf.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Clients can open one or more CTF containers and obtain a pointer to an
* opaque ctf_file_t. Types are identified by an opaque ctf_id_t token.
* These opaque definitions allow libctf to evolve without breaking clients.
*/
typedef struct ctf_file ctf_file_t;
typedef long ctf_id_t;
/*
* If the debugger needs to provide the CTF library with a set of raw buffers
* for use as the CTF data, symbol table, and string table, it can do so by
* filling in ctf_sect_t structures and passing them to ctf_bufopen():
*/
typedef struct ctf_sect {
const char *cts_name; /* section name (if any) */
ulong_t cts_type; /* section type (ELF SHT_... value) */
ulong_t cts_flags; /* section flags (ELF SHF_... value) */
const void *cts_data; /* pointer to section data */
size_t cts_size; /* size of data in bytes */
size_t cts_entsize; /* size of each section entry (symtab only) */
off64_t cts_offset; /* file offset of this section (if any) */
} ctf_sect_t;
/*
* Encoding information for integers, floating-point values, and certain other
* intrinsics can be obtained by calling ctf_type_encoding(), below. The flags
* field will contain values appropriate for the type defined in <sys/ctf.h>.
*/
typedef struct ctf_encoding {
uint_t cte_format; /* data format (CTF_INT_* or CTF_FP_* flags) */
uint_t cte_offset; /* offset of value in bits */
uint_t cte_bits; /* size of storage in bits */
} ctf_encoding_t;
typedef struct ctf_membinfo {
ctf_id_t ctm_type; /* type of struct or union member */
ulong_t ctm_offset; /* offset of member in bits */
} ctf_membinfo_t;
typedef struct ctf_arinfo {
ctf_id_t ctr_contents; /* type of array contents */
ctf_id_t ctr_index; /* type of array index */
uint_t ctr_nelems; /* number of elements */
} ctf_arinfo_t;
typedef struct ctf_funcinfo {
ctf_id_t ctc_return; /* function return type */
uint_t ctc_argc; /* number of typed arguments to function */
uint_t ctc_flags; /* function attributes (see below) */
} ctf_funcinfo_t;
typedef struct ctf_lblinfo {
ctf_id_t ctb_typeidx; /* last type associated with the label */
} ctf_lblinfo_t;
#define CTF_FUNC_VARARG 0x1 /* function arguments end with varargs */
/*
* Functions that return integer status or a ctf_id_t use the following value
* to indicate failure. ctf_errno() can be used to obtain an error code.
*/
#define CTF_ERR (-1L)
/*
* The CTF data model is inferred to be the caller's data model or the data
* model of the given object, unless ctf_setmodel() is explicitly called.
*/
#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
/*
* Dynamic CTF containers can be created using ctf_create(). The ctf_add_*
* routines can be used to add new definitions to the dynamic container.
* New types are labeled as root or non-root to determine whether they are
* visible at the top-level program scope when subsequently doing a lookup.
*/
#define CTF_ADD_NONROOT 0 /* type only visible in nested scope */
#define CTF_ADD_ROOT 1 /* type visible at top-level scope */
/*
* These typedefs are used to define the signature for callback functions
* that can be used with the iteration and visit functions below:
*/
typedef int ctf_visit_f(const char *, ctf_id_t, ulong_t, int, void *);
typedef int ctf_member_f(const char *, ctf_id_t, ulong_t, void *);
typedef int ctf_enum_f(const char *, int, void *);
typedef int ctf_type_f(ctf_id_t, void *);
typedef int ctf_label_f(const char *, const ctf_lblinfo_t *, void *);
extern ctf_file_t *ctf_bufopen(const ctf_sect_t *, const ctf_sect_t *,
const ctf_sect_t *, int *);
extern ctf_file_t *ctf_fdopen(int, int *);
extern ctf_file_t *ctf_open(const char *, int *);
extern ctf_file_t *ctf_create(int *);
extern void ctf_close(ctf_file_t *);
extern ctf_file_t *ctf_parent_file(ctf_file_t *);
extern const char *ctf_parent_name(ctf_file_t *);
extern int ctf_import(ctf_file_t *, ctf_file_t *);
extern int ctf_setmodel(ctf_file_t *, int);
extern int ctf_getmodel(ctf_file_t *);
extern void ctf_setspecific(ctf_file_t *, void *);
extern void *ctf_getspecific(ctf_file_t *);
extern int ctf_errno(ctf_file_t *);
extern const char *ctf_errmsg(int);
extern int ctf_version(int);
extern int ctf_func_info(ctf_file_t *, ulong_t, ctf_funcinfo_t *);
extern int ctf_func_args(ctf_file_t *, ulong_t, uint_t, ctf_id_t *);
extern ctf_id_t ctf_lookup_by_name(ctf_file_t *, const char *);
extern ctf_id_t ctf_lookup_by_symbol(ctf_file_t *, ulong_t);
extern ctf_id_t ctf_type_resolve(ctf_file_t *, ctf_id_t);
extern ssize_t ctf_type_lname(ctf_file_t *, ctf_id_t, char *, size_t);
extern char *ctf_type_name(ctf_file_t *, ctf_id_t, char *, size_t);
extern ssize_t ctf_type_size(ctf_file_t *, ctf_id_t);
extern ssize_t ctf_type_align(ctf_file_t *, ctf_id_t);
extern int ctf_type_kind(ctf_file_t *, ctf_id_t);
extern ctf_id_t ctf_type_reference(ctf_file_t *, ctf_id_t);
extern ctf_id_t ctf_type_pointer(ctf_file_t *, ctf_id_t);
extern int ctf_type_encoding(ctf_file_t *, ctf_id_t, ctf_encoding_t *);
extern int ctf_type_visit(ctf_file_t *, ctf_id_t, ctf_visit_f *, void *);
extern int ctf_type_cmp(ctf_file_t *, ctf_id_t, ctf_file_t *, ctf_id_t);
extern int ctf_type_compat(ctf_file_t *, ctf_id_t, ctf_file_t *, ctf_id_t);
extern int ctf_member_info(ctf_file_t *, ctf_id_t, const char *,
ctf_membinfo_t *);
extern int ctf_array_info(ctf_file_t *, ctf_id_t, ctf_arinfo_t *);
extern const char *ctf_enum_name(ctf_file_t *, ctf_id_t, int);
extern int ctf_enum_value(ctf_file_t *, ctf_id_t, const char *, int *);
extern const char *ctf_label_topmost(ctf_file_t *);
extern int ctf_label_info(ctf_file_t *, const char *, ctf_lblinfo_t *);
extern int ctf_member_iter(ctf_file_t *, ctf_id_t, ctf_member_f *, void *);
extern int ctf_enum_iter(ctf_file_t *, ctf_id_t, ctf_enum_f *, void *);
extern int ctf_type_iter(ctf_file_t *, ctf_type_f *, void *);
extern int ctf_label_iter(ctf_file_t *, ctf_label_f *, void *);
extern ctf_id_t ctf_add_array(ctf_file_t *, uint_t, const ctf_arinfo_t *);
extern ctf_id_t ctf_add_const(ctf_file_t *, uint_t, ctf_id_t);
extern ctf_id_t ctf_add_enum(ctf_file_t *, uint_t, const char *);
extern ctf_id_t ctf_add_float(ctf_file_t *, uint_t,
const char *, const ctf_encoding_t *);
extern ctf_id_t ctf_add_forward(ctf_file_t *, uint_t, const char *, uint_t);
extern ctf_id_t ctf_add_function(ctf_file_t *, uint_t,
const ctf_funcinfo_t *, const ctf_id_t *);
extern ctf_id_t ctf_add_integer(ctf_file_t *, uint_t,
const char *, const ctf_encoding_t *);
extern ctf_id_t ctf_add_pointer(ctf_file_t *, uint_t, ctf_id_t);
extern ctf_id_t ctf_add_type(ctf_file_t *, ctf_file_t *, ctf_id_t);
extern ctf_id_t ctf_add_typedef(ctf_file_t *, uint_t, const char *, ctf_id_t);
extern ctf_id_t ctf_add_restrict(ctf_file_t *, uint_t, ctf_id_t);
extern ctf_id_t ctf_add_struct(ctf_file_t *, uint_t, const char *);
extern ctf_id_t ctf_add_union(ctf_file_t *, uint_t, const char *);
extern ctf_id_t ctf_add_volatile(ctf_file_t *, uint_t, ctf_id_t);
extern int ctf_add_enumerator(ctf_file_t *, ctf_id_t, const char *, int);
extern int ctf_add_member(ctf_file_t *, ctf_id_t, const char *, ctf_id_t);
extern int ctf_set_array(ctf_file_t *, ctf_id_t, const ctf_arinfo_t *);
extern int ctf_update(ctf_file_t *);
extern int ctf_discard(ctf_file_t *);
extern int ctf_write(ctf_file_t *, int);
#ifdef _KERNEL
struct module;
extern ctf_file_t *ctf_modopen(struct module *, int *);
#endif
#ifdef __cplusplus
}
#endif
#endif /* _CTF_API_H */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,93 +0,0 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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
* or http://www.opensolaris.org/os/licensing.
* 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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_FASTTRAP_H
#define _SYS_FASTTRAP_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/fasttrap_isa.h>
#include <sys/dtrace.h>
#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
#endif
#define FASTTRAPIOC (('m' << 24) | ('r' << 16) | ('f' << 8))
#define FASTTRAPIOC_MAKEPROBE (FASTTRAPIOC | 1)
#define FASTTRAPIOC_GETINSTR (FASTTRAPIOC | 2)
typedef enum fasttrap_probe_type {
DTFTP_NONE = 0,
DTFTP_ENTRY,
DTFTP_RETURN,
DTFTP_OFFSETS,
DTFTP_POST_OFFSETS,
DTFTP_IS_ENABLED
} fasttrap_probe_type_t;
typedef struct fasttrap_probe_spec {
pid_t ftps_pid;
fasttrap_probe_type_t ftps_type;
char ftps_func[DTRACE_FUNCNAMELEN];
char ftps_mod[DTRACE_MODNAMELEN];
uint64_t ftps_pc;
uint64_t ftps_size;
uint64_t ftps_noffs;
uint64_t ftps_offs[1];
} fasttrap_probe_spec_t;
typedef struct fasttrap_instr_query {
uint64_t ftiq_pc;
pid_t ftiq_pid;
fasttrap_instr_t ftiq_instr;
} fasttrap_instr_query_t;
/*
* To support the fasttrap provider from very early in a process's life,
* the run-time linker, ld.so.1, has a program header of type PT_SUNWDTRACE
* which points to a data object which must be PT_SUNWDTRACE_SIZE bytes.
* This structure mimics the fasttrap provider section of the ulwp_t structure.
* When the fasttrap provider is changed to require new or different
* instructions, the data object in ld.so.1 and the thread initializers in libc
* (libc_init() and _thrp_create()) need to be updated to include the new
* instructions, and PT_SUNWDTRACE needs to be changed to a new unique number
* (while the old value gets assigned something like PT_SUNWDTRACE_1). Since the
* linker must be backward compatible with old Solaris releases, it must have
* program headers for each of the PT_SUNWDTRACE versions. The kernel's
* elfexec() function only has to look for the latest version of the
* PT_SUNWDTRACE program header.
*/
#define PT_SUNWDTRACE_SIZE FASTTRAP_SUNWDTRACE_SIZE
#ifdef __cplusplus
}
#endif
#endif /* _SYS_FASTTRAP_H */

View File

@ -1,114 +0,0 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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
* or http://www.opensolaris.org/os/licensing.
* 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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _FASTTRAP_ISA_H
#define _FASTTRAP_ISA_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
#endif
#define FASTTRAP_MAX_INSTR_SIZE 15
#define FASTTRAP_INSTR 0xcc
#define FASTTRAP_SUNWDTRACE_SIZE 64
typedef uint8_t fasttrap_instr_t;
typedef struct fasttrap_machtp {
uint8_t ftmt_instr[FASTTRAP_MAX_INSTR_SIZE]; /* orig. instr. */
uint8_t ftmt_size; /* instruction size */
#ifdef __amd64
uint8_t ftmt_ripmode; /* %rip-relative handling mode */
uint8_t ftmt_modrm; /* saved modrm byte */
#endif
uint8_t ftmt_type; /* emulation type */
uint8_t ftmt_code; /* branch condition */
uint8_t ftmt_base; /* branch base */
uint8_t ftmt_index; /* branch index */
uint8_t ftmt_scale; /* branch scale */
uint8_t ftmt_segment; /* segment for memory accesses */
uintptr_t ftmt_dest; /* destination of control flow */
} fasttrap_machtp_t;
#define ftt_instr ftt_mtp.ftmt_instr
#ifdef __amd64
#define ftt_ripmode ftt_mtp.ftmt_ripmode
#define ftt_modrm ftt_mtp.ftmt_modrm
#endif
#define ftt_size ftt_mtp.ftmt_size
#define ftt_type ftt_mtp.ftmt_type
#define ftt_code ftt_mtp.ftmt_code
#define ftt_base ftt_mtp.ftmt_base
#define ftt_index ftt_mtp.ftmt_index
#define ftt_scale ftt_mtp.ftmt_scale
#define ftt_segment ftt_mtp.ftmt_segment
#define ftt_dest ftt_mtp.ftmt_dest
#define FASTTRAP_T_COMMON 0x00 /* common case -- no emulation */
#define FASTTRAP_T_JCC 0x01 /* near and far conditional jumps */
#define FASTTRAP_T_LOOP 0x02 /* loop instructions */
#define FASTTRAP_T_JCXZ 0x03 /* jump if %ecx/%rcx is zero */
#define FASTTRAP_T_JMP 0x04 /* relative jump */
#define FASTTRAP_T_CALL 0x05 /* near call (and link) */
#define FASTTRAP_T_RET 0x06 /* ret */
#define FASTTRAP_T_RET16 0x07 /* ret <imm16> */
/*
* For performance rather than correctness.
*/
#define FASTTRAP_T_PUSHL_EBP 0x10 /* pushl %ebp (for function entry) */
#define FASTTRAP_T_NOP 0x11 /* nop */
#define FASTTRAP_RIP_1 0x1
#define FASTTRAP_RIP_2 0x2
#define FASTTRAP_RIP_X 0x4
/*
* Segment values.
*/
#define FASTTRAP_SEG_NONE 0
#define FASTTRAP_SEG_CS 1
#define FASTTRAP_SEG_DS 2
#define FASTTRAP_SEG_ES 3
#define FASTTRAP_SEG_FS 4
#define FASTTRAP_SEG_GS 5
#define FASTTRAP_SEG_SS 6
#define FASTTRAP_AFRAMES 3
#define FASTTRAP_RETURN_AFRAMES 4
#define FASTTRAP_ENTRY_AFRAMES 3
#define FASTTRAP_OFFSET_AFRAMES 3
#ifdef __cplusplus
}
#endif
#endif /* _FASTTRAP_ISA_H */

View File

@ -1,94 +0,0 @@
/*
* 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
* or http://www.opensolaris.org/os/licensing.
* 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_ISA_H
#define _FASTTRAP_ISA_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* This is our reserved trap instruction: ta 0x38
*/
#define FASTTRAP_INSTR 0x91d02038
#define FASTTRAP_SUNWDTRACE_SIZE 128
typedef uint32_t fasttrap_instr_t;
typedef struct fasttrap_machtp {
fasttrap_instr_t ftmt_instr; /* original instruction */
uintptr_t ftmt_dest; /* destination of DCTI */
uint8_t ftmt_type; /* emulation type */
uint8_t ftmt_flags; /* emulation flags */
uint8_t ftmt_cc; /* which cc to look at */
uint8_t ftmt_code; /* branch condition */
} fasttrap_machtp_t;
#define ftt_instr ftt_mtp.ftmt_instr
#define ftt_dest ftt_mtp.ftmt_dest
#define ftt_type ftt_mtp.ftmt_type
#define ftt_flags ftt_mtp.ftmt_flags
#define ftt_cc ftt_mtp.ftmt_cc
#define ftt_code ftt_mtp.ftmt_code
#define FASTTRAP_T_COMMON 0x00 /* common case -- no emulation */
#define FASTTRAP_T_CCR 0x01 /* integer condition code branch */
#define FASTTRAP_T_FCC 0x02 /* floating-point branch */
#define FASTTRAP_T_REG 0x03 /* register predicated branch */
#define FASTTRAP_T_ALWAYS 0x04 /* branch always */
#define FASTTRAP_T_CALL 0x05 /* call instruction */
#define FASTTRAP_T_JMPL 0x06 /* jmpl instruction */
#define FASTTRAP_T_RDPC 0x07 /* rdpc instruction */
#define FASTTRAP_T_RETURN 0x08 /* return instruction */
/*
* For performance rather than correctness.
*/
#define FASTTRAP_T_SAVE 0x10 /* save instruction (func entry only) */
#define FASTTRAP_T_RESTORE 0x11 /* restore instruction */
#define FASTTRAP_T_OR 0x12 /* mov instruction */
#define FASTTRAP_T_SETHI 0x13 /* sethi instruction (includes nop) */
#define FASTTRAP_F_ANNUL 0x01 /* branch is annulled */
#define FASTTRAP_F_RETMAYBE 0x02 /* not definitely a return site */
#define FASTTRAP_AFRAMES 3
#define FASTTRAP_RETURN_AFRAMES 4
#define FASTTRAP_ENTRY_AFRAMES 3
#define FASTTRAP_OFFSET_AFRAMES 3
#ifdef __cplusplus
}
#endif
#endif /* _FASTTRAP_ISA_H */