Lines Matching defs:ddo

46 	dt_dof_t *ddo = &dtp->dt_dof;
48 ddo->ddo_hdl = dtp;
49 ddo->ddo_nsecs = 0;
50 ddo->ddo_strsec = DOF_SECIDX_NONE;
51 ddo->ddo_xlimport = NULL;
52 ddo->ddo_xlexport = NULL;
54 dt_buf_create(dtp, &ddo->ddo_secs, "section headers", 0);
55 dt_buf_create(dtp, &ddo->ddo_strs, "string table", 0);
56 dt_buf_create(dtp, &ddo->ddo_ldata, "loadable data", 0);
57 dt_buf_create(dtp, &ddo->ddo_udata, "unloadable data", 0);
59 dt_buf_create(dtp, &ddo->ddo_probes, "probe data", 0);
60 dt_buf_create(dtp, &ddo->ddo_args, "probe args", 0);
61 dt_buf_create(dtp, &ddo->ddo_offs, "probe offs", 0);
62 dt_buf_create(dtp, &ddo->ddo_enoffs, "probe is-enabled offs", 0);
63 dt_buf_create(dtp, &ddo->ddo_rels, "probe rels", 0);
65 dt_buf_create(dtp, &ddo->ddo_xlms, "xlate members", 0);
71 dt_dof_t *ddo = &dtp->dt_dof;
73 dt_free(dtp, ddo->ddo_xlimport);
74 dt_free(dtp, ddo->ddo_xlexport);
76 dt_buf_destroy(dtp, &ddo->ddo_secs);
77 dt_buf_destroy(dtp, &ddo->ddo_strs);
78 dt_buf_destroy(dtp, &ddo->ddo_ldata);
79 dt_buf_destroy(dtp, &ddo->ddo_udata);
81 dt_buf_destroy(dtp, &ddo->ddo_probes);
82 dt_buf_destroy(dtp, &ddo->ddo_args);
83 dt_buf_destroy(dtp, &ddo->ddo_offs);
84 dt_buf_destroy(dtp, &ddo->ddo_enoffs);
85 dt_buf_destroy(dtp, &ddo->ddo_rels);
87 dt_buf_destroy(dtp, &ddo->ddo_xlms);
93 dt_dof_t *ddo = &dtp->dt_dof;
96 assert(ddo->ddo_hdl == dtp);
97 ddo->ddo_pgp = pgp;
99 ddo->ddo_nsecs = 0;
100 ddo->ddo_strsec = DOF_SECIDX_NONE;
102 dt_free(dtp, ddo->ddo_xlimport);
103 dt_free(dtp, ddo->ddo_xlexport);
105 ddo->ddo_xlimport = dt_alloc(dtp, sizeof (dof_secidx_t) * nx);
106 ddo->ddo_xlexport = dt_alloc(dtp, sizeof (dof_secidx_t) * nx);
108 if (nx != 0 && (ddo->ddo_xlimport == NULL || ddo->ddo_xlexport == NULL))
112 ddo->ddo_xlimport[i] = DOF_SECIDX_NONE;
113 ddo->ddo_xlexport[i] = DOF_SECIDX_NONE;
116 dt_buf_reset(dtp, &ddo->ddo_secs);
117 dt_buf_reset(dtp, &ddo->ddo_strs);
118 dt_buf_reset(dtp, &ddo->ddo_ldata);
119 dt_buf_reset(dtp, &ddo->ddo_udata);
121 dt_buf_reset(dtp, &ddo->ddo_probes);
122 dt_buf_reset(dtp, &ddo->ddo_args);
123 dt_buf_reset(dtp, &ddo->ddo_offs);
124 dt_buf_reset(dtp, &ddo->ddo_enoffs);
125 dt_buf_reset(dtp, &ddo->ddo_rels);
127 dt_buf_reset(dtp, &ddo->ddo_xlms);
137 dof_add_lsect(dt_dof_t *ddo, const void *data, uint32_t type,
140 dtrace_hdl_t *dtp = ddo->ddo_hdl;
147 s.dofs_offset = dt_buf_offset(&ddo->ddo_ldata, align);
150 dt_buf_write(dtp, &ddo->ddo_secs, &s, sizeof (s), sizeof (uint64_t));
153 dt_buf_write(dtp, &ddo->ddo_ldata, data, size, align);
155 return (ddo->ddo_nsecs++);
164 dof_add_usect(dt_dof_t *ddo, const void *data, uint32_t type,
167 dtrace_hdl_t *dtp = ddo->ddo_hdl;
174 s.dofs_offset = dt_buf_offset(&ddo->ddo_udata, align);
177 dt_buf_write(dtp, &ddo->ddo_secs, &s, sizeof (s), sizeof (uint64_t));
180 dt_buf_write(dtp, &ddo->ddo_udata, data, size, align);
182 return (ddo->ddo_nsecs++);
190 dof_add_string(dt_dof_t *ddo, const char *s)
192 dt_buf_t *bp = &ddo->ddo_strs;
198 dt_buf_write(ddo->ddo_hdl, bp, s, strlen(s) + 1, sizeof (char));
209 dof_add_difo(dt_dof_t *ddo, const dtrace_difo_t *dp)
223 dsecs[nsecs++] = dof_add_lsect(ddo, dp->dtdo_buf,
229 dsecs[nsecs++] = intsec = dof_add_lsect(ddo, dp->dtdo_inttab,
235 dsecs[nsecs++] = strsec = dof_add_lsect(ddo, dp->dtdo_strtab,
240 dsecs[nsecs++] = dof_add_lsect(ddo, dp->dtdo_vartab,
263 xlp->dofxr_xlator = ddo->ddo_xlimport[dxp->dx_id];
265 ddo->ddo_pgp->dp_xrefs[dxp->dx_id], dnp->dn_membid);
269 dsecs[nsecs++] = dof_add_lsect(ddo, xlt, DOF_SECT_XLTAB,
283 hdrsec = dof_add_lsect(ddo, dofd, DOF_SECT_DIFOHDR,
292 relsec = dof_add_lsect(ddo, dp->dtdo_kreltab, DOF_SECT_RELTAB,
305 (void) dof_add_lsect(ddo, &dofr, DOF_SECT_KRELHDR,
310 relsec = dof_add_lsect(ddo, dp->dtdo_ureltab, DOF_SECT_RELTAB,
323 (void) dof_add_lsect(ddo, &dofr, DOF_SECT_URELHDR,
331 dof_add_translator(dt_dof_t *ddo, const dt_xlator_t *dxp, uint_t type)
333 dtrace_hdl_t *dtp = ddo->ddo_hdl;
343 xst = type == DOF_SECT_XLIMPORT ? ddo->ddo_xlimport : ddo->ddo_xlexport;
348 dt_buf_reset(dtp, &ddo->ddo_xlms);
358 if (!BT_TEST(ddo->ddo_pgp->dp_xrefs[dxp->dx_id], i))
362 dofxm.dofxm_difo = dof_add_difo(ddo,
366 dofxm.dofxm_name = dof_add_string(ddo, dnp->dn_membname);
369 dt_buf_write(dtp, &ddo->ddo_xlms,
373 dofxl.dofxl_members = dof_add_lsect(ddo, NULL, DOF_SECT_XLMEMBERS,
374 sizeof (uint32_t), 0, sizeof (dofxm), dt_buf_len(&ddo->ddo_xlms));
376 dt_buf_concat(dtp, &ddo->ddo_ldata, &ddo->ddo_xlms, sizeof (uint32_t));
378 dofxl.dofxl_strtab = ddo->ddo_strsec;
379 dofxl.dofxl_argv = dof_add_string(ddo, ctf_type_name(
382 dofxl.dofxl_type = dof_add_string(ddo, ctf_type_name(
386 xst[dxp->dx_id] = dof_add_lsect(ddo, &dofxl, type,
394 dt_dof_t *ddo = data;
395 dtrace_hdl_t *dtp = ddo->ddo_hdl;
407 dofpr.dofpr_name = dof_add_string(ddo, prp->pr_name);
408 dofpr.dofpr_nargv = dt_buf_len(&ddo->ddo_strs);
411 (void) dof_add_string(ddo, ctf_type_name(dnp->dn_ctfp,
415 dofpr.dofpr_xargv = dt_buf_len(&ddo->ddo_strs);
418 (void) dof_add_string(ddo, ctf_type_name(dnp->dn_ctfp,
422 dofpr.dofpr_argidx = dt_buf_len(&ddo->ddo_args) / sizeof (uint8_t);
425 dt_buf_write(dtp, &ddo->ddo_args, &prp->pr_mapping[i],
438 dofpr.dofpr_func = dof_add_string(ddo, pip->pi_fname);
448 dt_buf_len(&ddo->ddo_offs) / sizeof (uint32_t);
450 dt_buf_write(dtp, &ddo->ddo_offs, pip->pi_offs,
454 dt_buf_len(&ddo->ddo_enoffs) / sizeof (uint32_t);
456 dt_buf_write(dtp, &ddo->ddo_enoffs, pip->pi_enoffs,
469 dofr.dofr_name = dof_add_string(ddo, pip->pi_rname);
471 dofr.dofr_offset = dt_buf_len(&ddo->ddo_probes);
474 dt_buf_write(dtp, &ddo->ddo_rels, &dofr,
477 dt_buf_write(dtp, &ddo->ddo_probes, &dofpr,
485 dof_add_provider(dt_dof_t *ddo, const dt_provider_t *pvp)
487 dtrace_hdl_t *dtp = ddo->ddo_hdl;
509 dof_add_translator(ddo,
511 dofs[xr++] = ddo->ddo_xlexport[i];
515 dt_buf_reset(dtp, &ddo->ddo_probes);
516 dt_buf_reset(dtp, &ddo->ddo_args);
517 dt_buf_reset(dtp, &ddo->ddo_offs);
518 dt_buf_reset(dtp, &ddo->ddo_enoffs);
519 dt_buf_reset(dtp, &ddo->ddo_rels);
521 (void) dt_idhash_iter(pvp->pv_probes, dof_add_probe, ddo);
523 dofpv.dofpv_probes = dof_add_lsect(ddo, NULL, DOF_SECT_PROBES,
525 dt_buf_len(&ddo->ddo_probes));
527 dt_buf_concat(dtp, &ddo->ddo_ldata,
528 &ddo->ddo_probes, sizeof (uint64_t));
530 dofpv.dofpv_prargs = dof_add_lsect(ddo, NULL, DOF_SECT_PRARGS,
531 sizeof (uint8_t), 0, sizeof (uint8_t), dt_buf_len(&ddo->ddo_args));
533 dt_buf_concat(dtp, &ddo->ddo_ldata, &ddo->ddo_args, sizeof (uint8_t));
535 dofpv.dofpv_proffs = dof_add_lsect(ddo, NULL, DOF_SECT_PROFFS,
536 sizeof (uint_t), 0, sizeof (uint_t), dt_buf_len(&ddo->ddo_offs));
538 dt_buf_concat(dtp, &ddo->ddo_ldata, &ddo->ddo_offs, sizeof (uint_t));
540 if ((sz = dt_buf_len(&ddo->ddo_enoffs)) != 0) {
541 dofpv.dofpv_prenoffs = dof_add_lsect(ddo, NULL,
547 dt_buf_concat(dtp, &ddo->ddo_ldata, &ddo->ddo_enoffs, sizeof (uint_t));
549 dofpv.dofpv_strtab = ddo->ddo_strsec;
550 dofpv.dofpv_name = dof_add_string(ddo, pvp->pv_desc.dtvd_name);
558 dofs[0] = dof_add_lsect(ddo, &dofpv, DOF_SECT_PROVIDER,
563 dofr.dofr_relsec = dof_add_lsect(ddo, NULL, DOF_SECT_RELTAB,
565 dt_buf_len(&ddo->ddo_rels));
567 dt_buf_concat(dtp, &ddo->ddo_ldata, &ddo->ddo_rels, sizeof (uint64_t));
569 (void) dof_add_lsect(ddo, &dofr, DOF_SECT_URELHDR,
573 (void) dof_add_lsect(ddo, dofs, DOF_SECT_PREXPORT,
620 dt_dof_t *ddo = &dtp->dt_dof;
682 ddo->ddo_strsec = dof_add_lsect(ddo, NULL, DOF_SECT_STRTAB, 1, 0, 0, 0);
683 (void) dof_add_string(ddo, "");
694 dof_add_translator(ddo, dxp, DOF_SECT_XLIMPORT);
725 dofp.dofp_strtab = ddo->ddo_strsec;
726 dofp.dofp_provider = dof_add_string(ddo, pdp->dtpd_provider);
727 dofp.dofp_mod = dof_add_string(ddo, pdp->dtpd_mod);
728 dofp.dofp_func = dof_add_string(ddo, pdp->dtpd_func);
729 dofp.dofp_name = dof_add_string(ddo, pdp->dtpd_name);
732 probesec = dof_add_lsect(ddo, &dofp, DOF_SECT_PROBEDESC,
741 prdsec = dof_add_difo(ddo, edp->dted_pred.dtpdd_difo);
752 dof_add_difo(ddo, ap->dtad_difo);
764 strndx = dof_add_string(ddo, fmt);
776 dofa[i].dofa_strtab = ddo->ddo_strsec;
788 actsec = dof_add_lsect(ddo, dofa, DOF_SECT_ACTDESC,
803 (void) dof_add_lsect(ddo, &dofe, DOF_SECT_ECBDESC,
814 dof_add_provider(ddo, pvp);
822 (void) dof_add_usect(ddo, _dtrace_version, DOF_SECT_COMMENTS,
824 (void) dof_add_usect(ddo, &dtp->dt_uts, DOF_SECT_UTSNAME,
832 h.dofh_secnum = ddo->ddo_nsecs;
833 ssize = sizeof (h) + dt_buf_len(&ddo->ddo_secs);
836 dt_buf_len(&ddo->ddo_ldata) +
837 dt_buf_len(&ddo->ddo_strs);
839 if (dt_buf_len(&ddo->ddo_udata) != 0) {
841 h.dofh_filesz = lsize + dt_buf_len(&ddo->ddo_udata);
852 if ((i = dt_buf_error(&ddo->ddo_secs)) != 0) {
857 sp = dt_buf_ptr(&ddo->ddo_secs);
858 assert(sp[ddo->ddo_strsec].dofs_type == DOF_SECT_STRTAB);
859 assert(ssize == sizeof (h) + sizeof (dof_sec_t) * ddo->ddo_nsecs);
861 sp[ddo->ddo_strsec].dofs_offset = ssize + dt_buf_len(&ddo->ddo_ldata);
862 sp[ddo->ddo_strsec].dofs_size = dt_buf_len(&ddo->ddo_strs);
868 for (i = 0; i < ddo->ddo_nsecs; i++, sp++) {
869 if (i == ddo->ddo_strsec)
886 dt_buf_concat(dtp, &dof, &ddo->ddo_secs, sizeof (uint64_t));
887 dt_buf_concat(dtp, &dof, &ddo->ddo_ldata, sizeof (uint64_t));
888 dt_buf_concat(dtp, &dof, &ddo->ddo_strs, sizeof (char));
889 dt_buf_concat(dtp, &dof, &ddo->ddo_udata, sizeof (uint64_t));