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/instructions.h" |
6 #include "vm/simulator.h" | 7 #include "vm/simulator.h" |
7 #include "vm/signal_handler.h" | 8 #include "vm/signal_handler.h" |
8 #if defined(TARGET_OS_ANDROID) | 9 #if defined(TARGET_OS_ANDROID) |
9 | 10 |
10 namespace dart { | 11 namespace dart { |
11 | 12 |
12 uintptr_t SignalHandler::GetProgramCounter(const mcontext_t& mcontext) { | 13 uintptr_t SignalHandler::GetProgramCounter(const mcontext_t& mcontext) { |
13 uintptr_t pc = 0; | 14 uintptr_t pc = 0; |
14 | 15 |
15 #if defined(HOST_ARCH_IA32) | 16 #if defined(HOST_ARCH_IA32) |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 #elif defined(HOST_ARCH_ARM64) | 59 #elif defined(HOST_ARCH_ARM64) |
59 sp = static_cast<uintptr_t>(mcontext.sp); | 60 sp = static_cast<uintptr_t>(mcontext.sp); |
60 #else | 61 #else |
61 #error Unsupported architecture. | 62 #error Unsupported architecture. |
62 #endif // HOST_ARCH_... | 63 #endif // HOST_ARCH_... |
63 return sp; | 64 return sp; |
64 } | 65 } |
65 | 66 |
66 | 67 |
67 uintptr_t SignalHandler::GetDartStackPointer(const mcontext_t& mcontext) { | 68 uintptr_t SignalHandler::GetDartStackPointer(const mcontext_t& mcontext) { |
68 uintptr_t sp = 0; | 69 #if defined(TARGET_ARCH_ARM64) && !defined(USING_SIMULATOR) |
69 | 70 return static_cast<uintptr_t>(mcontext.regs[SPREG]); |
70 #if defined(HOST_ARCH_IA32) | |
71 sp = static_cast<uintptr_t>(mcontext.gregs[REG_ESP]); | |
72 #elif defined(HOST_ARCH_X64) | |
73 sp = static_cast<uintptr_t>(mcontext.gregs[REG_RSP]); | |
74 #elif defined(HOST_ARCH_ARM) | |
75 sp = static_cast<uintptr_t>(mcontext.arm_sp); | |
76 #elif defined(HOST_ARCH_ARM64) | |
77 sp = static_cast<uintptr_t>(mcontext.regs[19]); | |
78 #else | 71 #else |
79 #error Unsupported architecture. | 72 return GetCStackPointer(mcontext); |
80 #endif // HOST_ARCH_... | 73 #endif |
81 return sp; | |
82 } | 74 } |
83 | 75 |
84 | 76 |
85 uintptr_t SignalHandler::GetLinkRegister(const mcontext_t& mcontext) { | 77 uintptr_t SignalHandler::GetLinkRegister(const mcontext_t& mcontext) { |
86 uintptr_t lr = 0; | 78 uintptr_t lr = 0; |
87 | 79 |
88 #if defined(HOST_ARCH_IA32) | 80 #if defined(HOST_ARCH_IA32) |
89 lr = 0; | 81 lr = 0; |
90 #elif defined(HOST_ARCH_X64) | 82 #elif defined(HOST_ARCH_X64) |
91 lr = 0; | 83 lr = 0; |
(...skipping 27 matching lines...) Expand all Loading... |
119 act.sa_handler = SIG_IGN; | 111 act.sa_handler = SIG_IGN; |
120 sigemptyset(&act.sa_mask); | 112 sigemptyset(&act.sa_mask); |
121 int r = sigaction(SIGPROF, &act, NULL); | 113 int r = sigaction(SIGPROF, &act, NULL); |
122 ASSERT(r == 0); | 114 ASSERT(r == 0); |
123 } | 115 } |
124 | 116 |
125 | 117 |
126 } // namespace dart | 118 } // namespace dart |
127 | 119 |
128 #endif // defined(TARGET_OS_ANDROID) | 120 #endif // defined(TARGET_OS_ANDROID) |
OLD | NEW |