From: Bin Meng Date: Tue, 28 Feb 2023 10:40:21 +0000 (+0800) Subject: target/riscv: gdbstub: Do not generate CSR XML if Zicsr is disabled X-Git-Tag: v8.0.0-rc0~35^2~8^2~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e17e2c7cb968e519eb1f6c676e5c98e21f016310;p=thirdparty%2Fqemu.git target/riscv: gdbstub: Do not generate CSR XML if Zicsr is disabled There is no need to generate the CSR XML if the Zicsr extension is not enabled. Signed-off-by: Bin Meng Reviewed-by: Weiwei Li Reviewed-by: LIU Zhiwei Message-ID: <20230228104035.1879882-6-bmeng@tinylab.org> Signed-off-by: Palmer Dabbelt --- diff --git a/target/riscv/gdbstub.c b/target/riscv/gdbstub.c index 704f3d69225..294f0ceb1c4 100644 --- a/target/riscv/gdbstub.c +++ b/target/riscv/gdbstub.c @@ -406,7 +406,10 @@ void riscv_cpu_register_gdb_regs_for_features(CPUState *cs) g_assert_not_reached(); } - gdb_register_coprocessor(cs, riscv_gdb_get_csr, riscv_gdb_set_csr, - riscv_gen_dynamic_csr_xml(cs, cs->gdb_num_regs), - "riscv-csr.xml", 0); + if (cpu->cfg.ext_icsr) { + int base_reg = cs->gdb_num_regs; + gdb_register_coprocessor(cs, riscv_gdb_get_csr, riscv_gdb_set_csr, + riscv_gen_dynamic_csr_xml(cs, base_reg), + "riscv-csr.xml", 0); + } }