Print this page
4474 DTrace Userland CTF Support
4475 DTrace userland Keyword
4476 DTrace tests should be better citizens
4479 pid provider types
4480 dof emulation missing checks
Reviewed by: Bryan Cantrill <bryan@joyent.com>


   6  * (the "License").  You may not use this file except in compliance
   7  * with the License.
   8  *
   9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10  * or http://www.opensolaris.org/os/licensing.
  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 /*
  23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 #pragma ident   "%Z%%M% %I%     %E% SMI"


  28 
  29 #include <sys/types.h>
  30 #include <strings.h>
  31 #include <stdlib.h>
  32 #include <assert.h>
  33 
  34 #include <dt_impl.h>
  35 #include <dt_parser.h>
  36 #include <dt_as.h>
  37 
  38 void
  39 dt_irlist_create(dt_irlist_t *dlp)
  40 {
  41         bzero(dlp, sizeof (dt_irlist_t));
  42         dlp->dl_label = 1;
  43 }
  44 
  45 void
  46 dt_irlist_destroy(dt_irlist_t *dlp)
  47 {


 108         dvp->dtdv_name = (uint_t)stroff;
 109         dvp->dtdv_id = idp->di_id;
 110         dvp->dtdv_flags = 0;
 111 
 112         dvp->dtdv_kind = (idp->di_kind == DT_IDENT_ARRAY) ?
 113             DIFV_KIND_ARRAY : DIFV_KIND_SCALAR;
 114 
 115         if (idp->di_flags & DT_IDFLG_LOCAL)
 116                 dvp->dtdv_scope = DIFV_SCOPE_LOCAL;
 117         else if (idp->di_flags & DT_IDFLG_TLS)
 118                 dvp->dtdv_scope = DIFV_SCOPE_THREAD;
 119         else
 120                 dvp->dtdv_scope = DIFV_SCOPE_GLOBAL;
 121 
 122         if (idp->di_flags & DT_IDFLG_DIFR)
 123                 dvp->dtdv_flags |= DIFV_F_REF;
 124         if (idp->di_flags & DT_IDFLG_DIFW)
 125                 dvp->dtdv_flags |= DIFV_F_MOD;
 126 
 127         bzero(&dn, sizeof (dn));
 128         dt_node_type_assign(&dn, idp->di_ctfp, idp->di_type);
 129         dt_node_diftype(pcb->pcb_hdl, &dn, &dvp->dtdv_type);
 130 
 131         idp->di_flags &= ~(DT_IDFLG_DIFR | DT_IDFLG_DIFW);
 132         return (0);
 133 }
 134 
 135 static ssize_t
 136 dt_copystr(const char *s, size_t n, size_t off, dt_pcb_t *pcb)
 137 {
 138         bcopy(s, pcb->pcb_difo->dtdo_strtab + off, n);
 139         return (n);
 140 }
 141 
 142 /*
 143  * Rewrite the xlate/xlarg instruction at dtdo_buf[i] so that the instruction's
 144  * xltab index reflects the offset 'xi' of the assigned dtdo_xlmtab[] location.
 145  * We track the cumulative references to translators and members in the pcb's
 146  * pcb_asxrefs[] array, a two-dimensional array of bitmaps indexed by the
 147  * global translator id and then by the corresponding translator member id.
 148  */




   6  * (the "License").  You may not use this file except in compliance
   7  * with the License.
   8  *
   9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10  * or http://www.opensolaris.org/os/licensing.
  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 /*
  23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 /*
  27  * Copyright (c) 2013 by Delphix. All rights reserved.
  28  * Copyright (c) 2013 Joyent, Inc. All rights reserved.
  29  */
  30 
  31 #include <sys/types.h>
  32 #include <strings.h>
  33 #include <stdlib.h>
  34 #include <assert.h>
  35 
  36 #include <dt_impl.h>
  37 #include <dt_parser.h>
  38 #include <dt_as.h>
  39 
  40 void
  41 dt_irlist_create(dt_irlist_t *dlp)
  42 {
  43         bzero(dlp, sizeof (dt_irlist_t));
  44         dlp->dl_label = 1;
  45 }
  46 
  47 void
  48 dt_irlist_destroy(dt_irlist_t *dlp)
  49 {


 110         dvp->dtdv_name = (uint_t)stroff;
 111         dvp->dtdv_id = idp->di_id;
 112         dvp->dtdv_flags = 0;
 113 
 114         dvp->dtdv_kind = (idp->di_kind == DT_IDENT_ARRAY) ?
 115             DIFV_KIND_ARRAY : DIFV_KIND_SCALAR;
 116 
 117         if (idp->di_flags & DT_IDFLG_LOCAL)
 118                 dvp->dtdv_scope = DIFV_SCOPE_LOCAL;
 119         else if (idp->di_flags & DT_IDFLG_TLS)
 120                 dvp->dtdv_scope = DIFV_SCOPE_THREAD;
 121         else
 122                 dvp->dtdv_scope = DIFV_SCOPE_GLOBAL;
 123 
 124         if (idp->di_flags & DT_IDFLG_DIFR)
 125                 dvp->dtdv_flags |= DIFV_F_REF;
 126         if (idp->di_flags & DT_IDFLG_DIFW)
 127                 dvp->dtdv_flags |= DIFV_F_MOD;
 128 
 129         bzero(&dn, sizeof (dn));
 130         dt_node_type_assign(&dn, idp->di_ctfp, idp->di_type, B_FALSE);
 131         dt_node_diftype(pcb->pcb_hdl, &dn, &dvp->dtdv_type);
 132 
 133         idp->di_flags &= ~(DT_IDFLG_DIFR | DT_IDFLG_DIFW);
 134         return (0);
 135 }
 136 
 137 static ssize_t
 138 dt_copystr(const char *s, size_t n, size_t off, dt_pcb_t *pcb)
 139 {
 140         bcopy(s, pcb->pcb_difo->dtdo_strtab + off, n);
 141         return (n);
 142 }
 143 
 144 /*
 145  * Rewrite the xlate/xlarg instruction at dtdo_buf[i] so that the instruction's
 146  * xltab index reflects the offset 'xi' of the assigned dtdo_xlmtab[] location.
 147  * We track the cumulative references to translators and members in the pcb's
 148  * pcb_asxrefs[] array, a two-dimensional array of bitmaps indexed by the
 149  * global translator id and then by the corresponding translator member id.
 150  */