Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(758)

Unified Diff: runtime/vm/signal_handler_openbsd.cc

Issue 1559053002: Refs #10260 OpenBSD support #25327 Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address code review issues Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/signal_handler.h ('k') | runtime/vm/thread_interrupter_openbsd.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « runtime/vm/signal_handler.h ('k') | runtime/vm/thread_interrupter_openbsd.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698