Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jim Wilson <jimw@sifive.com>
To: gdb-patches@sourceware.org
Cc: andrew.burgess@embecosm.com,	Jim Wilson <jimw@sifive.com>
Subject: [PATCH] RISC-V: Correct legacy misa register number.
Date: Wed, 04 Jul 2018 00:14:00 -0000	[thread overview]
Message-ID: <20180704001334.27460-1-jimw@sifive.com> (raw)

The main purpose of this patch is to fix the legacy misa register number, which
is missing the +65 added to all of the other CSRs.

This also changes DECLARE_CSR to use RISCV_FIRST_CSR_REGNUM instead of
RISCV_LAST_FP_REGNUM+1 to be consistent with riscv-tdep.c.

I don't have access to legacy hardware that I can test the misa number change
with, but it has been tested on a riscv64-linux system using patched gdb and
patched kernel, since it isn't usable otherwise.

Jim

	gdb/
	* riscv-tdep.h (DECLARE_CSR): Use RISCV_FIRST_CSR_REGNUM instead of
	RISCV_LAST_FP_REGNUM + 1.
	(RSICV_CSR_LEGACY_MISA_REGNUM): Add RISCV_FIRST_CSR_REGNUM.
---
 gdb/riscv-tdep.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdb/riscv-tdep.h b/gdb/riscv-tdep.h
index ab5e278759..4fc05976ba 100644
--- a/gdb/riscv-tdep.h
+++ b/gdb/riscv-tdep.h
@@ -39,11 +39,11 @@ enum
   RISCV_LAST_FP_REGNUM = 64,	/* Last Floating Point Register */
 
   RISCV_FIRST_CSR_REGNUM = 65,  /* First CSR */
-#define DECLARE_CSR(name, num) RISCV_ ## num ## _REGNUM = RISCV_LAST_FP_REGNUM + 1 + num,
+#define DECLARE_CSR(name, num) RISCV_ ## num ## _REGNUM = RISCV_FIRST_CSR_REGNUM + num,
 #include "opcode/riscv-opc.h"
 #undef DECLARE_CSR
   RISCV_LAST_CSR_REGNUM = 4160,
-  RISCV_CSR_LEGACY_MISA_REGNUM = 0xf10,
+  RISCV_CSR_LEGACY_MISA_REGNUM = 0xf10 + RISCV_FIRST_CSR_REGNUM,
 
   RISCV_PRIV_REGNUM = 4161,
 
-- 
2.17.1


             reply	other threads:[~2018-07-04  0:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-04  0:14 Jim Wilson [this message]
2018-07-04  0:35 ` Palmer Dabbelt
2018-07-04 16:17   ` Jim Wilson
2018-07-06  3:16     ` Tim Newsome
     [not found] ` <20180704083410.GD2675@embecosm.com>
2018-07-16 22:01   ` Jim Wilson
2018-07-17 15:40     ` Andrew Burgess

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=20180704001334.27460-1-jimw@sifive.com \
    --to=jimw@sifive.com \
    --cc=andrew.burgess@embecosm.com \
    --cc=gdb-patches@sourceware.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