diff options
author | blueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-12-05 17:55:45 +0000 |
---|---|---|
committer | blueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-12-05 17:55:45 +0000 |
commit | b3efe5c890f3fa54a3ab48f82ef01d474069493b (patch) | |
tree | b12cc19eeba4e6abc8f19fcb992de293cf5b9482 /cpu-exec.c | |
parent | 1360677cfe3ca8f945fa1de77823df21a77e4500 (diff) | |
download | qemu-b3efe5c890f3fa54a3ab48f82ef01d474069493b.tar.gz qemu-b3efe5c890f3fa54a3ab48f82ef01d474069493b.tar.bz2 qemu-b3efe5c890f3fa54a3ab48f82ef01d474069493b.zip |
Attached patch make cpu-exec.c compile on NetBSD.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5887 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'cpu-exec.c')
-rw-r--r-- | cpu-exec.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/cpu-exec.c b/cpu-exec.c index a3d6725117..9a35a59b8e 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -1188,17 +1188,32 @@ 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) +#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; - struct ucontext *uc = puc; unsigned long pc; +#ifdef __NetBSD__ + ucontext_t *uc = puc; +#else + struct ucontext *uc = puc; +#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); } |