qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [5887] Attached patch make cpu-exec.c compile on NetBSD.
@ 2008-12-05 17:55 Blue Swirl
  0 siblings, 0 replies; only message in thread
From: Blue Swirl @ 2008-12-05 17:55 UTC (permalink / raw)
  To: qemu-devel

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-12-05 17:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-05 17:55 [Qemu-devel] [5887] Attached patch make cpu-exec.c compile on NetBSD Blue Swirl

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).