qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Bin Meng <bmeng.cn@gmail.com>
To: Jim Wilson <jimw@sifive.com>,
	Alistair Francis <alistair.francis@wdc.com>
Cc: Bin Meng <bin.meng@windriver.com>,
	qemu-riscv@nongnu.org, qemu-devel@nongnu.org
Subject: [PATCH 1/4] target/riscv: Make csr_ops[CSR_TABLE_SIZE] external
Date: Tue, 12 Jan 2021 12:52:01 +0800	[thread overview]
Message-ID: <1610427124-49887-2-git-send-email-bmeng.cn@gmail.com> (raw)
In-Reply-To: <1610427124-49887-1-git-send-email-bmeng.cn@gmail.com>

From: Bin Meng <bin.meng@windriver.com>

In preparation to generate the CSR register list for GDB stub
dynamically, change csr_ops[] to non-static so that it can be
referenced externally.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
---

 target/riscv/cpu.h |  8 ++++++++
 target/riscv/csr.c | 10 +---------
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
index 2649949..6f9e1cc 100644
--- a/target/riscv/cpu.h
+++ b/target/riscv/cpu.h
@@ -482,6 +482,14 @@ typedef struct {
     riscv_csr_op_fn op;
 } riscv_csr_operations;
 
+/* CSR function table constants */
+enum {
+    CSR_TABLE_SIZE = 0x1000
+};
+
+/* CSR function table */
+extern riscv_csr_operations csr_ops[];
+
 void riscv_get_csr_ops(int csrno, riscv_csr_operations *ops);
 void riscv_set_csr_ops(int csrno, riscv_csr_operations *ops);
 
diff --git a/target/riscv/csr.c b/target/riscv/csr.c
index 10ab82e..507e8ee 100644
--- a/target/riscv/csr.c
+++ b/target/riscv/csr.c
@@ -23,14 +23,6 @@
 #include "qemu/main-loop.h"
 #include "exec/exec-all.h"
 
-/* CSR function table */
-static riscv_csr_operations csr_ops[];
-
-/* CSR function table constants */
-enum {
-    CSR_TABLE_SIZE = 0x1000
-};
-
 /* CSR function table public API */
 void riscv_get_csr_ops(int csrno, riscv_csr_operations *ops)
 {
@@ -1378,7 +1370,7 @@ int riscv_csrrw_debug(CPURISCVState *env, int csrno, target_ulong *ret_value,
 }
 
 /* Control and Status Register function table */
-static riscv_csr_operations csr_ops[CSR_TABLE_SIZE] = {
+riscv_csr_operations csr_ops[CSR_TABLE_SIZE] = {
     /* User Floating-Point CSRs */
     [CSR_FFLAGS] =              { fs,   read_fflags,      write_fflags      },
     [CSR_FRM] =                 { fs,   read_frm,         write_frm         },
-- 
2.7.4



  reply	other threads:[~2021-01-12  4:54 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-12  4:52 [PATCH 0/4] target/riscv: Generate the GDB XML file for CSR registers dynamically Bin Meng
2021-01-12  4:52 ` Bin Meng [this message]
2021-01-15 21:49   ` [PATCH 1/4] target/riscv: Make csr_ops[CSR_TABLE_SIZE] external Alistair Francis
2021-01-18 17:55   ` Richard Henderson
2021-01-19  2:41     ` Bin Meng
2021-01-12  4:52 ` [PATCH 2/4] target/riscv: Add CSR name in the CSR function table Bin Meng
2021-01-15 13:14   ` Alexander Richardson
2021-01-15 13:43     ` Bin Meng
2021-01-15 21:53     ` Alistair Francis
2021-01-15 21:51   ` Alistair Francis
2021-01-12  4:52 ` [PATCH 3/4] target/riscv: Generate the GDB XML file for CSR registers dynamically Bin Meng
2021-01-15 21:59   ` Alistair Francis
2021-01-15 22:07     ` Alistair Francis
2021-01-16  1:36       ` Bin Meng
2021-01-12  4:52 ` [PATCH 4/4] target/riscv: Remove built-in GDB XML files for CSRs Bin Meng
2021-01-15 22:00   ` Alistair Francis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1610427124-49887-2-git-send-email-bmeng.cn@gmail.com \
    --to=bmeng.cn@gmail.com \
    --cc=alistair.francis@wdc.com \
    --cc=bin.meng@windriver.com \
    --cc=jimw@sifive.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).