summaryrefslogtreecommitdiffstats
path: root/cpu-exec.c
diff options
context:
space:
mode:
authorblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2009-04-10 13:00:29 +0000
committerblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2009-04-10 13:00:29 +0000
commitd397abbdbe68715ec86b4392e4e6384db64d029d (patch)
tree3880f1567200b14a1c55e46e86a3055e0ce0e57a /cpu-exec.c
parentd39bb24a0afd9c490b157ac11f710e6f5acc9fc4 (diff)
downloadhqemu-d397abbdbe68715ec86b4392e4e6384db64d029d.zip
hqemu-d397abbdbe68715ec86b4392e4e6384db64d029d.tar.gz
BSD user: add support for OpenBSD/amd64 host
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7066 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'cpu-exec.c')
-rw-r--r--cpu-exec.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/cpu-exec.c b/cpu-exec.c
index 25ffb28..611f1ea 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -1207,14 +1207,20 @@ int cpu_signal_handler(int host_signum, void *pinfo,
#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 @@ int cpu_signal_handler(int host_signum, void *pinfo,
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)
OpenPOWER on IntegriCloud