diff mbox series

tcg/riscv: Fix building on OpenBSD/riscv64

Message ID ZnzqNlUbHG5Ue6L1@humpty.home.comstyle.com (mailing list archive)
State New
Headers show
Series tcg/riscv: Fix building on OpenBSD/riscv64 | expand

Commit Message

Brad Smith June 27, 2024, 4:27 a.m. UTC
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(+)

Comments

Richard Henderson June 27, 2024, 5:20 p.m. UTC | #1
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;
>   }
diff mbox series

Patch

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;
 }