diff options
author | Bin Meng <bmeng@tinylab.org> | 2023-02-28 18:40:21 +0800 |
---|---|---|
committer | Palmer Dabbelt <palmer@rivosinc.com> | 2023-03-01 16:40:14 -0800 |
commit | e17e2c7cb968e519eb1f6c676e5c98e21f016310 (patch) | |
tree | fd82f08b71cc0d600d23a50e792d05e5e92f1878 /target/riscv/gdbstub.c | |
parent | 28eb8bee83c6223f5921f95844e381fe01ec9e0f (diff) | |
download | qemu-e17e2c7cb968e519eb1f6c676e5c98e21f016310.zip qemu-e17e2c7cb968e519eb1f6c676e5c98e21f016310.tar.gz qemu-e17e2c7cb968e519eb1f6c676e5c98e21f016310.tar.bz2 |
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 <bmeng@tinylab.org>
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
Message-ID: <20230228104035.1879882-6-bmeng@tinylab.org>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Diffstat (limited to 'target/riscv/gdbstub.c')
-rw-r--r-- | target/riscv/gdbstub.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/target/riscv/gdbstub.c b/target/riscv/gdbstub.c index 704f3d6..294f0ce 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); + } } |