From: Blue Swirl <blauwirbel@gmail.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [5887] Attached patch make cpu-exec.c compile on NetBSD.
Date: Fri, 05 Dec 2008 17:55:45 +0000 [thread overview]
Message-ID: <E1L8eu1-0007GT-Cu@cvs.savannah.gnu.org> (raw)
Revision: 5887
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5887
Author: blueswir1
Date: 2008-12-05 17:55:45 +0000 (Fri, 05 Dec 2008)
Log Message:
-----------
Attached patch make cpu-exec.c compile on NetBSD.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Modified Paths:
--------------
trunk/cpu-exec.c
Modified: trunk/cpu-exec.c
===================================================================
--- trunk/cpu-exec.c 2008-12-05 17:54:09 UTC (rev 5886)
+++ trunk/cpu-exec.c 2008-12-05 17:55:45 UTC (rev 5887)
@@ -1188,17 +1188,32 @@
#elif defined(__x86_64__)
+#ifdef __NetBSD__
+#define REG_ERR _REG_ERR
+#define REG_TRAPNO _REG_TRAPNO
+
+#define QEMU_UC_MCONTEXT_GREGS(uc, reg) (uc)->uc_mcontext.__gregs[(reg)]
+#define QEMU_UC_MACHINE_PC(uc) _UC_MACHINE_PC(uc)
+#else
+#define QEMU_UC_MCONTEXT_GREGS(uc, reg) (uc)->uc_mcontext.gregs[(reg)]
+#define QEMU_UC_MACHINE_PC(uc) QEMU_UC_MCONTEXT_GREGS(uc, REG_RIP)
+#endif
+
int cpu_signal_handler(int host_signum, void *pinfo,
void *puc)
{
siginfo_t *info = pinfo;
+ unsigned long pc;
+#ifdef __NetBSD__
+ ucontext_t *uc = puc;
+#else
struct ucontext *uc = puc;
- unsigned long pc;
+#endif
- pc = uc->uc_mcontext.gregs[REG_RIP];
+ pc = QEMU_UC_MACHINE_PC(uc);
return handle_cpu_signal(pc, (unsigned long)info->si_addr,
- uc->uc_mcontext.gregs[REG_TRAPNO] == 0xe ?
- (uc->uc_mcontext.gregs[REG_ERR] >> 1) & 1 : 0,
+ QEMU_UC_MCONTEXT_GREGS(uc, REG_TRAPNO) == 0xe ?
+ (QEMU_UC_MCONTEXT_GREGS(uc, REG_ERR) >> 1) & 1 : 0,
&uc->uc_sigmask, puc);
}
reply other threads:[~2008-12-05 17:55 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=E1L8eu1-0007GT-Cu@cvs.savannah.gnu.org \
--to=blauwirbel@gmail.com \
--cc=qemu-devel@nongnu.org \
/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).