OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/globals.h" | 5 #include "vm/globals.h" |
6 #include "vm/simulator.h" | 6 #include "vm/simulator.h" |
7 #include "vm/signal_handler.h" | 7 #include "vm/signal_handler.h" |
8 #if defined(TARGET_OS_LINUX) | 8 #if defined(TARGET_OS_LINUX) |
9 | 9 |
10 namespace dart { | 10 namespace dart { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 90 |
91 uintptr_t SignalHandler::GetDartStackPointer(const mcontext_t& mcontext) { | 91 uintptr_t SignalHandler::GetDartStackPointer(const mcontext_t& mcontext) { |
92 #if defined(TARGET_ARCH_ARM64) && !defined(USING_SIMULATOR) | 92 #if defined(TARGET_ARCH_ARM64) && !defined(USING_SIMULATOR) |
93 return static_cast<uintptr_t>(mcontext.regs[18]); | 93 return static_cast<uintptr_t>(mcontext.regs[18]); |
94 #else | 94 #else |
95 return GetCStackPointer(mcontext); | 95 return GetCStackPointer(mcontext); |
96 #endif | 96 #endif |
97 } | 97 } |
98 | 98 |
99 | 99 |
| 100 uintptr_t SignalHandler::GetLinkRegister(const mcontext_t& mcontext) { |
| 101 uintptr_t lr = 0; |
| 102 |
| 103 #if defined(TARGET_ARCH_IA32) |
| 104 lr = 0; |
| 105 #elif defined(TARGET_ARCH_X64) |
| 106 lr = 0; |
| 107 #elif defined(TARGET_ARCH_MIPS) && defined(USING_SIMULATOR) |
| 108 lr = 0; |
| 109 #elif defined(TARGET_ARCH_ARM) && defined(USING_SIMULATOR) |
| 110 lr = 0; |
| 111 #elif defined(TARGET_ARCH_ARM64) && defined(USING_SIMULATOR) |
| 112 lr = 0; |
| 113 #elif defined(TARGET_ARCH_ARM) |
| 114 lr = static_cast<uintptr_t>(mcontext.arm_lr); |
| 115 #elif defined(TARGET_ARCH_ARM64) |
| 116 lr = static_cast<uintptr_t>(mcontext.lr); |
| 117 #elif defined(TARGET_ARCH_MIPS) |
| 118 lr = static_cast<uintptr_t>(mcontext.gregs[31]); |
| 119 #else |
| 120 UNIMPLEMENTED(); |
| 121 #endif // TARGET_ARCH_... |
| 122 return lr; |
| 123 } |
| 124 |
| 125 |
100 void SignalHandler::Install(SignalAction action) { | 126 void SignalHandler::Install(SignalAction action) { |
101 struct sigaction act; | 127 struct sigaction act; |
102 act.sa_handler = NULL; | 128 act.sa_handler = NULL; |
103 act.sa_sigaction = action; | 129 act.sa_sigaction = action; |
104 sigemptyset(&act.sa_mask); | 130 sigemptyset(&act.sa_mask); |
105 act.sa_flags = SA_RESTART | SA_SIGINFO; | 131 act.sa_flags = SA_RESTART | SA_SIGINFO; |
106 // TODO(johnmccutchan): Do we care about restoring the signal handler? | 132 // TODO(johnmccutchan): Do we care about restoring the signal handler? |
107 struct sigaction old_act; | 133 struct sigaction old_act; |
108 int r = sigaction(SIGPROF, &act, &old_act); | 134 int r = sigaction(SIGPROF, &act, &old_act); |
109 ASSERT(r == 0); | 135 ASSERT(r == 0); |
110 } | 136 } |
111 | 137 |
112 | 138 |
113 } // namespace dart | 139 } // namespace dart |
114 | 140 |
115 #endif // defined(TARGET_OS_LINUX) | 141 #endif // defined(TARGET_OS_LINUX) |
OLD | NEW |