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_ANDROID) | 8 #if defined(TARGET_OS_ANDROID) |
9 | 9 |
10 namespace dart { | 10 namespace dart { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 sp = static_cast<uintptr_t>(mcontext.arm_sp); | 59 sp = static_cast<uintptr_t>(mcontext.arm_sp); |
60 #elif defined(TARGET_ARCH_ARM64) | 60 #elif defined(TARGET_ARCH_ARM64) |
61 sp = static_cast<uintptr_t>(mcontext.regs[18]); | 61 sp = static_cast<uintptr_t>(mcontext.regs[18]); |
62 #else | 62 #else |
63 UNIMPLEMENTED(); | 63 UNIMPLEMENTED(); |
64 #endif // TARGET_ARCH_... | 64 #endif // TARGET_ARCH_... |
65 return sp; | 65 return sp; |
66 } | 66 } |
67 | 67 |
68 | 68 |
| 69 uintptr_t SignalHandler::GetLinkRegister(const mcontext_t& mcontext) { |
| 70 uintptr_t lr = 0; |
| 71 #if defined(TARGET_ARCH_ARM) |
| 72 lr = static_cast<uintptr_t>(mcontext.arm_lr); |
| 73 #elif defined(TARGET_ARCH_ARM64) |
| 74 lr = static_cast<uintptr_t>(mcontext.regs[30]); |
| 75 UNIMPLEMENTED(); |
| 76 #else |
| 77 UNIMPLEMENTED(); |
| 78 #endif // TARGET_ARCH_... |
| 79 return lr; |
| 80 } |
| 81 |
| 82 |
69 void SignalHandler::Install(SignalAction action) { | 83 void SignalHandler::Install(SignalAction action) { |
70 struct sigaction act; | 84 struct sigaction act; |
71 memset(&act, 0, sizeof(act)); | 85 memset(&act, 0, sizeof(act)); |
72 act.sa_sigaction = action; | 86 act.sa_sigaction = action; |
73 act.sa_flags = SA_RESTART | SA_SIGINFO; | 87 act.sa_flags = SA_RESTART | SA_SIGINFO; |
74 sigemptyset(&act.sa_mask); | 88 sigemptyset(&act.sa_mask); |
75 // TODO(johnmccutchan): Do we care about restoring the signal handler? | 89 // TODO(johnmccutchan): Do we care about restoring the signal handler? |
76 struct sigaction old_act; | 90 struct sigaction old_act; |
77 int r = sigaction(SIGPROF, &act, &old_act); | 91 int r = sigaction(SIGPROF, &act, &old_act); |
78 ASSERT(r == 0); | 92 ASSERT(r == 0); |
79 } | 93 } |
80 | 94 |
81 | 95 |
82 } // namespace dart | 96 } // namespace dart |
83 | 97 |
84 #endif // defined(TARGET_OS_ANDROID) | 98 #endif // defined(TARGET_OS_ANDROID) |
OLD | NEW |