[5887] Attached patch make cpu-exec.c compile on NetBSD.
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 <[email protected]>
Modified Paths:
--------------
trunk/cpu-exec.c
Modified: trunk/cpu-exec.c
===================================================================
cpu-exec.c +19 -4
@@ -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); }