/*ARGSUSED*/ static void dt_dis_store(const dtrace_difo_t *dp, const char *name, dif_instr_t in, FILE *fp) { (void) fprintf(fp, "%-4s %%r%u, [%%r%u]", name, DIF_INSTR_R1(in), DIF_INSTR_RD(in)); }
/*ARGSUSED*/ static void dt_dis_call(const dtrace_difo_t *dp, const char *name, dif_instr_t in, FILE *fp) { uint_t subr = DIF_INSTR_SUBR(in); (void) fprintf(fp, "%-4s DIF_SUBR(%u), %%r%u\t\t! %s", name, subr, DIF_INSTR_RD(in), dtrace_subrstr(NULL, subr)); }
/*ARGSUSED*/ static void dis_call(const dtrace_difo_t *dp, const char *name, dif_instr_t instr) { uint_t subr = DIF_INSTR_SUBR(instr); mdb_printf("%-4s DIF_SUBR(%u), %%r%u\t\t! %s", name, subr, DIF_INSTR_RD(instr), dtrace_subrstr(NULL, subr)); }
static void dt_dis_sets(const dtrace_difo_t *dp, const char *name, dif_instr_t in, FILE *fp) { uint_t strptr = DIF_INSTR_STRING(in); (void) fprintf(fp, "%-4s DT_STRING[%u], %%r%u", name, strptr, DIF_INSTR_RD(in)); if (strptr < dp->dtdo_strlen) (void) fprintf(fp, "\t\t! \"%s\"", dp->dtdo_strtab + strptr); }
static void dis_ldv(const dtrace_difo_t *dp, const char *name, dif_instr_t instr) { uint_t var = DIF_INSTR_VAR(instr); const char *vname; mdb_printf("%-4s DIF_VAR(%x), %%r%u", name, var, DIF_INSTR_RD(instr)); if ((vname = dis_varname(dp, var, dis_scope(name))) != NULL) mdb_printf("\t\t! %s", vname); }
static void dt_dis_ldv(const dtrace_difo_t *dp, const char *name, dif_instr_t in, FILE *fp) { uint_t var = DIF_INSTR_VAR(in); const char *vname; (void) fprintf(fp, "%-4s DT_VAR(%u), %%r%u", name, var, DIF_INSTR_RD(in)); if ((vname = dt_dis_varname(dp, var, dt_dis_scope(name))) != NULL) (void) fprintf(fp, "\t\t! DT_VAR(%u) = \"%s\"", var, vname); }
static void dt_dis_setx(const dtrace_difo_t *dp, const char *name, dif_instr_t in, FILE *fp) { uint_t intptr = DIF_INSTR_INTEGER(in); (void) fprintf(fp, "%-4s DT_INTEGER[%u], %%r%u", name, intptr, DIF_INSTR_RD(in)); if (intptr < dp->dtdo_intlen) { (void) fprintf(fp, "\t\t! 0x%llx", (u_longlong_t)dp->dtdo_inttab[intptr]); } }
static void dt_dis_xlate(const dtrace_difo_t *dp, const char *name, dif_instr_t in, FILE *fp) { uint_t xlr = DIF_INSTR_XLREF(in); (void) fprintf(fp, "%-4s DT_XLREF[%u], %%r%u", name, xlr, DIF_INSTR_RD(in)); if (xlr < dp->dtdo_xlmlen) { (void) fprintf(fp, "\t\t! DT_XLREF[%u] = %u.%s", xlr, (uint_t)dp->dtdo_xlmtab[xlr]->dn_membexpr->dn_xlator->dx_id, dp->dtdo_xlmtab[xlr]->dn_membname); } }
static void dis_sets(const dtrace_difo_t *dp, const char *name, dif_instr_t instr) { uint_t strptr = DIF_INSTR_STRING(instr); mdb_printf("%-4s DIF_STRING[%u], %%r%u", name, strptr, DIF_INSTR_RD(instr)); if (dp != NULL && strptr < dp->dtdo_strlen) { char *str = mdb_alloc(dp->dtdo_strlen, UM_SLEEP | UM_GC); if (mdb_vread(str, dp->dtdo_strlen, (uintptr_t)dp->dtdo_strtab) == -1) mdb_warn("failed to read data at %p", dp->dtdo_strtab); else mdb_printf("\t\t! \"%s\"", str + strptr); } }
static void dis_setx(const dtrace_difo_t *dp, const char *name, dif_instr_t instr) { uint_t intptr = DIF_INSTR_INTEGER(instr); mdb_printf("%-4s DIF_INTEGER[%u], %%r%u", name, intptr, DIF_INSTR_RD(instr)); if (dp != NULL && intptr < dp->dtdo_intlen) { uint64_t *ip = mdb_alloc(dp->dtdo_intlen * sizeof (uint64_t), UM_SLEEP | UM_GC); if (mdb_vread(ip, dp->dtdo_intlen * sizeof (uint64_t), (uintptr_t)dp->dtdo_inttab) == -1) mdb_warn("failed to read data at %p", dp->dtdo_inttab); else mdb_printf("\t\t! 0x%llx", ip[intptr]); } }
/* * Rewrite the xlate/xlarg instruction at dtdo_buf[i] so that the instruction's * xltab index reflects the offset 'xi' of the assigned dtdo_xlmtab[] location. * We track the cumulative references to translators and members in the pcb's * pcb_asxrefs[] array, a two-dimensional array of bitmaps indexed by the * global translator id and then by the corresponding translator member id. */ static void dt_as_xlate(dt_pcb_t *pcb, dtrace_difo_t *dp, uint_t i, uint_t xi, dt_node_t *dnp) { dtrace_hdl_t *dtp = pcb->pcb_hdl; dt_xlator_t *dxp = dnp->dn_membexpr->dn_xlator; assert(i < dp->dtdo_len); assert(xi < dp->dtdo_xlmlen); assert(dnp->dn_kind == DT_NODE_MEMBER); assert(dnp->dn_membexpr->dn_kind == DT_NODE_XLATOR); assert(dxp->dx_id < dtp->dt_xlatorid); assert(dnp->dn_membid < dxp->dx_nmembers); if (pcb->pcb_asxrefs == NULL) { pcb->pcb_asxreflen = dtp->dt_xlatorid; pcb->pcb_asxrefs = dt_zalloc(dtp, sizeof (ulong_t *) * pcb->pcb_asxreflen); if (pcb->pcb_asxrefs == NULL) longjmp(pcb->pcb_jmpbuf, EDT_NOMEM); } if (pcb->pcb_asxrefs[dxp->dx_id] == NULL) { pcb->pcb_asxrefs[dxp->dx_id] = dt_zalloc(dtp, BT_SIZEOFMAP(dxp->dx_nmembers)); if (pcb->pcb_asxrefs[dxp->dx_id] == NULL) longjmp(pcb->pcb_jmpbuf, EDT_NOMEM); } dp->dtdo_buf[i] = DIF_INSTR_XLATE( DIF_INSTR_OP(dp->dtdo_buf[i]), xi, DIF_INSTR_RD(dp->dtdo_buf[i])); BT_SET(pcb->pcb_asxrefs[dxp->dx_id], dnp->dn_membid); dp->dtdo_xlmtab[xi] = dnp; }
/*ARGSUSED*/ static void dis_r1rd(const dtrace_difo_t *dp, const char *name, dif_instr_t instr) { mdb_printf("%-4s %%r%u, %%r%u", name, DIF_INSTR_R1(instr), DIF_INSTR_RD(instr)); }
/*ARGSUSED*/ static void dis_xlate(const dtrace_difo_t *dp, const char *name, dif_instr_t instr) { mdb_printf("%-4s DIF_XLREF[%u], %%r%u", name, DIF_INSTR_XLREF(instr), DIF_INSTR_RD(instr)); }