qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 16/16] target/xtensa: implement disassembler


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH v2 16/16] target/xtensa: implement disassembler
Date: Thu, 18 Jan 2018 13:34:07 +0000

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

> +    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

[Prev in Thread] Current Thread [Next in Thread]