Commit d39bb24a0afd9c490b157ac11f710e6f5acc9fc4
1 parent
d7585251
BSD user: add support for OpenBSD/i386 host
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7065 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
12 additions
and
1 deletions
cpu-exec.c
| @@ -1165,17 +1165,28 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address, | @@ -1165,17 +1165,28 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address, | ||
| 1165 | # define EIP_sig(context) (*((unsigned long*)&(context)->uc_mcontext->ss.eip)) | 1165 | # define EIP_sig(context) (*((unsigned long*)&(context)->uc_mcontext->ss.eip)) |
| 1166 | # define TRAP_sig(context) ((context)->uc_mcontext->es.trapno) | 1166 | # define TRAP_sig(context) ((context)->uc_mcontext->es.trapno) |
| 1167 | # define ERROR_sig(context) ((context)->uc_mcontext->es.err) | 1167 | # define ERROR_sig(context) ((context)->uc_mcontext->es.err) |
| 1168 | +# define MASK_sig(context) ((context)->uc_sigmask) | ||
| 1169 | +#elif defined(__OpenBSD__) | ||
| 1170 | +# define EIP_sig(context) ((context)->sc_eip) | ||
| 1171 | +# define TRAP_sig(context) ((context)->sc_trapno) | ||
| 1172 | +# define ERROR_sig(context) ((context)->sc_err) | ||
| 1173 | +# define MASK_sig(context) ((context)->sc_mask) | ||
| 1168 | #else | 1174 | #else |
| 1169 | # define EIP_sig(context) ((context)->uc_mcontext.gregs[REG_EIP]) | 1175 | # define EIP_sig(context) ((context)->uc_mcontext.gregs[REG_EIP]) |
| 1170 | # define TRAP_sig(context) ((context)->uc_mcontext.gregs[REG_TRAPNO]) | 1176 | # define TRAP_sig(context) ((context)->uc_mcontext.gregs[REG_TRAPNO]) |
| 1171 | # define ERROR_sig(context) ((context)->uc_mcontext.gregs[REG_ERR]) | 1177 | # define ERROR_sig(context) ((context)->uc_mcontext.gregs[REG_ERR]) |
| 1178 | +# define MASK_sig(context) ((context)->uc_sigmask) | ||
| 1172 | #endif | 1179 | #endif |
| 1173 | 1180 | ||
| 1174 | int cpu_signal_handler(int host_signum, void *pinfo, | 1181 | int cpu_signal_handler(int host_signum, void *pinfo, |
| 1175 | void *puc) | 1182 | void *puc) |
| 1176 | { | 1183 | { |
| 1177 | siginfo_t *info = pinfo; | 1184 | siginfo_t *info = pinfo; |
| 1185 | +#if defined(__OpenBSD__) | ||
| 1186 | + struct sigcontext *uc = puc; | ||
| 1187 | +#else | ||
| 1178 | struct ucontext *uc = puc; | 1188 | struct ucontext *uc = puc; |
| 1189 | +#endif | ||
| 1179 | unsigned long pc; | 1190 | unsigned long pc; |
| 1180 | int trapno; | 1191 | int trapno; |
| 1181 | 1192 | ||
| @@ -1190,7 +1201,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, | @@ -1190,7 +1201,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, | ||
| 1190 | return handle_cpu_signal(pc, (unsigned long)info->si_addr, | 1201 | return handle_cpu_signal(pc, (unsigned long)info->si_addr, |
| 1191 | trapno == 0xe ? | 1202 | trapno == 0xe ? |
| 1192 | (ERROR_sig(uc) >> 1) & 1 : 0, | 1203 | (ERROR_sig(uc) >> 1) & 1 : 0, |
| 1193 | - &uc->uc_sigmask, puc); | 1204 | + &MASK_sig(uc), puc); |
| 1194 | } | 1205 | } |
| 1195 | 1206 | ||
| 1196 | #elif defined(__x86_64__) | 1207 | #elif defined(__x86_64__) |