212 |
|
|
213 |
|
#if HAVE_SIGINFO_T |
214 |
|
// Generic extended signal handler |
215 |
– |
#define SIGSEGV_FAULT_HANDLER sigsegv_fault_handler |
215 |
|
#if defined(__NetBSD__) || defined(__FreeBSD__) |
216 |
|
#define SIGSEGV_ALL_SIGNALS FAULT_HANDLER(SIGBUS) |
217 |
|
#else |
256 |
|
#endif |
257 |
|
|
258 |
|
#if HAVE_SIGCONTEXT_SUBTERFUGE |
260 |
– |
#define SIGSEGV_FAULT_HANDLER sigsegv_fault_handler |
259 |
|
// Linux kernels prior to 2.4 ? |
260 |
|
#if defined(__linux__) |
261 |
|
#define SIGSEGV_ALL_SIGNALS FAULT_HANDLER(SIGSEGV) |
468 |
|
|
469 |
|
#define SIGSEGV_FAULT_ADDRESS code[1] |
470 |
|
#define SIGSEGV_FAULT_INSTRUCTION get_fault_instruction(thread, state) |
471 |
< |
#define SIGSEGV_FAULT_HANDLER (code[0] == KERN_PROTECTION_FAILURE) && sigsegv_fault_handler |
471 |
> |
#define SIGSEGV_FAULT_HANDLER_INVOKE(ADDR, IP) ((code[0] == KERN_PROTECTION_FAILURE) ? sigsegv_fault_handler(ADDR, IP) : SIGSEGV_RETURN_FAILURE) |
472 |
|
#define SIGSEGV_FAULT_HANDLER_ARGLIST mach_port_t thread, exception_data_t code, ppc_thread_state_t *state |
473 |
|
#define SIGSEGV_FAULT_HANDLER_ARGS thread, code, &state |
474 |
|
#define SIGSEGV_SKIP_INSTRUCTION powerpc_skip_instruction |
782 |
|
#ifndef SIGSEGV_FAULT_HANDLER_ARGLIST_1 |
783 |
|
#define SIGSEGV_FAULT_HANDLER_ARGLIST_1 SIGSEGV_FAULT_HANDLER_ARGLIST |
784 |
|
#endif |
785 |
+ |
#ifndef SIGSEGV_FAULT_HANDLER_INVOKE |
786 |
+ |
#define SIGSEGV_FAULT_HANDLER_INVOKE(ADDR, IP) sigsegv_fault_handler(ADDR, IP) |
787 |
+ |
#endif |
788 |
|
|
789 |
|
// SIGSEGV recovery supported ? |
790 |
|
#if defined(SIGSEGV_ALL_SIGNALS) && defined(SIGSEGV_FAULT_HANDLER_ARGLIST) && defined(SIGSEGV_FAULT_ADDRESS) |
805 |
|
sigsegv_address_t fault_instruction = (sigsegv_address_t)SIGSEGV_FAULT_INSTRUCTION; |
806 |
|
|
807 |
|
// Call user's handler and reinstall the global handler, if required |
808 |
< |
switch (sigsegv_fault_handler(fault_address, fault_instruction)) { |
808 |
> |
switch (SIGSEGV_FAULT_HANDLER_INVOKE(fault_address, fault_instruction)) { |
809 |
|
case SIGSEGV_RETURN_SUCCESS: |
810 |
|
return true; |
811 |
|
|