Print this page
patch fixup2
*** 2476,2491 ****
[IF_SSf] = fmt_ss_f,
[IF_SSE] = fmt_sse,
[IF_SSF] = fmt_ssf,
};
! static int
dis_s390(uint64_t addr, union inst *inst, char *buf, size_t buflen, int mach)
{
const struct inst_table *tbl = &tbl_xx[inst->raw[0]];
int tmp;
while (tbl->it_fmt == IF_TBL || tbl->it_fmt == IF_MULTI) {
if (tbl->it_fmt == IF_TBL) {
int idx;
idx = inst->raw[tbl->it_u.it_table.it_off];
--- 2476,2500 ----
[IF_SSf] = fmt_ss_f,
[IF_SSE] = fmt_sse,
[IF_SSF] = fmt_ssf,
};
! /*
! * Even if we don't know how to disassemble the instruction, we know how long
! * it is, so we always succeed. That is why we can get away with returning
! * void.
! */
! static void
dis_s390(uint64_t addr, union inst *inst, char *buf, size_t buflen, int mach)
{
const struct inst_table *tbl = &tbl_xx[inst->raw[0]];
int tmp;
+ /* nothing to do */
+ if (buflen == 0)
+ return;
+
while (tbl->it_fmt == IF_TBL || tbl->it_fmt == IF_MULTI) {
if (tbl->it_fmt == IF_TBL) {
int idx;
idx = inst->raw[tbl->it_u.it_table.it_off];
*** 2503,2526 ****
if ((tbl->it_u.it_inst.it_flags & mach) == 0)
goto inval;
tmp = snprintf(buf, buflen, "%-7s ", tbl->it_u.it_inst.it_name);
fmt_fxns[tbl->it_fmt](addr, inst, buf + tmp, buflen - tmp,
tbl->it_u.it_inst.it_flags);
! return (0);
inval:
(void) snprintf(buf, buflen, "??");
-
- /*
- * Even if we don't know how to disassemble the instruction, we know
- * how long it is, so we "succeed" even when we fail.
- */
- return (0);
}
static int
dis_s390_supports_flags(int flags)
{
--- 2512,2531 ----
if ((tbl->it_u.it_inst.it_flags & mach) == 0)
goto inval;
tmp = snprintf(buf, buflen, "%-7s ", tbl->it_u.it_inst.it_name);
+ if (tmp < 0)
+ return;
fmt_fxns[tbl->it_fmt](addr, inst, buf + tmp, buflen - tmp,
tbl->it_u.it_inst.it_flags);
! return;
inval:
(void) snprintf(buf, buflen, "??");
}
static int
dis_s390_supports_flags(int flags)
{
*** 2560,2570 ****
case DIS_S390_64:
mach = F_Z;
break;
}
! return (dis_s390(addr, &inst, buf, buflen, mach));
}
/* ARGSUSED */
static int
dis_s390_min_instrlen(dis_handle_t *dhp)
--- 2565,2577 ----
case DIS_S390_64:
mach = F_Z;
break;
}
! dis_s390(addr, &inst, buf, buflen, mach);
!
! return (0);
}
/* ARGSUSED */
static int
dis_s390_min_instrlen(dis_handle_t *dhp)