On 19 December 2017 at 05:38, Max Filippov <jcmvb...@gmail.com> wrote:
> Add disas/xtensa.c and use libisa for instruction decoding/opcode name
> lookup.
>
> Signed-off-by: Max Filippov <jcmvb...@gmail.com>

> +    slots = xtensa_format_num_slots(isa, fmt);
> +
> +    if (slots > 1) {
> +        info->fprintf_func(info->stream, "{ ");
> +    }
> +
> +    for (slot = 0; slot < slots; ++slot) {
> +        xtensa_opcode opc;
> +        unsigned opnd, vopnd, opnds;
> +
> +        if (slot) {
> +            info->fprintf_func(info->stream, "; ");
> +        }
> +        xtensa_format_get_slot(isa, fmt, slot, insnbuf, slotbuf);
> +        opc = xtensa_opcode_decode(isa, fmt, slot, slotbuf);
> +        if (opc == XTENSA_UNDEFINED) {
> +            info->fprintf_func(info->stream, "???");
> +            continue;
> +        }
> +        opnds = xtensa_opcode_num_operands(isa, opc);
> +
> +        info->fprintf_func(info->stream, "%s", xtensa_opcode_name(isa, opc));
> +
> +        for (opnd = vopnd = 0; opnd < opnds; ++opnd) {

Hi. Coverity complains here as well (CID 1385149, 1385150)
that the loop bound may be negative if xtensa_format_num_slots() or
xtensa_opcode_num_operands() return -1.


thanks
-- PMM

Reply via email to