1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate /* 23*0Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 24*0Sstevel@tonic-gate * Use is subject to license terms. 25*0Sstevel@tonic-gate */ 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 28*0Sstevel@tonic-gate 29*0Sstevel@tonic-gate #include <sys/sdt_impl.h> 30*0Sstevel@tonic-gate 31*0Sstevel@tonic-gate static dtrace_pattr_t vtrace_attr = { 32*0Sstevel@tonic-gate { DTRACE_STABILITY_UNSTABLE, DTRACE_STABILITY_UNSTABLE, DTRACE_CLASS_ISA }, 33*0Sstevel@tonic-gate { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 34*0Sstevel@tonic-gate { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 35*0Sstevel@tonic-gate { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 36*0Sstevel@tonic-gate { DTRACE_STABILITY_UNSTABLE, DTRACE_STABILITY_UNSTABLE, DTRACE_CLASS_ISA }, 37*0Sstevel@tonic-gate }; 38*0Sstevel@tonic-gate 39*0Sstevel@tonic-gate static dtrace_pattr_t info_attr = { 40*0Sstevel@tonic-gate { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA }, 41*0Sstevel@tonic-gate { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 42*0Sstevel@tonic-gate { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 43*0Sstevel@tonic-gate { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA }, 44*0Sstevel@tonic-gate { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA }, 45*0Sstevel@tonic-gate }; 46*0Sstevel@tonic-gate 47*0Sstevel@tonic-gate static dtrace_pattr_t fpu_attr = { 48*0Sstevel@tonic-gate { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA }, 49*0Sstevel@tonic-gate { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 50*0Sstevel@tonic-gate { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 51*0Sstevel@tonic-gate { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_CPU }, 52*0Sstevel@tonic-gate { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA }, 53*0Sstevel@tonic-gate }; 54*0Sstevel@tonic-gate 55*0Sstevel@tonic-gate static dtrace_pattr_t stab_attr = { 56*0Sstevel@tonic-gate { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA }, 57*0Sstevel@tonic-gate { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 58*0Sstevel@tonic-gate { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 59*0Sstevel@tonic-gate { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA }, 60*0Sstevel@tonic-gate { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA }, 61*0Sstevel@tonic-gate }; 62*0Sstevel@tonic-gate 63*0Sstevel@tonic-gate static dtrace_pattr_t sdt_attr = { 64*0Sstevel@tonic-gate { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA }, 65*0Sstevel@tonic-gate { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 66*0Sstevel@tonic-gate { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 67*0Sstevel@tonic-gate { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA }, 68*0Sstevel@tonic-gate { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA }, 69*0Sstevel@tonic-gate }; 70*0Sstevel@tonic-gate 71*0Sstevel@tonic-gate sdt_provider_t sdt_providers[] = { 72*0Sstevel@tonic-gate { "vtrace", "__vtrace_", &vtrace_attr, 0 }, 73*0Sstevel@tonic-gate { "sysinfo", "__cpu_sysinfo_", &info_attr, 0 }, 74*0Sstevel@tonic-gate { "vminfo", "__cpu_vminfo_", &info_attr, 0 }, 75*0Sstevel@tonic-gate { "fpuinfo", "__fpuinfo_", &fpu_attr, 0 }, 76*0Sstevel@tonic-gate { "sched", "__sched_", &stab_attr, 0 }, 77*0Sstevel@tonic-gate { "proc", "__proc_", &stab_attr, 0 }, 78*0Sstevel@tonic-gate { "io", "__io_", &stab_attr, 0 }, 79*0Sstevel@tonic-gate { "mib", "__mib_", &stab_attr, 0 }, 80*0Sstevel@tonic-gate { "sdt", NULL, &sdt_attr, 0 }, 81*0Sstevel@tonic-gate { NULL } 82*0Sstevel@tonic-gate }; 83*0Sstevel@tonic-gate 84*0Sstevel@tonic-gate sdt_argdesc_t sdt_args[] = { 85*0Sstevel@tonic-gate { "sched", "wakeup", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 86*0Sstevel@tonic-gate { "sched", "wakeup", 1, 0, "kthread_t *", "psinfo_t *" }, 87*0Sstevel@tonic-gate { "sched", "dequeue", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 88*0Sstevel@tonic-gate { "sched", "dequeue", 1, 0, "kthread_t *", "psinfo_t *" }, 89*0Sstevel@tonic-gate { "sched", "dequeue", 2, 1, "disp_t *", "cpuinfo_t *" }, 90*0Sstevel@tonic-gate { "sched", "enqueue", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 91*0Sstevel@tonic-gate { "sched", "enqueue", 1, 0, "kthread_t *", "psinfo_t *" }, 92*0Sstevel@tonic-gate { "sched", "enqueue", 2, 1, "disp_t *", "cpuinfo_t *" }, 93*0Sstevel@tonic-gate { "sched", "enqueue", 3, 2, "int" }, 94*0Sstevel@tonic-gate { "sched", "off-cpu", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 95*0Sstevel@tonic-gate { "sched", "off-cpu", 1, 0, "kthread_t *", "psinfo_t *" }, 96*0Sstevel@tonic-gate { "sched", "tick", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 97*0Sstevel@tonic-gate { "sched", "tick", 1, 0, "kthread_t *", "psinfo_t *" }, 98*0Sstevel@tonic-gate { "sched", "change-pri", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 99*0Sstevel@tonic-gate { "sched", "change-pri", 1, 0, "kthread_t *", "psinfo_t *" }, 100*0Sstevel@tonic-gate { "sched", "change-pri", 2, 1, "pri_t" }, 101*0Sstevel@tonic-gate { "sched", "schedctl-nopreempt", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 102*0Sstevel@tonic-gate { "sched", "schedctl-nopreempt", 1, 0, "kthread_t *", "psinfo_t *" }, 103*0Sstevel@tonic-gate { "sched", "schedctl-nopreempt", 2, 1, "int" }, 104*0Sstevel@tonic-gate { "sched", "schedctl-preempt", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 105*0Sstevel@tonic-gate { "sched", "schedctl-preempt", 1, 0, "kthread_t *", "psinfo_t *" }, 106*0Sstevel@tonic-gate { "proc", "create", 0, 0, "proc_t *", "psinfo_t *" }, 107*0Sstevel@tonic-gate { "proc", "exec", 0, 0, "string" }, 108*0Sstevel@tonic-gate { "proc", "exec-failure", 0, 0, "int" }, 109*0Sstevel@tonic-gate { "proc", "exit", 0, 0, "int" }, 110*0Sstevel@tonic-gate { "proc", "fault", 0, 0, "int" }, 111*0Sstevel@tonic-gate { "proc", "fault", 1, 1, "siginfo_t *" }, 112*0Sstevel@tonic-gate { "proc", "lwp-create", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 113*0Sstevel@tonic-gate { "proc", "lwp-create", 1, 0, "kthread_t *", "psinfo_t *" }, 114*0Sstevel@tonic-gate { "proc", "signal-clear", 0, 0, "int" }, 115*0Sstevel@tonic-gate { "proc", "signal-clear", 1, 1, "siginfo_t *" }, 116*0Sstevel@tonic-gate { "proc", "signal-discard", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 117*0Sstevel@tonic-gate { "proc", "signal-discard", 1, 1, "proc_t *", "psinfo_t *" }, 118*0Sstevel@tonic-gate { "proc", "signal-discard", 2, 2, "int" }, 119*0Sstevel@tonic-gate { "proc", "signal-handle", 0, 0, "int" }, 120*0Sstevel@tonic-gate { "proc", "signal-handle", 1, 1, "siginfo_t *" }, 121*0Sstevel@tonic-gate { "proc", "signal-handle", 2, 2, "void (*)(void)" }, 122*0Sstevel@tonic-gate { "proc", "signal-send", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 123*0Sstevel@tonic-gate { "proc", "signal-send", 1, 0, "kthread_t *", "psinfo_t *" }, 124*0Sstevel@tonic-gate { "proc", "signal-send", 2, 1, "int" }, 125*0Sstevel@tonic-gate { "io", "start", 0, 0, "buf_t *", "bufinfo_t *" }, 126*0Sstevel@tonic-gate { "io", "start", 1, 0, "buf_t *", "devinfo_t *" }, 127*0Sstevel@tonic-gate { "io", "start", 2, 0, "buf_t *", "fileinfo_t *" }, 128*0Sstevel@tonic-gate { "io", "done", 0, 0, "buf_t *", "bufinfo_t *" }, 129*0Sstevel@tonic-gate { "io", "done", 1, 0, "buf_t *", "devinfo_t *" }, 130*0Sstevel@tonic-gate { "io", "done", 2, 0, "buf_t *", "fileinfo_t *" }, 131*0Sstevel@tonic-gate { "io", "wait-start", 0, 0, "buf_t *", "bufinfo_t *" }, 132*0Sstevel@tonic-gate { "io", "wait-start", 1, 0, "buf_t *", "devinfo_t *" }, 133*0Sstevel@tonic-gate { "io", "wait-start", 2, 0, "buf_t *", "fileinfo_t *" }, 134*0Sstevel@tonic-gate { "io", "wait-done", 0, 0, "buf_t *", "bufinfo_t *" }, 135*0Sstevel@tonic-gate { "io", "wait-done", 1, 0, "buf_t *", "devinfo_t *" }, 136*0Sstevel@tonic-gate { "io", "wait-done", 2, 0, "buf_t *", "fileinfo_t *" }, 137*0Sstevel@tonic-gate { "mib", NULL, 0, 0, "int" }, 138*0Sstevel@tonic-gate { NULL } 139*0Sstevel@tonic-gate }; 140*0Sstevel@tonic-gate 141*0Sstevel@tonic-gate /*ARGSUSED*/ 142*0Sstevel@tonic-gate void 143*0Sstevel@tonic-gate sdt_getargdesc(void *arg, dtrace_id_t id, void *parg, dtrace_argdesc_t *desc) 144*0Sstevel@tonic-gate { 145*0Sstevel@tonic-gate sdt_probe_t *sdp = parg; 146*0Sstevel@tonic-gate int i; 147*0Sstevel@tonic-gate 148*0Sstevel@tonic-gate desc->dtargd_native[0] = '\0'; 149*0Sstevel@tonic-gate desc->dtargd_xlate[0] = '\0'; 150*0Sstevel@tonic-gate 151*0Sstevel@tonic-gate for (i = 0; sdt_args[i].sda_provider != NULL; i++) { 152*0Sstevel@tonic-gate sdt_argdesc_t *a = &sdt_args[i]; 153*0Sstevel@tonic-gate 154*0Sstevel@tonic-gate if (strcmp(sdp->sdp_provider->sdtp_name, a->sda_provider) != 0) 155*0Sstevel@tonic-gate continue; 156*0Sstevel@tonic-gate 157*0Sstevel@tonic-gate if (a->sda_name != NULL && 158*0Sstevel@tonic-gate strcmp(sdp->sdp_name, a->sda_name) != 0) 159*0Sstevel@tonic-gate continue; 160*0Sstevel@tonic-gate 161*0Sstevel@tonic-gate if (desc->dtargd_ndx != a->sda_ndx) 162*0Sstevel@tonic-gate continue; 163*0Sstevel@tonic-gate 164*0Sstevel@tonic-gate if (a->sda_native != NULL) 165*0Sstevel@tonic-gate (void) strcpy(desc->dtargd_native, a->sda_native); 166*0Sstevel@tonic-gate 167*0Sstevel@tonic-gate if (a->sda_xlate != NULL) 168*0Sstevel@tonic-gate (void) strcpy(desc->dtargd_xlate, a->sda_xlate); 169*0Sstevel@tonic-gate 170*0Sstevel@tonic-gate desc->dtargd_mapping = a->sda_mapping; 171*0Sstevel@tonic-gate return; 172*0Sstevel@tonic-gate } 173*0Sstevel@tonic-gate 174*0Sstevel@tonic-gate desc->dtargd_ndx = DTRACE_ARGNONE; 175*0Sstevel@tonic-gate } 176