qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Huang Tao <eric.huang@linux.alibaba.com>, qemu-devel@nongnu.org
Cc: qemu-riscv@nongnu.org, zhiwei_liu@linux.alibaba.com,
	dbarboza@ventanamicro.com, liwei1518@gmail.com,
	bin.meng@windriver.com, alistair.francis@wdc.com,
	palmer@dabbelt.com,
	Christoph Muellner <christoph.muellner@vrull.eu>
Subject: Re: [PATCH v2] target/riscv: Implement dynamic establishment of custom decoder
Date: Tue, 12 Mar 2024 03:57:39 -1000	[thread overview]
Message-ID: <8f23924f-af5c-4bc1-94f1-143bc5c8184d@linaro.org> (raw)
In-Reply-To: <20240312054553.11811-1-eric.huang@linux.alibaba.com>

On 3/11/24 19:45, Huang Tao wrote:
> +static void riscv_cpu_finalize_dynamic_decoder(RISCVCPU *cpu)
> +{
> +    decode_fn *dynamic_decoders;
> +    dynamic_decoders = g_new0(decode_fn, decoder_table_size);

Allocating ARRAY_SIZE(decoder_table)...

> +    int j = 0;
> +    for (size_t i = 0; i < decoder_table_size; ++i) {
> +        if (decoder_table[i].guard_func &&
> +            decoder_table[i].guard_func(&cpu->cfg)) {
> +            dynamic_decoders[j] = decoder_table[i].decode_fn;
> +            j++;
> +        }

Potentially enabling all elements...

> +        for (size_t i = 0; ctx->decoders[i]; ++i) {

Reading past the end of the array expecting an extra NULL entry.


r~


  reply	other threads:[~2024-03-12 13:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-12  5:45 [PATCH v2] target/riscv: Implement dynamic establishment of custom decoder Huang Tao
2024-03-12 13:57 ` Richard Henderson [this message]
2024-03-13  8:38   ` Huang Tao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8f23924f-af5c-4bc1-94f1-143bc5c8184d@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=alistair.francis@wdc.com \
    --cc=bin.meng@windriver.com \
    --cc=christoph.muellner@vrull.eu \
    --cc=dbarboza@ventanamicro.com \
    --cc=eric.huang@linux.alibaba.com \
    --cc=liwei1518@gmail.com \
    --cc=palmer@dabbelt.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=zhiwei_liu@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).