qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [7066] BSD user: add support for OpenBSD/amd64 host
@ 2009-04-10 13:00 Blue Swirl
  0 siblings, 0 replies; only message in thread
From: Blue Swirl @ 2009-04-10 13:00 UTC (permalink / raw)
  To: qemu-devel

Revision: 7066
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=7066
Author:   blueswir1
Date:     2009-04-10 13:00:29 +0000 (Fri, 10 Apr 2009)
Log Message:
-----------
BSD user: add support for OpenBSD/amd64 host

Modified Paths:
--------------
    trunk/cpu-exec.c

Modified: trunk/cpu-exec.c
===================================================================
--- trunk/cpu-exec.c	2009-04-10 07:29:34 UTC (rev 7065)
+++ trunk/cpu-exec.c	2009-04-10 13:00:29 UTC (rev 7066)
@@ -1207,14 +1207,20 @@
 #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)
+#define PC_sig(context)       _UC_MACHINE_PC(context)
+#define TRAP_sig(context)     ((context)->uc_mcontext.__gregs[_REG_TRAPNO])
+#define ERROR_sig(context)    ((context)->uc_mcontext.__gregs[_REG_ERR])
+#define MASK_sig(context)     ((context)->uc_sigmask)
+#elif defined(__OpenBSD__)
+#define PC_sig(context)       ((context)->sc_rip)
+#define TRAP_sig(context)     ((context)->sc_trapno)
+#define ERROR_sig(context)    ((context)->sc_err)
+#define MASK_sig(context)     ((context)->sc_mask)
 #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)
+#define PC_sig(context)       ((context)->uc_mcontext.gregs[REG_RIP])
+#define TRAP_sig(context)     ((context)->uc_mcontext.gregs[REG_TRAPNO])
+#define ERROR_sig(context)    ((context)->uc_mcontext.gregs[REG_ERR])
+#define MASK_sig(context)     ((context)->uc_sigmask)
 #endif
 
 int cpu_signal_handler(int host_signum, void *pinfo,
@@ -1224,15 +1230,17 @@
     unsigned long pc;
 #ifdef __NetBSD__
     ucontext_t *uc = puc;
+#elif defined(__OpenBSD__)
+    struct sigcontext *uc = puc;
 #else
     struct ucontext *uc = puc;
 #endif
 
-    pc = QEMU_UC_MACHINE_PC(uc);
+    pc = PC_sig(uc);
     return handle_cpu_signal(pc, (unsigned long)info->si_addr,
-                             QEMU_UC_MCONTEXT_GREGS(uc, REG_TRAPNO) == 0xe ?
-                             (QEMU_UC_MCONTEXT_GREGS(uc, REG_ERR) >> 1) & 1 : 0,
-                             &uc->uc_sigmask, puc);
+                             TRAP_sig(uc) == 0xe ?
+                             (ERROR_sig(uc) >> 1) & 1 : 0,
+                             &MASK_sig(uc), puc);
 }
 
 #elif defined(_ARCH_PPC)

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

only message in thread, other threads:[~2009-04-10 13:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-10 13:00 [Qemu-devel] [7066] BSD user: add support for OpenBSD/amd64 host 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).