219 |
|
#define SIGSEGV_ALL_SIGNALS FAULT_HANDLER(SIGSEGV) |
220 |
|
#endif |
221 |
|
#define SIGSEGV_FAULT_HANDLER_ARGLIST int sig, siginfo_t *sip, void *scp |
222 |
< |
#define SIGSEGV_FAULT_HANDLER_ARGS sig, sip, scp |
222 |
> |
#define SIGSEGV_FAULT_HANDLER_ARGLIST_1 siginfo_t *sip, void *scp |
223 |
> |
#define SIGSEGV_FAULT_HANDLER_ARGS sip, scp |
224 |
|
#define SIGSEGV_FAULT_ADDRESS sip->si_addr |
225 |
|
#if defined(__NetBSD__) || defined(__FreeBSD__) |
226 |
|
#if (defined(i386) || defined(__i386__)) |
264 |
|
#if (defined(i386) || defined(__i386__)) |
265 |
|
#include <asm/sigcontext.h> |
266 |
|
#define SIGSEGV_FAULT_HANDLER_ARGLIST int sig, struct sigcontext scs |
267 |
< |
#define SIGSEGV_FAULT_HANDLER_ARGS sig, scs |
268 |
< |
#define SIGSEGV_FAULT_ADDRESS scs.cr2 |
269 |
< |
#define SIGSEGV_FAULT_INSTRUCTION scs.eip |
270 |
< |
#define SIGSEGV_REGISTER_FILE (unsigned int *)(&scs) |
267 |
> |
#define SIGSEGV_FAULT_HANDLER_ARGLIST_1 struct sigcontext *scp |
268 |
> |
#define SIGSEGV_FAULT_HANDLER_ARGS &scs |
269 |
> |
#define SIGSEGV_FAULT_ADDRESS scp->cr2 |
270 |
> |
#define SIGSEGV_FAULT_INSTRUCTION scp->eip |
271 |
> |
#define SIGSEGV_REGISTER_FILE (unsigned int *)scp |
272 |
|
#define SIGSEGV_SKIP_INSTRUCTION ix86_skip_instruction |
273 |
|
#endif |
274 |
|
#if (defined(sparc) || defined(__sparc__)) |
275 |
|
#include <asm/sigcontext.h> |
276 |
|
#define SIGSEGV_FAULT_HANDLER_ARGLIST int sig, int code, struct sigcontext *scp, char *addr |
277 |
< |
#define SIGSEGV_FAULT_HANDLER_ARGS sig, code, scp, addr |
277 |
> |
#define SIGSEGV_FAULT_HANDLER_ARGS sig, code, scp, addr |
278 |
|
#define SIGSEGV_FAULT_ADDRESS addr |
279 |
|
#endif |
280 |
|
#if (defined(powerpc) || defined(__powerpc__)) |
281 |
|
#include <asm/sigcontext.h> |
282 |
|
#define SIGSEGV_FAULT_HANDLER_ARGLIST int sig, struct sigcontext *scp |
283 |
< |
#define SIGSEGV_FAULT_HANDLER_ARGS sig, scp |
283 |
> |
#define SIGSEGV_FAULT_HANDLER_ARGS sig, scp |
284 |
|
#define SIGSEGV_FAULT_ADDRESS scp->regs->dar |
285 |
|
#define SIGSEGV_FAULT_INSTRUCTION scp->regs->nip |
286 |
|
#define SIGSEGV_REGISTER_FILE (unsigned int *)&scp->regs->nip, (unsigned int *)(scp->regs->gpr) |
289 |
|
#if (defined(alpha) || defined(__alpha__)) |
290 |
|
#include <asm/sigcontext.h> |
291 |
|
#define SIGSEGV_FAULT_HANDLER_ARGLIST int sig, int code, struct sigcontext *scp |
292 |
< |
#define SIGSEGV_FAULT_HANDLER_ARGS sig, code, scp |
292 |
> |
#define SIGSEGV_FAULT_HANDLER_ARGS sig, code, scp |
293 |
|
#define SIGSEGV_FAULT_ADDRESS get_fault_address(scp) |
294 |
|
#define SIGSEGV_FAULT_INSTRUCTION scp->sc_pc |
295 |
|
|
308 |
|
#if (defined(sgi) || defined(__sgi)) && (defined(SYSTYPE_SVR4) || defined(__SYSTYPE_SVR4)) |
309 |
|
#include <ucontext.h> |
310 |
|
#define SIGSEGV_FAULT_HANDLER_ARGLIST int sig, int code, struct sigcontext *scp |
311 |
< |
#define SIGSEGV_FAULT_HANDLER_ARGS sig, code, scp |
311 |
> |
#define SIGSEGV_FAULT_HANDLER_ARGS sig, code, scp |
312 |
|
#define SIGSEGV_FAULT_ADDRESS scp->sc_badvaddr |
313 |
|
#define SIGSEGV_ALL_SIGNALS FAULT_HANDLER(SIGSEGV) |
314 |
|
#endif |
316 |
|
// HP-UX |
317 |
|
#if (defined(hpux) || defined(__hpux__)) |
318 |
|
#define SIGSEGV_FAULT_HANDLER_ARGLIST int sig, int code, struct sigcontext *scp |
319 |
< |
#define SIGSEGV_FAULT_HANDLER_ARGS sig, code, scp |
319 |
> |
#define SIGSEGV_FAULT_HANDLER_ARGS sig, code, scp |
320 |
|
#define SIGSEGV_FAULT_ADDRESS scp->sc_sl.sl_ss.ss_narrow.ss_cr21 |
321 |
|
#define SIGSEGV_ALL_SIGNALS FAULT_HANDLER(SIGSEGV) FAULT_HANDLER(SIGBUS) |
322 |
|
#endif |
325 |
|
#if defined(__osf__) |
326 |
|
#include <ucontext.h> |
327 |
|
#define SIGSEGV_FAULT_HANDLER_ARGLIST int sig, int code, struct sigcontext *scp |
328 |
< |
#define SIGSEGV_FAULT_HANDLER_ARGS sig, code, scp |
328 |
> |
#define SIGSEGV_FAULT_HANDLER_ARGS sig, code, scp |
329 |
|
#define SIGSEGV_FAULT_ADDRESS scp->sc_traparg_a0 |
330 |
|
#define SIGSEGV_ALL_SIGNALS FAULT_HANDLER(SIGSEGV) |
331 |
|
#endif |
333 |
|
// AIX |
334 |
|
#if defined(_AIX) |
335 |
|
#define SIGSEGV_FAULT_HANDLER_ARGLIST int sig, int code, struct sigcontext *scp |
336 |
< |
#define SIGSEGV_FAULT_HANDLER_ARGS sig, code, scp |
336 |
> |
#define SIGSEGV_FAULT_HANDLER_ARGS sig, code, scp |
337 |
|
#define SIGSEGV_FAULT_ADDRESS scp->sc_jmpbuf.jmp_context.o_vaddr |
338 |
|
#define SIGSEGV_ALL_SIGNALS FAULT_HANDLER(SIGSEGV) |
339 |
|
#endif |
343 |
|
#if (defined(m68k) || defined(__m68k__)) |
344 |
|
#include <m68k/frame.h> |
345 |
|
#define SIGSEGV_FAULT_HANDLER_ARGLIST int sig, int code, struct sigcontext *scp |
346 |
< |
#define SIGSEGV_FAULT_HANDLER_ARGS sig, code, scp |
346 |
> |
#define SIGSEGV_FAULT_HANDLER_ARGS sig, code, scp |
347 |
|
#define SIGSEGV_FAULT_ADDRESS get_fault_address(scp) |
348 |
|
#define SIGSEGV_ALL_SIGNALS FAULT_HANDLER(SIGSEGV) |
349 |
|
|
369 |
|
} |
370 |
|
#else |
371 |
|
#define SIGSEGV_FAULT_HANDLER_ARGLIST int sig, int code, void *scp, char *addr |
372 |
< |
#define SIGSEGV_FAULT_HANDLER_ARGS sig, code, scp, addr |
372 |
> |
#define SIGSEGV_FAULT_HANDLER_ARGS sig, code, scp, addr |
373 |
|
#define SIGSEGV_FAULT_ADDRESS addr |
374 |
|
#define SIGSEGV_ALL_SIGNALS FAULT_HANDLER(SIGBUS) |
375 |
|
#endif |
781 |
|
#ifndef SIGSEGV_FAULT_INSTRUCTION |
782 |
|
#define SIGSEGV_FAULT_INSTRUCTION SIGSEGV_INVALID_PC |
783 |
|
#endif |
784 |
+ |
#ifndef SIGSEGV_FAULT_HANDLER_ARGLIST_1 |
785 |
+ |
#define SIGSEGV_FAULT_HANDLER_ARGLIST_1 SIGSEGV_FAULT_HANDLER_ARGLIST |
786 |
+ |
#endif |
787 |
|
|
788 |
|
// SIGSEGV recovery supported ? |
789 |
|
#if defined(SIGSEGV_ALL_SIGNALS) && defined(SIGSEGV_FAULT_HANDLER_ARGLIST) && defined(SIGSEGV_FAULT_ADDRESS) |
798 |
|
#if defined(HAVE_SIGSEGV_RECOVERY) || defined(HAVE_MACH_EXCEPTIONS) |
799 |
|
// This function handles the badaccess to memory. |
800 |
|
// It is called from the signal handler or the exception handler. |
801 |
< |
static bool handle_badaccess(SIGSEGV_FAULT_HANDLER_ARGLIST) |
801 |
> |
static bool handle_badaccess(SIGSEGV_FAULT_HANDLER_ARGLIST_1) |
802 |
|
{ |
803 |
|
sigsegv_address_t fault_address = (sigsegv_address_t)SIGSEGV_FAULT_ADDRESS; |
804 |
|
sigsegv_address_t fault_instruction = (sigsegv_address_t)SIGSEGV_FAULT_INSTRUCTION; |