599 |
|
#define SIGSEGV_REGISTER_FILE (unsigned long *)&state->srr0, (unsigned long *)&state->r0 |
600 |
|
#endif |
601 |
|
#ifdef __i386__ |
602 |
+ |
#ifdef i386_SAVED_STATE |
603 |
|
#define SIGSEGV_THREAD_STATE_TYPE struct i386_saved_state |
604 |
|
#define SIGSEGV_THREAD_STATE_FLAVOR i386_SAVED_STATE |
605 |
|
#define SIGSEGV_THREAD_STATE_COUNT i386_SAVED_STATE_COUNT |
606 |
+ |
#define SIGSEGV_REGISTER_FILE ((unsigned long *)&state->edi) /* EDI is the first GPR we consider */ |
607 |
+ |
#else |
608 |
+ |
#define SIGSEGV_THREAD_STATE_TYPE struct i386_thread_state |
609 |
+ |
#define SIGSEGV_THREAD_STATE_FLAVOR i386_THREAD_STATE |
610 |
+ |
#define SIGSEGV_THREAD_STATE_COUNT i386_THREAD_STATE_COUNT |
611 |
+ |
#define SIGSEGV_REGISTER_FILE ((unsigned long *)&state->eax) /* EAX is the first GPR we consider */ |
612 |
+ |
#endif |
613 |
|
#define SIGSEGV_FAULT_INSTRUCTION state->eip |
614 |
|
#define SIGSEGV_SKIP_INSTRUCTION ix86_skip_instruction |
607 |
– |
#define SIGSEGV_REGISTER_FILE ((unsigned long *)&state->edi) /* EDI is the first GPR we consider */ |
615 |
|
#endif |
616 |
|
#define SIGSEGV_FAULT_ADDRESS code[1] |
617 |
|
#define SIGSEGV_FAULT_HANDLER_INVOKE(ADDR, IP) ((code[0] == KERN_PROTECTION_FAILURE) ? sigsegv_fault_handler(ADDR, IP) : SIGSEGV_RETURN_FAILURE) |
773 |
|
}; |
774 |
|
#endif |
775 |
|
#if defined(__APPLE__) && defined(__MACH__) |
769 |
– |
// expected to be the same as FreeBSD |
776 |
|
enum { |
777 |
+ |
#ifdef i386_SAVED_STATE |
778 |
+ |
// same as FreeBSD (in Open Darwin 8.0.1) |
779 |
|
X86_REG_EIP = 10, |
780 |
|
X86_REG_EAX = 7, |
781 |
|
X86_REG_ECX = 6, |
785 |
|
X86_REG_EBP = 2, |
786 |
|
X86_REG_ESI = 1, |
787 |
|
X86_REG_EDI = 0 |
788 |
+ |
#else |
789 |
+ |
// new layout (MacOS X 10.4.4 for x86) |
790 |
+ |
X86_REG_EIP = 10, |
791 |
+ |
X86_REG_EAX = 0, |
792 |
+ |
X86_REG_ECX = 2, |
793 |
+ |
X86_REG_EDX = 4, |
794 |
+ |
X86_REG_EBX = 1, |
795 |
+ |
X86_REG_ESP = 7, |
796 |
+ |
X86_REG_EBP = 6, |
797 |
+ |
X86_REG_ESI = 5, |
798 |
+ |
X86_REG_EDI = 4 |
799 |
+ |
#endif |
800 |
|
}; |
801 |
|
#endif |
802 |
|
#if defined(_WIN32) |
1670 |
|
mach_port_t port; |
1671 |
|
exception_behavior_t behavior; |
1672 |
|
thread_state_flavor_t flavor; |
1673 |
< |
thread_state_t thread_state; |
1673 |
> |
thread_state_data_t thread_state; |
1674 |
|
mach_msg_type_number_t thread_state_count; |
1675 |
|
|
1676 |
|
for (portIndex = 0; portIndex < oldExceptionPorts->maskCount; portIndex++) { |