* [PATCH] tcg/riscv: Fix building on OpenBSD/riscv64
@ 2024-06-26 7:09 Brad Smith
2024-06-26 10:11 ` Daniel Henrique Barboza
0 siblings, 1 reply; 4+ messages in thread
From: Brad Smith @ 2024-06-26 7:09 UTC (permalink / raw)
To: Palmer Dabbelt, Alistair Francis, Richard Henderson
Cc: qemu-riscv, qemu-devel
tcg/riscv: Fix building on OpenBSD/riscv64
Signed-off-by: Brad Smith <brad@comstyle.com>
---
tcg/riscv/tcg-target.c.inc | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc
index 639363039b..aeae9a8ad8 100644
--- a/tcg/riscv/tcg-target.c.inc
+++ b/tcg/riscv/tcg-target.c.inc
@@ -2116,7 +2116,12 @@ static void sigill_handler(int signo, siginfo_t *si, void *data)
{
/* Skip the faulty instruction */
ucontext_t *uc = (ucontext_t *)data;
+
+#ifdef __OpenBSD__
+ uc->sc_sepc += 4;
+#else
uc->uc_mcontext.__gregs[REG_PC] += 4;
+#endif
got_sigill = 1;
}
--
2.45.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] tcg/riscv: Fix building on OpenBSD/riscv64
2024-06-26 7:09 [PATCH] tcg/riscv: Fix building on OpenBSD/riscv64 Brad Smith
@ 2024-06-26 10:11 ` Daniel Henrique Barboza
0 siblings, 0 replies; 4+ messages in thread
From: Daniel Henrique Barboza @ 2024-06-26 10:11 UTC (permalink / raw)
To: Brad Smith, Palmer Dabbelt, Alistair Francis, Richard Henderson
Cc: qemu-riscv, qemu-devel
On 6/26/24 4:09 AM, Brad Smith wrote:
> tcg/riscv: Fix building on OpenBSD/riscv64
>
> Signed-off-by: Brad Smith <brad@comstyle.com>
> ---
Please add in the commit msg a short description on the problem you're
facing in the OpenBSD build and how this change fixes it. We want to keep
a history on this kind of OS specific changes. There's also the possibility
that an alternative fix might apply.
Thanks,
Daniel
> tcg/riscv/tcg-target.c.inc | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc
> index 639363039b..aeae9a8ad8 100644
> --- a/tcg/riscv/tcg-target.c.inc
> +++ b/tcg/riscv/tcg-target.c.inc
> @@ -2116,7 +2116,12 @@ static void sigill_handler(int signo, siginfo_t *si, void *data)
> {
> /* Skip the faulty instruction */
> ucontext_t *uc = (ucontext_t *)data;
> +
> +#ifdef __OpenBSD__
> + uc->sc_sepc += 4;
> +#else
> uc->uc_mcontext.__gregs[REG_PC] += 4;
> +#endif
>
> got_sigill = 1;
> }
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] tcg/riscv: Fix building on OpenBSD/riscv64
@ 2024-06-27 4:27 Brad Smith
2024-06-27 17:20 ` Richard Henderson
0 siblings, 1 reply; 4+ messages in thread
From: Brad Smith @ 2024-06-27 4:27 UTC (permalink / raw)
To: Palmer Dabbelt, Alistair Francis, Richard Henderson
Cc: qemu-riscv, qemu-devel
tcg/riscv: Fix building on OpenBSD/riscv64
Use ucontext_t/struct sigcontext member name from machine/signal.h
instead of Linux specific name.
Signed-off-by: Brad Smith <brad@comstyle.com>
---
tcg/riscv/tcg-target.c.inc | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc
index 639363039b..aeae9a8ad8 100644
--- a/tcg/riscv/tcg-target.c.inc
+++ b/tcg/riscv/tcg-target.c.inc
@@ -2116,7 +2116,12 @@ static void sigill_handler(int signo, siginfo_t *si, void *data)
{
/* Skip the faulty instruction */
ucontext_t *uc = (ucontext_t *)data;
+
+#ifdef __OpenBSD__
+ uc->sc_sepc += 4;
+#else
uc->uc_mcontext.__gregs[REG_PC] += 4;
+#endif
got_sigill = 1;
}
--
2.45.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] tcg/riscv: Fix building on OpenBSD/riscv64
2024-06-27 4:27 Brad Smith
@ 2024-06-27 17:20 ` Richard Henderson
0 siblings, 0 replies; 4+ messages in thread
From: Richard Henderson @ 2024-06-27 17:20 UTC (permalink / raw)
To: Brad Smith, Palmer Dabbelt, Alistair Francis; +Cc: qemu-riscv, qemu-devel
On 6/26/24 21:27, Brad Smith wrote:
> tcg/riscv: Fix building on OpenBSD/riscv64
>
> Use ucontext_t/struct sigcontext member name from machine/signal.h
> instead of Linux specific name.
>
> Signed-off-by: Brad Smith <brad@comstyle.com>
> ---
> tcg/riscv/tcg-target.c.inc | 5 +++++
> 1 file changed, 5 insertions(+)
Thanks. I'm going to clean all of this up into util/cpuinfo-riscv.c, similar to other
hosts, and I will include this.
r~
>
> diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc
> index 639363039b..aeae9a8ad8 100644
> --- a/tcg/riscv/tcg-target.c.inc
> +++ b/tcg/riscv/tcg-target.c.inc
> @@ -2116,7 +2116,12 @@ static void sigill_handler(int signo, siginfo_t *si, void *data)
> {
> /* Skip the faulty instruction */
> ucontext_t *uc = (ucontext_t *)data;
> +
> +#ifdef __OpenBSD__
> + uc->sc_sepc += 4;
> +#else
> uc->uc_mcontext.__gregs[REG_PC] += 4;
> +#endif
>
> got_sigill = 1;
> }
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-06-27 17:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-26 7:09 [PATCH] tcg/riscv: Fix building on OpenBSD/riscv64 Brad Smith
2024-06-26 10:11 ` Daniel Henrique Barboza
-- strict thread matches above, loose matches on Subject: below --
2024-06-27 4:27 Brad Smith
2024-06-27 17:20 ` Richard Henderson
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).