From: Rich Felker <dalias@libc.org>
To: Mark Corbin <mark@dibsco.co.uk>
Cc: musl@lists.openwall.com
Subject: [musl] [PATCH] move riscv64 register index constants to signal.h
Date: Tue, 4 Feb 2020 09:31:36 -0500 [thread overview]
Message-ID: <20200204143136.GV1663@brightrain.aerifal.cx> (raw)
In-Reply-To: <20200204142631.GU1663@brightrain.aerifal.cx>
[-- Attachment #1: Type: text/plain, Size: 1113 bytes --]
On Tue, Feb 04, 2020 at 09:26:31AM -0500, Rich Felker wrote:
> > > > I guess that it would probably be best to change the libsigsegv code to
> > > > use a value of '2' instead of the REG_SP definition. I'll look at
> > > > submitting a patch to the project.
> > >
> > > I think using a symbolic name is both more informative and more
> > > portable (since the layout of the saved registers is an OS choice,
> > > nothing universal to the architecture). The question is just where the
> > > macro should be obtained from. As long as glibc (and any other
> > > platforms that might be relevant?) has a sys/reg.h, it wouldn't hurt
> > > to just add the include and continue using the macro, regardless of
> > > whether musl moves it later.
> >
> > Glibc and uClibc don't have a sys/reg.h - is there a way that it could be
> > included conditionally for musl only?
>
> If you want a configure test to detect it the yes; otherwise no. But
> this suggests the way we did it is wrong. We should not be making this
> kind of mess. I should probably just move the definitions...
Patch attached. Any objections?
Rich
[-- Attachment #2: 0001-move-riscv64-register-index-constants-to-signal.h.patch --]
[-- Type: text/plain, Size: 1417 bytes --]
From 329e79299daaa994b8e75941331a1093051ea5d9 Mon Sep 17 00:00:00 2001
From: Rich Felker <dalias@aerifal.cx>
Date: Tue, 4 Feb 2020 09:29:13 -0500
Subject: [PATCH] move riscv64 register index constants to signal.h
under _GNU_SOURCE for namespace cleanliness, analogous to other archs.
the original placement in sys/reg.h seems not to have been motivated;
such a header isn't even present on other implementations.
---
arch/riscv64/bits/reg.h | 6 ------
arch/riscv64/bits/signal.h | 9 +++++++++
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/arch/riscv64/bits/reg.h b/arch/riscv64/bits/reg.h
index c800788c..2633f39d 100644
--- a/arch/riscv64/bits/reg.h
+++ b/arch/riscv64/bits/reg.h
@@ -1,8 +1,2 @@
#undef __WORDSIZE
#define __WORDSIZE 64
-#define REG_PC 0
-#define REG_RA 1
-#define REG_SP 2
-#define REG_TP 4
-#define REG_S0 8
-#define REG_A0 10
diff --git a/arch/riscv64/bits/signal.h b/arch/riscv64/bits/signal.h
index 2ff4be30..b006334f 100644
--- a/arch/riscv64/bits/signal.h
+++ b/arch/riscv64/bits/signal.h
@@ -35,6 +35,15 @@ typedef struct mcontext_t {
union __riscv_mc_fp_state __fpregs;
} mcontext_t;
+#if defined(_GNU_SOURCE)
+#define REG_PC 0
+#define REG_RA 1
+#define REG_SP 2
+#define REG_TP 4
+#define REG_S0 8
+#define REG_A0 10
+#endif
+
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
typedef unsigned long greg_t;
typedef unsigned long gregset_t[32];
--
2.21.0
next prev parent reply other threads:[~2020-02-04 14:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-03 11:42 [musl] REG_SP Definition for RISC-V Mark Corbin
2020-02-03 13:32 ` Rich Felker
2020-02-03 15:17 ` Mark Corbin
2020-02-03 15:24 ` Rich Felker
2020-02-04 10:03 ` Mark Corbin
2020-02-04 14:26 ` Rich Felker
2020-02-04 14:31 ` Rich Felker [this message]
2020-02-11 14:19 ` [musl] [PATCH] move riscv64 register index constants to signal.h Mark Corbin
2020-02-18 19:17 ` [musl] REG_SP Definition for RISC-V Palmer Dabbelt
2020-02-19 3:17 ` Rich Felker
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=20200204143136.GV1663@brightrain.aerifal.cx \
--to=dalias@libc.org \
--cc=mark@dibsco.co.uk \
--cc=musl@lists.openwall.com \
/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.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
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).