264 |
|
#define SIGSEGV_SKIP_INSTRUCTION ix86_skip_instruction |
265 |
|
#endif |
266 |
|
#endif |
267 |
< |
#if defined(__FreeBSD__) |
267 |
> |
#if defined(__FreeBSD__) || defined(__OpenBSD__) |
268 |
|
#if (defined(i386) || defined(__i386__)) |
269 |
|
#define SIGSEGV_FAULT_INSTRUCTION (((struct sigcontext *)scp)->sc_eip) |
270 |
|
#define SIGSEGV_REGISTER_FILE ((unsigned long *)&(((struct sigcontext *)scp)->sc_edi)) /* EDI is the first GPR (even below EIP) in sigcontext */ |
737 |
|
#endif |
738 |
|
}; |
739 |
|
#endif |
740 |
+ |
#if defined(__OpenBSD__) |
741 |
+ |
enum { |
742 |
+ |
#if defined(__i386__) |
743 |
+ |
// EDI is the first register we consider |
744 |
+ |
#define OREG(REG) offsetof(struct sigcontext, sc_##REG) |
745 |
+ |
#define DREG(REG) ((OREG(REG) - OREG(edi)) / 4) |
746 |
+ |
X86_REG_EIP = DREG(eip), // 7 |
747 |
+ |
X86_REG_EAX = DREG(eax), // 6 |
748 |
+ |
X86_REG_ECX = DREG(ecx), // 5 |
749 |
+ |
X86_REG_EDX = DREG(edx), // 4 |
750 |
+ |
X86_REG_EBX = DREG(ebx), // 3 |
751 |
+ |
X86_REG_ESP = DREG(esp), // 10 |
752 |
+ |
X86_REG_EBP = DREG(ebp), // 2 |
753 |
+ |
X86_REG_ESI = DREG(esi), // 1 |
754 |
+ |
X86_REG_EDI = DREG(edi) // 0 |
755 |
+ |
#undef DREG |
756 |
+ |
#undef OREG |
757 |
+ |
#endif |
758 |
+ |
}; |
759 |
+ |
#endif |
760 |
|
#if defined(__sun__) |
761 |
|
// Same as for Linux, need to check for x86-64 |
762 |
|
enum { |