public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] RISC-V: Correct legacy misa register number.
@ 2018-07-04  0:14 Jim Wilson
  2018-07-04  0:35 ` Palmer Dabbelt
  2018-07-04  8:34 ` Andrew Burgess
  0 siblings, 2 replies; 7+ messages in thread
From: Jim Wilson @ 2018-07-04  0:14 UTC (permalink / raw)
  To: gdb-patches; +Cc: andrew.burgess, Jim Wilson

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-07-17 15:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-04  0:14 [PATCH] RISC-V: Correct legacy misa register number Jim Wilson
2018-07-04  0:35 ` Palmer Dabbelt
2018-07-04 16:17   ` Jim Wilson
2018-07-06  3:16     ` Tim Newsome
2018-07-04  8:34 ` Andrew Burgess
2018-07-16 22:01   ` Jim Wilson
2018-07-17 15:40     ` Andrew Burgess

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 read-only IMAP folder(s) and NNTP newsgroup(s).