qemu-riscv
[Top][All Lists]
Advanced

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

Re: [PATCH v2] target/riscv: Implement dynamic establishment of custom d


From: Huang Tao
Subject: Re: [PATCH v2] target/riscv: Implement dynamic establishment of custom decoder
Date: Wed, 13 Mar 2024 16:38:19 +0800
User-agent: Mozilla Thunderbird

I'm sorry for making this mistake and thank you for your patience.

In the next version, I will use GPtrArray you mentioned earlier to solve the problem.

Thanks,

Huang Tao

On 2024/3/12 21:57, Richard Henderson wrote:
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 via email to

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