Index: runtime/vm/signal_handler_openbsd.cc |
diff --git a/runtime/vm/signal_handler_linux.cc b/runtime/vm/signal_handler_openbsd.cc |
similarity index 66% |
copy from runtime/vm/signal_handler_linux.cc |
copy to runtime/vm/signal_handler_openbsd.cc |
index b49f90a767826b23394fb110b484797c1c2ee2c3..7e9fb91180c950a5af4b7b4eb47650b0a88d60e8 100644 |
--- a/runtime/vm/signal_handler_linux.cc |
+++ b/runtime/vm/signal_handler_openbsd.cc |
@@ -5,7 +5,7 @@ |
#include "vm/globals.h" |
#include "vm/simulator.h" |
#include "vm/signal_handler.h" |
-#if defined(TARGET_OS_LINUX) |
+#if defined(TARGET_OS_OPENBSD) |
namespace dart { |
@@ -13,15 +13,9 @@ uintptr_t SignalHandler::GetProgramCounter(const mcontext_t& mcontext) { |
uintptr_t pc = 0; |
#if defined(HOST_ARCH_IA32) |
- pc = static_cast<uintptr_t>(mcontext.gregs[REG_EIP]); |
+ pc = static_cast<uintptr_t>(mcontext.sc_eip); |
#elif defined(HOST_ARCH_X64) |
- pc = static_cast<uintptr_t>(mcontext.gregs[REG_RIP]); |
-#elif defined(HOST_ARCH_ARM) |
- pc = static_cast<uintptr_t>(mcontext.arm_pc); |
-#elif defined(HOST_ARCH_ARM64) |
- pc = static_cast<uintptr_t>(mcontext.pc); |
-#elif defined(HOST_ARCH_MIPS) |
- pc = static_cast<uintptr_t>(mcontext.pc); |
+ pc = static_cast<uintptr_t>(mcontext.sc_rip); |
#else |
#error Unsupported architecture. |
#endif // HOST_ARCH_... |
@@ -33,15 +27,9 @@ uintptr_t SignalHandler::GetFramePointer(const mcontext_t& mcontext) { |
uintptr_t fp = 0; |
#if defined(HOST_ARCH_IA32) |
- fp = static_cast<uintptr_t>(mcontext.gregs[REG_EBP]); |
+ fp = static_cast<uintptr_t>(mcontext.sc_ebp); |
#elif defined(HOST_ARCH_X64) |
- fp = static_cast<uintptr_t>(mcontext.gregs[REG_RBP]); |
-#elif defined(HOST_ARCH_ARM) |
- fp = static_cast<uintptr_t>(mcontext.arm_fp); |
-#elif defined(HOST_ARCH_ARM64) |
- fp = static_cast<uintptr_t>(mcontext.regs[29]); |
-#elif defined(HOST_ARCH_MIPS) |
- fp = static_cast<uintptr_t>(mcontext.gregs[30]); |
+ fp = static_cast<uintptr_t>(mcontext.sc_rbp); |
#else |
#error Unsupported architecture. |
#endif // HOST_ARCH_... |
@@ -54,15 +42,9 @@ uintptr_t SignalHandler::GetCStackPointer(const mcontext_t& mcontext) { |
uintptr_t sp = 0; |
#if defined(HOST_ARCH_IA32) |
- sp = static_cast<uintptr_t>(mcontext.gregs[REG_ESP]); |
+ sp = static_cast<uintptr_t>(mcontext.sc_esp); |
#elif defined(HOST_ARCH_X64) |
- sp = static_cast<uintptr_t>(mcontext.gregs[REG_RSP]); |
-#elif defined(HOST_ARCH_ARM) |
- sp = static_cast<uintptr_t>(mcontext.arm_sp); |
-#elif defined(HOST_ARCH_ARM64) |
- sp = static_cast<uintptr_t>(mcontext.sp); |
-#elif defined(HOST_ARCH_MIPS) |
- sp = static_cast<uintptr_t>(mcontext.gregs[29]); |
+ sp = static_cast<uintptr_t>(mcontext.sc_rsp); |
#else |
#error Unsupported architecture. |
#endif // HOST_ARCH_... |
@@ -72,7 +54,7 @@ uintptr_t SignalHandler::GetCStackPointer(const mcontext_t& mcontext) { |
uintptr_t SignalHandler::GetDartStackPointer(const mcontext_t& mcontext) { |
#if defined(TARGET_ARCH_ARM64) && !defined(USING_SIMULATOR) |
- return static_cast<uintptr_t>(mcontext.regs[19]); |
+ return static_cast<uintptr_t>(mcontext.regs[18]); |
#else |
return GetCStackPointer(mcontext); |
#endif |
@@ -124,4 +106,4 @@ void SignalHandler::Remove() { |
} // namespace dart |
-#endif // defined(TARGET_OS_LINUX) |
+#endif // defined(TARGET_OS_OPENBSD) |