10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 50Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 60Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 70Sstevel@tonic-gate * with the License. 80Sstevel@tonic-gate * 90Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 100Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 110Sstevel@tonic-gate * See the License for the specific language governing permissions 120Sstevel@tonic-gate * and limitations under the License. 130Sstevel@tonic-gate * 140Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 150Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 160Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 170Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 180Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 190Sstevel@tonic-gate * 200Sstevel@tonic-gate * CDDL HEADER END 210Sstevel@tonic-gate */ 220Sstevel@tonic-gate /* 23*191Sahl * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 240Sstevel@tonic-gate * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate 270Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 280Sstevel@tonic-gate 290Sstevel@tonic-gate #include <sys/sdt_impl.h> 300Sstevel@tonic-gate 310Sstevel@tonic-gate static dtrace_pattr_t vtrace_attr = { 320Sstevel@tonic-gate { DTRACE_STABILITY_UNSTABLE, DTRACE_STABILITY_UNSTABLE, DTRACE_CLASS_ISA }, 330Sstevel@tonic-gate { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 340Sstevel@tonic-gate { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 350Sstevel@tonic-gate { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 360Sstevel@tonic-gate { DTRACE_STABILITY_UNSTABLE, DTRACE_STABILITY_UNSTABLE, DTRACE_CLASS_ISA }, 370Sstevel@tonic-gate }; 380Sstevel@tonic-gate 390Sstevel@tonic-gate static dtrace_pattr_t info_attr = { 400Sstevel@tonic-gate { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA }, 410Sstevel@tonic-gate { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 420Sstevel@tonic-gate { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 430Sstevel@tonic-gate { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA }, 440Sstevel@tonic-gate { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA }, 450Sstevel@tonic-gate }; 460Sstevel@tonic-gate 470Sstevel@tonic-gate static dtrace_pattr_t fpu_attr = { 480Sstevel@tonic-gate { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA }, 490Sstevel@tonic-gate { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 500Sstevel@tonic-gate { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 510Sstevel@tonic-gate { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_CPU }, 520Sstevel@tonic-gate { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA }, 530Sstevel@tonic-gate }; 540Sstevel@tonic-gate 550Sstevel@tonic-gate static dtrace_pattr_t stab_attr = { 560Sstevel@tonic-gate { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA }, 570Sstevel@tonic-gate { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 580Sstevel@tonic-gate { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 590Sstevel@tonic-gate { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA }, 600Sstevel@tonic-gate { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA }, 610Sstevel@tonic-gate }; 620Sstevel@tonic-gate 630Sstevel@tonic-gate static dtrace_pattr_t sdt_attr = { 640Sstevel@tonic-gate { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA }, 650Sstevel@tonic-gate { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 660Sstevel@tonic-gate { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 670Sstevel@tonic-gate { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA }, 680Sstevel@tonic-gate { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA }, 690Sstevel@tonic-gate }; 700Sstevel@tonic-gate 710Sstevel@tonic-gate sdt_provider_t sdt_providers[] = { 720Sstevel@tonic-gate { "vtrace", "__vtrace_", &vtrace_attr, 0 }, 730Sstevel@tonic-gate { "sysinfo", "__cpu_sysinfo_", &info_attr, 0 }, 740Sstevel@tonic-gate { "vminfo", "__cpu_vminfo_", &info_attr, 0 }, 750Sstevel@tonic-gate { "fpuinfo", "__fpuinfo_", &fpu_attr, 0 }, 760Sstevel@tonic-gate { "sched", "__sched_", &stab_attr, 0 }, 770Sstevel@tonic-gate { "proc", "__proc_", &stab_attr, 0 }, 780Sstevel@tonic-gate { "io", "__io_", &stab_attr, 0 }, 790Sstevel@tonic-gate { "mib", "__mib_", &stab_attr, 0 }, 800Sstevel@tonic-gate { "sdt", NULL, &sdt_attr, 0 }, 810Sstevel@tonic-gate { NULL } 820Sstevel@tonic-gate }; 830Sstevel@tonic-gate 840Sstevel@tonic-gate sdt_argdesc_t sdt_args[] = { 850Sstevel@tonic-gate { "sched", "wakeup", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 860Sstevel@tonic-gate { "sched", "wakeup", 1, 0, "kthread_t *", "psinfo_t *" }, 870Sstevel@tonic-gate { "sched", "dequeue", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 880Sstevel@tonic-gate { "sched", "dequeue", 1, 0, "kthread_t *", "psinfo_t *" }, 890Sstevel@tonic-gate { "sched", "dequeue", 2, 1, "disp_t *", "cpuinfo_t *" }, 900Sstevel@tonic-gate { "sched", "enqueue", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 910Sstevel@tonic-gate { "sched", "enqueue", 1, 0, "kthread_t *", "psinfo_t *" }, 920Sstevel@tonic-gate { "sched", "enqueue", 2, 1, "disp_t *", "cpuinfo_t *" }, 930Sstevel@tonic-gate { "sched", "enqueue", 3, 2, "int" }, 940Sstevel@tonic-gate { "sched", "off-cpu", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 950Sstevel@tonic-gate { "sched", "off-cpu", 1, 0, "kthread_t *", "psinfo_t *" }, 960Sstevel@tonic-gate { "sched", "tick", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 970Sstevel@tonic-gate { "sched", "tick", 1, 0, "kthread_t *", "psinfo_t *" }, 980Sstevel@tonic-gate { "sched", "change-pri", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 990Sstevel@tonic-gate { "sched", "change-pri", 1, 0, "kthread_t *", "psinfo_t *" }, 1000Sstevel@tonic-gate { "sched", "change-pri", 2, 1, "pri_t" }, 1010Sstevel@tonic-gate { "sched", "schedctl-nopreempt", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 1020Sstevel@tonic-gate { "sched", "schedctl-nopreempt", 1, 0, "kthread_t *", "psinfo_t *" }, 1030Sstevel@tonic-gate { "sched", "schedctl-nopreempt", 2, 1, "int" }, 1040Sstevel@tonic-gate { "sched", "schedctl-preempt", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 1050Sstevel@tonic-gate { "sched", "schedctl-preempt", 1, 0, "kthread_t *", "psinfo_t *" }, 106*191Sahl { "sched", "schedctl-yield", 0, 0, "int" }, 107*191Sahl { "sched", "surrender", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 108*191Sahl { "sched", "surrender", 1, 0, "kthread_t *", "psinfo_t *" }, 1090Sstevel@tonic-gate { "proc", "create", 0, 0, "proc_t *", "psinfo_t *" }, 1100Sstevel@tonic-gate { "proc", "exec", 0, 0, "string" }, 1110Sstevel@tonic-gate { "proc", "exec-failure", 0, 0, "int" }, 1120Sstevel@tonic-gate { "proc", "exit", 0, 0, "int" }, 1130Sstevel@tonic-gate { "proc", "fault", 0, 0, "int" }, 1140Sstevel@tonic-gate { "proc", "fault", 1, 1, "siginfo_t *" }, 1150Sstevel@tonic-gate { "proc", "lwp-create", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 1160Sstevel@tonic-gate { "proc", "lwp-create", 1, 0, "kthread_t *", "psinfo_t *" }, 1170Sstevel@tonic-gate { "proc", "signal-clear", 0, 0, "int" }, 1180Sstevel@tonic-gate { "proc", "signal-clear", 1, 1, "siginfo_t *" }, 1190Sstevel@tonic-gate { "proc", "signal-discard", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 1200Sstevel@tonic-gate { "proc", "signal-discard", 1, 1, "proc_t *", "psinfo_t *" }, 1210Sstevel@tonic-gate { "proc", "signal-discard", 2, 2, "int" }, 1220Sstevel@tonic-gate { "proc", "signal-handle", 0, 0, "int" }, 1230Sstevel@tonic-gate { "proc", "signal-handle", 1, 1, "siginfo_t *" }, 1240Sstevel@tonic-gate { "proc", "signal-handle", 2, 2, "void (*)(void)" }, 1250Sstevel@tonic-gate { "proc", "signal-send", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 1260Sstevel@tonic-gate { "proc", "signal-send", 1, 0, "kthread_t *", "psinfo_t *" }, 1270Sstevel@tonic-gate { "proc", "signal-send", 2, 1, "int" }, 1280Sstevel@tonic-gate { "io", "start", 0, 0, "buf_t *", "bufinfo_t *" }, 1290Sstevel@tonic-gate { "io", "start", 1, 0, "buf_t *", "devinfo_t *" }, 1300Sstevel@tonic-gate { "io", "start", 2, 0, "buf_t *", "fileinfo_t *" }, 1310Sstevel@tonic-gate { "io", "done", 0, 0, "buf_t *", "bufinfo_t *" }, 1320Sstevel@tonic-gate { "io", "done", 1, 0, "buf_t *", "devinfo_t *" }, 1330Sstevel@tonic-gate { "io", "done", 2, 0, "buf_t *", "fileinfo_t *" }, 1340Sstevel@tonic-gate { "io", "wait-start", 0, 0, "buf_t *", "bufinfo_t *" }, 1350Sstevel@tonic-gate { "io", "wait-start", 1, 0, "buf_t *", "devinfo_t *" }, 1360Sstevel@tonic-gate { "io", "wait-start", 2, 0, "buf_t *", "fileinfo_t *" }, 1370Sstevel@tonic-gate { "io", "wait-done", 0, 0, "buf_t *", "bufinfo_t *" }, 1380Sstevel@tonic-gate { "io", "wait-done", 1, 0, "buf_t *", "devinfo_t *" }, 1390Sstevel@tonic-gate { "io", "wait-done", 2, 0, "buf_t *", "fileinfo_t *" }, 1400Sstevel@tonic-gate { "mib", NULL, 0, 0, "int" }, 1410Sstevel@tonic-gate { NULL } 1420Sstevel@tonic-gate }; 1430Sstevel@tonic-gate 1440Sstevel@tonic-gate /*ARGSUSED*/ 1450Sstevel@tonic-gate void 1460Sstevel@tonic-gate sdt_getargdesc(void *arg, dtrace_id_t id, void *parg, dtrace_argdesc_t *desc) 1470Sstevel@tonic-gate { 1480Sstevel@tonic-gate sdt_probe_t *sdp = parg; 1490Sstevel@tonic-gate int i; 1500Sstevel@tonic-gate 1510Sstevel@tonic-gate desc->dtargd_native[0] = '\0'; 1520Sstevel@tonic-gate desc->dtargd_xlate[0] = '\0'; 1530Sstevel@tonic-gate 1540Sstevel@tonic-gate for (i = 0; sdt_args[i].sda_provider != NULL; i++) { 1550Sstevel@tonic-gate sdt_argdesc_t *a = &sdt_args[i]; 1560Sstevel@tonic-gate 1570Sstevel@tonic-gate if (strcmp(sdp->sdp_provider->sdtp_name, a->sda_provider) != 0) 1580Sstevel@tonic-gate continue; 1590Sstevel@tonic-gate 1600Sstevel@tonic-gate if (a->sda_name != NULL && 1610Sstevel@tonic-gate strcmp(sdp->sdp_name, a->sda_name) != 0) 1620Sstevel@tonic-gate continue; 1630Sstevel@tonic-gate 1640Sstevel@tonic-gate if (desc->dtargd_ndx != a->sda_ndx) 1650Sstevel@tonic-gate continue; 1660Sstevel@tonic-gate 1670Sstevel@tonic-gate if (a->sda_native != NULL) 1680Sstevel@tonic-gate (void) strcpy(desc->dtargd_native, a->sda_native); 1690Sstevel@tonic-gate 1700Sstevel@tonic-gate if (a->sda_xlate != NULL) 1710Sstevel@tonic-gate (void) strcpy(desc->dtargd_xlate, a->sda_xlate); 1720Sstevel@tonic-gate 1730Sstevel@tonic-gate desc->dtargd_mapping = a->sda_mapping; 1740Sstevel@tonic-gate return; 1750Sstevel@tonic-gate } 1760Sstevel@tonic-gate 1770Sstevel@tonic-gate desc->dtargd_ndx = DTRACE_ARGNONE; 1780Sstevel@tonic-gate } 179