diff mbox series

tcg/riscv: Fix building on OpenBSD/riscv64

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

Commit Message

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

Comments

Daniel Henrique Barboza June 26, 2024, 10:11 a.m. UTC | #1
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;
>   }
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;
 }