Commit b3efe5c890f3fa54a3ab48f82ef01d474069493b
1 parent
1360677c
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
Showing
1 changed file
with
19 additions
and
4 deletions
cpu-exec.c
@@ -1188,17 +1188,32 @@ int cpu_signal_handler(int host_signum, void *pinfo, | @@ -1188,17 +1188,32 @@ int cpu_signal_handler(int host_signum, void *pinfo, | ||
1188 | 1188 | ||
1189 | #elif defined(__x86_64__) | 1189 | #elif defined(__x86_64__) |
1190 | 1190 | ||
1191 | +#ifdef __NetBSD__ | ||
1192 | +#define REG_ERR _REG_ERR | ||
1193 | +#define REG_TRAPNO _REG_TRAPNO | ||
1194 | + | ||
1195 | +#define QEMU_UC_MCONTEXT_GREGS(uc, reg) (uc)->uc_mcontext.__gregs[(reg)] | ||
1196 | +#define QEMU_UC_MACHINE_PC(uc) _UC_MACHINE_PC(uc) | ||
1197 | +#else | ||
1198 | +#define QEMU_UC_MCONTEXT_GREGS(uc, reg) (uc)->uc_mcontext.gregs[(reg)] | ||
1199 | +#define QEMU_UC_MACHINE_PC(uc) QEMU_UC_MCONTEXT_GREGS(uc, REG_RIP) | ||
1200 | +#endif | ||
1201 | + | ||
1191 | int cpu_signal_handler(int host_signum, void *pinfo, | 1202 | int cpu_signal_handler(int host_signum, void *pinfo, |
1192 | void *puc) | 1203 | void *puc) |
1193 | { | 1204 | { |
1194 | siginfo_t *info = pinfo; | 1205 | siginfo_t *info = pinfo; |
1195 | - struct ucontext *uc = puc; | ||
1196 | unsigned long pc; | 1206 | unsigned long pc; |
1207 | +#ifdef __NetBSD__ | ||
1208 | + ucontext_t *uc = puc; | ||
1209 | +#else | ||
1210 | + struct ucontext *uc = puc; | ||
1211 | +#endif | ||
1197 | 1212 | ||
1198 | - pc = uc->uc_mcontext.gregs[REG_RIP]; | 1213 | + pc = QEMU_UC_MACHINE_PC(uc); |
1199 | return handle_cpu_signal(pc, (unsigned long)info->si_addr, | 1214 | return handle_cpu_signal(pc, (unsigned long)info->si_addr, |
1200 | - uc->uc_mcontext.gregs[REG_TRAPNO] == 0xe ? | ||
1201 | - (uc->uc_mcontext.gregs[REG_ERR] >> 1) & 1 : 0, | 1215 | + QEMU_UC_MCONTEXT_GREGS(uc, REG_TRAPNO) == 0xe ? |
1216 | + (QEMU_UC_MCONTEXT_GREGS(uc, REG_ERR) >> 1) & 1 : 0, | ||
1202 | &uc->uc_sigmask, puc); | 1217 | &uc->uc_sigmask, puc); |
1203 | } | 1218 | } |
1204 | 1219 |