36 |
|
#endif |
37 |
|
|
38 |
|
#include <list> |
39 |
+ |
#include <stdio.h> |
40 |
|
#include <signal.h> |
41 |
|
#include "sigsegv.h" |
42 |
|
|
271 |
|
#define SIGSEGV_REGISTER_FILE (unsigned int *)&SIGSEGV_CONTEXT_REGS->nip, (unsigned int *)(SIGSEGV_CONTEXT_REGS->gpr) |
272 |
|
#define SIGSEGV_SKIP_INSTRUCTION powerpc_skip_instruction |
273 |
|
#endif |
274 |
+ |
#if (defined(hppa) || defined(__hppa__)) |
275 |
+ |
#undef SIGSEGV_FAULT_ADDRESS |
276 |
+ |
#define SIGSEGV_FAULT_ADDRESS sip->si_ptr |
277 |
+ |
#endif |
278 |
|
#endif |
279 |
|
#endif |
280 |
|
|
395 |
|
#endif |
396 |
|
#endif |
397 |
|
#if defined(__FreeBSD__) |
393 |
– |
#define SIGSEGV_ALL_SIGNALS FAULT_HANDLER(SIGBUS) |
398 |
|
#if (defined(i386) || defined(__i386__)) |
399 |
+ |
#define SIGSEGV_ALL_SIGNALS FAULT_HANDLER(SIGBUS) |
400 |
|
#define SIGSEGV_FAULT_HANDLER_ARGLIST int sig, int code, struct sigcontext *scp, char *addr |
401 |
|
#define SIGSEGV_FAULT_HANDLER_ARGS sig, code, scp, addr |
402 |
|
#define SIGSEGV_FAULT_ADDRESS addr |
404 |
|
#define SIGSEGV_REGISTER_FILE ((unsigned long *)&scp->sc_edi) |
405 |
|
#define SIGSEGV_SKIP_INSTRUCTION ix86_skip_instruction |
406 |
|
#endif |
407 |
+ |
#if (defined(alpha) || defined(__alpha__)) |
408 |
+ |
#define SIGSEGV_ALL_SIGNALS FAULT_HANDLER(SIGSEGV) |
409 |
+ |
#define SIGSEGV_FAULT_HANDLER_ARGLIST int sig, char *addr, struct sigcontext *scp |
410 |
+ |
#define SIGSEGV_FAULT_HANDLER_ARGS sig, addr, scp |
411 |
+ |
#define SIGSEGV_FAULT_ADDRESS addr |
412 |
+ |
#define SIGSEGV_FAULT_INSTRUCTION scp->sc_pc |
413 |
+ |
#endif |
414 |
|
#endif |
415 |
|
|
416 |
|
// Extract fault address out of a sigcontext |
1536 |
|
|
1537 |
|
static sigsegv_return_t sigsegv_test_handler(sigsegv_address_t fault_address, sigsegv_address_t instruction_address) |
1538 |
|
{ |
1539 |
+ |
#if DEBUG |
1540 |
+ |
printf("sigsegv_test_handler(%p, %p)\n", fault_address, instruction_address); |
1541 |
+ |
printf("expected fault at %p\n", page + REF_INDEX); |
1542 |
+ |
#ifdef __GNUC__ |
1543 |
+ |
printf("expected instruction address range: %p-%p\n", b_region, e_region); |
1544 |
+ |
#endif |
1545 |
+ |
#endif |
1546 |
|
handler_called++; |
1547 |
|
if ((fault_address - REF_INDEX) != page) |
1548 |
|
exit(10); |