[v2,0/3] Support unprivileged CSR and new DECLARE_CSR_REUSE macro

Message ID 1593056276-17036-1-git-send-email-nelson.chu@sifive.com
State New
Headers show

Commit Message

Nelson Chu June 25, 2020, 3:37 a.m.
Hi binutils,

The previous v1 patch is sent before,
[PATCH] RISC-V: Support debug and float CSR as the unprivileged ones.

However, there is a potential problem about alias CSR which is
originally mentioned in the following links,
https://sourceware.org/pipermail/gdb-patches/2020-June/169323.html

And it should be fixed by Andrew Burgess's patches,
https://sourceware.org/pipermail/gdb-patches/2020-June/169561.html


In the future, binutils must define the alias CSR very carefully.
All rules are mentioned in the third patch in this mail.  Once Andrew's
patches and my patches in this mail are upstreamed, then gdb should only
need to care about the DECLARE_CSR and DECLARE_CSR_ALIAS macros.
Therefore, the following patch don't need to check the priv spec verisons
when creating the CSR aliases anymore.

https://sourceware.org/pipermail/gdb-patches/2020-June/169563.html


Author:     Nelson Chu <nelson.chu@sifive.com>
AuthorDate: Wed Jun 24 16:33:42 2020 +0800
Commit:     Nelson Chu <nelson.chu@sifive.com>
CommitDate: Wed Jun 24 21:33:49 2020 +0800

    gdb/riscv: Only handle the alias CSR defined by DECLARE_CSR_ALIAS.

    gdb only need to handle the CSR defined by DECLARE_CSR, and the alias
    CSR defined by DECLARE_CSR_ALIAS.  Binutils must make sure that the
    CSR, which is defined by DECLARE_CSR_ALIAS, is only renamed to another
    one, but keep the same semantic.  Therefore, we don't need to consider
    the priv spec versions when creating the alias CSR in gdb anymore.

        gdb/
        * riscv-tdep.c (riscv_create_csr_aliases): Don't need to
        consider the priv spec versions when creating the alias CSR.
---
 gdb/riscv-tdep.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)



Thanks
Nelson

Comments

Jim Wilson June 29, 2020, 11:38 p.m. | #1
On Wed, Jun 24, 2020 at 8:38 PM Nelson Chu <nelson.chu@sifive.com> wrote:
>         gdb/

>         * riscv-tdep.c (riscv_create_csr_aliases): Don't need to

>         consider the priv spec versions when creating the alias CSR.


Part 0 messages usually don't include a patch.  And this is a gdb
patch not a binutils patch.  It should be OK given that we have
dropped the priv spec v1.9 misa now though.  But I'm not a gdb
reviewer so can't approve it.  The text seems to imply that this
depends on the rest of the patch series, but I think the only
dependence is the previous binutils patch that dropped the old v1.9
misa reg.

Jim

Patch

diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
index 0028572..842ecf9 100644
--- a/gdb/riscv-tdep.c
+++ b/gdb/riscv-tdep.c
@@ -378,11 +378,8 @@  riscv_create_csr_aliases ()
       reg.names.push_back (alias);

       /* Setup the other csr aliases.  We don't use a switch table here in
-         case there are multiple aliases with the same value.  Also filter
-         based on ABRT_VER in order to avoid a very old alias for misa that
-         duplicates the name "misa" but at a different CSR address.  */
+         case there are multiple aliases with the same value.  */
 #define DECLARE_CSR_ALIAS(NAME,VALUE,CLASS,DEF_VER,ABRT_VER)    \
-      if (csr_num == VALUE && ABRT_VER >= PRIV_SPEC_CLASS_1P11)  \
         reg.names.push_back ( # NAME );
 #include "opcode/riscv-opc.h"
 #undef DECLARE_CSR_ALIAS