Skip to contentSkip to conversation

target/riscv: Declare csr_ops[] with a known size

PATCH Applied Bin Meng 3 participants 4 messages Jan 19, 2021 RISC-V

lore
Share & tools
lore

Bin Meng

author
#0 lore raw

PATCH 1/1 target/riscv: Declare csr_ops[] with a known size

From: Bin Meng <[email protected]>

csr_ops[] is currently declared with an unknown size in cpu.h. Since the array size is known, let's do a complete declaration.

---

 target/riscv/cpu.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/riscv/cpu.h +1 -1
index 02758ae..419a214 100644
@@ -487,7 +487,7 @@ enum {
 };
 
 /* CSR function table */
-extern riscv_csr_operations csr_ops[];
+extern riscv_csr_operations csr_ops[CSR_TABLE_SIZE];
 
 void riscv_get_csr_ops(int csrno, riscv_csr_operations *ops);
 void riscv_set_csr_ops(int csrno, riscv_csr_operations *ops);
Signature · 1 line
2.7.4
Reviewed-by on v1 1/1
#2 lore raw
In reply to Bin Meng
Quoted 2 lines · Bin Meng

From: Bin Meng <[email protected]>

Alistair

Quoted 27 lines

csr_ops[] is currently declared with an unknown size in cpu.h. Since the array size is known, let's do a complete declaration.

---

 target/riscv/cpu.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/riscv/cpu.h +1 -2
index 02758ae..419a214 100644
@@ -487,7 +487,7 @@ enum {
 };
 
 /* CSR function table */
-extern riscv_csr_operations csr_ops[];
+extern riscv_csr_operations csr_ops[CSR_TABLE_SIZE];
 
 void riscv_get_csr_ops(int csrno, riscv_csr_operations *ops);
 void riscv_set_csr_ops(int csrno, riscv_csr_operations *ops);
--

2.7.4

#3 lore raw
In reply to Bin Meng
Quoted 7 lines · Bin Meng

From: Bin Meng <[email protected]>

csr_ops[] is currently declared with an unknown size in cpu.h. Since the array size is known, let's do a complete declaration.

Thanks!

Applied to riscv-to-apply.next

Alistair

Quoted 22 lines

---

 target/riscv/cpu.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/riscv/cpu.h +1 -2
index 02758ae..419a214 100644
@@ -487,7 +487,7 @@ enum {
 };
 
 /* CSR function table */
-extern riscv_csr_operations csr_ops[];
+extern riscv_csr_operations csr_ops[CSR_TABLE_SIZE];
 
 void riscv_get_csr_ops(int csrno, riscv_csr_operations *ops);
 void riscv_set_csr_ops(int csrno, riscv_csr_operations *ops);
--

2.7.4