From: Nick Hudson <skrll@netbsd.org>
To: qemu-devel@nongnu.org
Cc: Nick Hudson <skrll@netbsd.org>,
Paolo Bonzini <pbonzini@redhat.com>,
Kamil Rytarowski <kamil@netbsd.org>,
Riku Voipio <riku.voipio@iki.fi>,
Richard Henderson <rth@twiddle.net>
Subject: [PATCH 1/1] NetBSD/arm build fix
Date: Tue, 12 May 2020 07:48:23 +0100 [thread overview]
Message-ID: <20200512064823.13025-1-skrll@netbsd.org> (raw)
Fix building on NetBSD/arm by extracting the FSR value from the
correct siginfo_t field.
Signed-off-by: Nick Hudson <skrll@netbsd.org>
---
accel/tcg/user-exec.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c
index 52359949df..3637626456 100644
--- a/accel/tcg/user-exec.c
+++ b/accel/tcg/user-exec.c
@@ -517,6 +517,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
#if defined(__NetBSD__)
#include <ucontext.h>
+#include <sys/siginfo.h>
#endif
int cpu_signal_handler(int host_signum, void *pinfo,
@@ -525,6 +526,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
siginfo_t *info = pinfo;
#if defined(__NetBSD__)
ucontext_t *uc = puc;
+ siginfo_t *si = pinfo;
#else
ucontext_t *uc = puc;
#endif
@@ -539,10 +541,18 @@ int cpu_signal_handler(int host_signum, void *pinfo,
pc = uc->uc_mcontext.arm_pc;
#endif
+#if defined(__NetBSD__)
+ /* siginfo_t::si_trap is the FSR value, in which bit 11 is WnR
+ * (assuming a v6 or later processor; on v5 we will always report
+ * this as a read).
+ */
+ is_write = extract32(si->si_trap, 11, 1);
+#else
/* error_code is the FSR value, in which bit 11 is WnR (assuming a v6 or
* later processor; on v5 we will always report this as a read).
*/
is_write = extract32(uc->uc_mcontext.error_code, 11, 1);
+#endif
return handle_cpu_signal(pc, info, is_write, &uc->uc_sigmask);
}
--
2.17.1
next reply other threads:[~2020-05-12 7:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-12 6:48 Nick Hudson [this message]
2020-05-13 16:25 ` [PATCH 1/1] NetBSD/arm build fix Richard Henderson
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=20200512064823.13025-1-skrll@netbsd.org \
--to=skrll@netbsd.org \
--cc=kamil@netbsd.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=riku.voipio@iki.fi \
--cc=rth@twiddle.net \
/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.
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).