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

Side by Side Diff: runtime/vm/signal_handler_android.cc

Issue 539573003: Adds support for building arm64 Android. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/signal_handler.h ('k') | tools/android_link.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 {
11 11
12 uintptr_t SignalHandler::GetProgramCounter(const mcontext_t& mcontext) { 12 uintptr_t SignalHandler::GetProgramCounter(const mcontext_t& mcontext) {
13 uintptr_t pc = 0; 13 uintptr_t pc = 0;
14 14
15 #if defined(TARGET_ARCH_ARM) 15 #if defined(TARGET_ARCH_ARM)
16 pc = static_cast<uintptr_t>(mcontext.arm_pc); 16 pc = static_cast<uintptr_t>(mcontext.arm_pc);
17 #elif defined(TARGET_ARCH_ARM64)
18 pc = static_cast<uintptr_t>(mcontext.pc);
17 #else 19 #else
18 UNIMPLEMENTED(); 20 UNIMPLEMENTED();
19 #endif // TARGET_ARCH_... 21 #endif // TARGET_ARCH_...
20 return pc; 22 return pc;
21 } 23 }
22 24
23 25
24 uintptr_t SignalHandler::GetFramePointer(const mcontext_t& mcontext) { 26 uintptr_t SignalHandler::GetFramePointer(const mcontext_t& mcontext) {
25 uintptr_t fp = 0; 27 uintptr_t fp = 0;
26 28
27 #if defined(TARGET_ARCH_ARM) 29 #if defined(TARGET_ARCH_ARM)
28 fp = static_cast<uintptr_t>(mcontext.arm_fp); 30 fp = static_cast<uintptr_t>(mcontext.arm_fp);
31 #elif defined(TARGET_ARCH_ARM64)
32 fp = static_cast<uintptr_t>(mcontext.regs[29]);
29 #else 33 #else
30 UNIMPLEMENTED(); 34 UNIMPLEMENTED();
31 #endif // TARGET_ARCH_... 35 #endif // TARGET_ARCH_...
32 36
33 return fp; 37 return fp;
34 } 38 }
35 39
36 40
37 uintptr_t SignalHandler::GetStackPointer(const mcontext_t& mcontext) { 41 uintptr_t SignalHandler::GetStackPointer(const mcontext_t& mcontext) {
38 uintptr_t sp = 0; 42 uintptr_t sp = 0;
39 43
40 #if defined(TARGET_ARCH_ARM) 44 #if defined(TARGET_ARCH_ARM)
41 sp = static_cast<uintptr_t>(mcontext.arm_sp); 45 sp = static_cast<uintptr_t>(mcontext.arm_sp);
46 #elif defined(TARGET_ARCH_ARM64)
47 sp = static_cast<uintptr_t>(mcontext.sp);
42 #else 48 #else
43 UNIMPLEMENTED(); 49 UNIMPLEMENTED();
44 #endif // TARGET_ARCH_... 50 #endif // TARGET_ARCH_...
45 return sp; 51 return sp;
46 } 52 }
47 53
48 54
49 void SignalHandler::Install(SignalAction action) { 55 void SignalHandler::Install(SignalAction action) {
50 struct sigaction act; 56 struct sigaction act;
51 memset(&act, 0, sizeof(act)); 57 memset(&act, 0, sizeof(act));
52 act.sa_sigaction = action; 58 act.sa_sigaction = action;
53 act.sa_flags = SA_RESTART | SA_SIGINFO; 59 act.sa_flags = SA_RESTART | SA_SIGINFO;
54 sigemptyset(&act.sa_mask); 60 sigemptyset(&act.sa_mask);
55 // TODO(johnmccutchan): Do we care about restoring the signal handler? 61 // TODO(johnmccutchan): Do we care about restoring the signal handler?
56 struct sigaction old_act; 62 struct sigaction old_act;
57 int r = sigaction(SIGPROF, &act, &old_act); 63 int r = sigaction(SIGPROF, &act, &old_act);
58 ASSERT(r == 0); 64 ASSERT(r == 0);
59 } 65 }
60 66
61 67
62 } // namespace dart 68 } // namespace dart
63 69
64 #endif // defined(TARGET_OS_ANDROID) 70 #endif // defined(TARGET_OS_ANDROID)
OLDNEW
« no previous file with comments | « runtime/vm/signal_handler.h ('k') | tools/android_link.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698