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: Richard Henderson
Subject: Re: [PATCH v2] target/riscv: Implement dynamic establishment of custom decoder
Date: Tue, 12 Mar 2024 03:57:39 -1000
User-agent: Mozilla Thunderbird

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]