]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
target/riscv: gdbstub: Fix dynamic CSR XML generation
authorBin Meng <bin.meng@windriver.com>
Tue, 15 Jun 2021 08:51:33 +0000 (16:51 +0800)
committerAlistair Francis <alistair.francis@wdc.com>
Thu, 24 Jun 2021 12:00:12 +0000 (05:00 -0700)
Since commit 605def6eeee5 ("target/riscv: Use the RISCVException enum for CSR operations")
the CSR predicate() function was changed to return RISCV_EXCP_NONE
instead of 0 for a valid CSR, but it forgot to update the dynamic
CSR XML generation codes in gdbstub.

Fixes: 605def6eeee5 ("target/riscv: Use the RISCVException enum for CSR operations")
Reported-by: Xuzhou Cheng <xuzhou.cheng@windriver.com>
Signed-off-by: Bin Meng <bin.meng@windriver.com>
Tested-by: Xuzhou Cheng <xuzhou.cheng@windriver.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20210615085133.389887-1-bmeng.cn@gmail.com
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
target/riscv/gdbstub.c

index ca78682cf456c33b4e068b5a7b1854d7e5205ef8..a7a9c0b1fec938f15f7d7102ecbeca99f6176ce7 100644 (file)
@@ -170,7 +170,7 @@ static int riscv_gen_dynamic_csr_xml(CPUState *cs, int base_reg)
 
     for (i = 0; i < CSR_TABLE_SIZE; i++) {
         predicate = csr_ops[i].predicate;
-        if (predicate && !predicate(env, i)) {
+        if (predicate && (predicate(env, i) == RISCV_EXCP_NONE)) {
             if (csr_ops[i].name) {
                 g_string_append_printf(s, "<reg name=\"%s\"", csr_ops[i].name);
             } else {