Skip to contentSkip to conversation

target/riscv: gdbstub: Fix dynamic CSR XML generation

PATCH Applied Bin Meng 2 participants 3 messages Jun 15, 2021 – Jun 18, 2021 RISC-V

lore
Share & tools
lore

Bin Meng

author
#0 lore raw

PATCH 1/1 target/riscv: gdbstub: Fix dynamic CSR XML generation

From: Bin Meng <[email protected]>

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")

---

 target/riscv/gdbstub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/riscv/gdbstub.c +1 -1
index ca78682cf4..a7a9c0b1fe 100644
@@ -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 {
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Bin Meng

From: Bin Meng <[email protected]>

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.

Quoted 4 lines
Fixes 605def6eeee5 ("target/riscv: Use the RISCVException enum for CSR operations")

Alistair

Quoted 22 lines

---

 target/riscv/gdbstub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/riscv/gdbstub.c +1 -2
index ca78682cf4..a7a9c0b1fe 100644
@@ -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 {
--

2.25.1

#2 lore raw
In reply to Bin Meng
Quoted 8 lines · Bin Meng

From: Bin Meng <[email protected]>

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.

Quoted 4 lines
Fixes 605def6eeee5 ("target/riscv: Use the RISCVException enum for CSR operations")

Thanks!

Applied to riscv-to-apply.next

Alistair

Quoted 22 lines

---

 target/riscv/gdbstub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/riscv/gdbstub.c +1 -2
index ca78682cf4..a7a9c0b1fe 100644
@@ -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 {
--

2.25.1