]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
disas/riscv: Make rv_decode::cfg const
authorPhilippe Mathieu-Daudé <philmd@linaro.org>
Thu, 29 Jan 2026 14:56:27 +0000 (15:56 +0100)
committerPhilippe Mathieu-Daudé <philmd@linaro.org>
Tue, 3 Feb 2026 13:57:34 +0000 (14:57 +0100)
Disassembler is not expected to alter the CPU config.
Besides, all other RISC-V methods takes a const RISCVCPUConfig.
Make the @cfg field of the rv_decode structure const, passing
a const pointer to disasm_inst().

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260202222412.24923-6-philmd@linaro.org>

disas/riscv.c
disas/riscv.h

index 85cd2a9c2aefe3066f83ac317e9505ad6f0f7e15..6f2667482dc942a9a7503743a95febc11ebe42ae 100644 (file)
@@ -5409,7 +5409,7 @@ static void decode_inst_decompress(rv_decode *dec, rv_isa isa)
 /* disassemble instruction */
 
 static GString *disasm_inst(rv_isa isa, uint64_t pc, rv_inst inst,
-                            RISCVCPUConfig *cfg)
+                            const RISCVCPUConfig *cfg)
 {
     rv_decode dec = { 0 };
     dec.pc = pc;
@@ -5509,7 +5509,8 @@ print_insn_riscv(bfd_vma memaddr, struct disassemble_info *info, rv_isa isa)
     }
 
     g_autoptr(GString) str =
-        disasm_inst(isa, memaddr, inst, (RISCVCPUConfig *)info->target_info);
+        disasm_inst(isa, memaddr, inst,
+                    (const RISCVCPUConfig *)info->target_info);
     (*info->fprintf_func)(info->stream, "%s", str->str);
 
     return len;
index d211700cb2f6c8d20b475ff4d03a909239c79131..379e642ec84e2da12ffd7905b590cdcee7bf215f 100644 (file)
@@ -189,7 +189,7 @@ typedef struct {
 } rv_opcode_data;
 
 typedef struct {
-    RISCVCPUConfig *cfg;
+    const RISCVCPUConfig *cfg;
     uint64_t  pc;
     uint64_t  inst;
     const rv_opcode_data *opcode_data;