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

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

Issue 1184673005: Fix ia32 android build (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « no previous file | no next file » | 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(HOST_ARCH_ARM) 15 #if defined(HOST_ARCH_IA32)
16 pc = static_cast<uintptr_t>(mcontext.gregs[REG_EIP]);
17 #elif defined(HOST_ARCH_ARM)
16 pc = static_cast<uintptr_t>(mcontext.arm_pc); 18 pc = static_cast<uintptr_t>(mcontext.arm_pc);
17 #elif defined(HOST_ARCH_ARM64) 19 #elif defined(HOST_ARCH_ARM64)
18 pc = static_cast<uintptr_t>(mcontext.pc); 20 pc = static_cast<uintptr_t>(mcontext.pc);
19 #else 21 #else
20 #error Unsupported architecture. 22 #error Unsupported architecture.
21 #endif // HOST_ARCH_... 23 #endif // HOST_ARCH_...
22 return pc; 24 return pc;
23 } 25 }
24 26
25 27
26 uintptr_t SignalHandler::GetFramePointer(const mcontext_t& mcontext) { 28 uintptr_t SignalHandler::GetFramePointer(const mcontext_t& mcontext) {
27 uintptr_t fp = 0; 29 uintptr_t fp = 0;
28 30
29 #if defined(HOST_ARCH_ARM) 31 #if defined(HOST_ARCH_IA32)
32 fp = static_cast<uintptr_t>(mcontext.gregs[REG_EBP]);
33 #elif defined(HOST_ARCH_ARM)
30 fp = static_cast<uintptr_t>(mcontext.arm_fp); 34 fp = static_cast<uintptr_t>(mcontext.arm_fp);
31 #elif defined(HOST_ARCH_ARM64) 35 #elif defined(HOST_ARCH_ARM64)
32 fp = static_cast<uintptr_t>(mcontext.regs[29]); 36 fp = static_cast<uintptr_t>(mcontext.regs[29]);
33 #else 37 #else
34 #error Unsupported architecture. 38 #error Unsupported architecture.
35 #endif // HOST_ARCH_... 39 #endif // HOST_ARCH_...
36 40
37 return fp; 41 return fp;
38 } 42 }
39 43
40 44
41 uintptr_t SignalHandler::GetCStackPointer(const mcontext_t& mcontext) { 45 uintptr_t SignalHandler::GetCStackPointer(const mcontext_t& mcontext) {
42 uintptr_t sp = 0; 46 uintptr_t sp = 0;
43 47
44 #if defined(HOST_ARCH_ARM) 48 #if defined(HOST_ARCH_IA32)
49 sp = static_cast<uintptr_t>(mcontext.gregs[REG_ESP]);
50 #elif defined(HOST_ARCH_ARM)
45 sp = static_cast<uintptr_t>(mcontext.arm_sp); 51 sp = static_cast<uintptr_t>(mcontext.arm_sp);
46 #elif defined(HOST_ARCH_ARM64) 52 #elif defined(HOST_ARCH_ARM64)
47 sp = static_cast<uintptr_t>(mcontext.sp); 53 sp = static_cast<uintptr_t>(mcontext.sp);
48 #else 54 #else
49 #error Unsupported architecture. 55 #error Unsupported architecture.
50 #endif // HOST_ARCH_... 56 #endif // HOST_ARCH_...
51 return sp; 57 return sp;
52 } 58 }
53 59
54 60
55 uintptr_t SignalHandler::GetDartStackPointer(const mcontext_t& mcontext) { 61 uintptr_t SignalHandler::GetDartStackPointer(const mcontext_t& mcontext) {
56 uintptr_t sp = 0; 62 uintptr_t sp = 0;
57 63
58 #if defined(HOST_ARCH_ARM) 64 #if defined(HOST_ARCH_IA32)
65 sp = static_cast<uintptr_t>(mcontext.gregs[REG_ESP]);
66 #elif defined(HOST_ARCH_ARM)
59 sp = static_cast<uintptr_t>(mcontext.arm_sp); 67 sp = static_cast<uintptr_t>(mcontext.arm_sp);
60 #elif defined(HOST_ARCH_ARM64) 68 #elif defined(HOST_ARCH_ARM64)
61 sp = static_cast<uintptr_t>(mcontext.regs[18]); 69 sp = static_cast<uintptr_t>(mcontext.regs[18]);
62 #else 70 #else
63 #error Unsupported architecture. 71 #error Unsupported architecture.
64 #endif // HOST_ARCH_... 72 #endif // HOST_ARCH_...
65 return sp; 73 return sp;
66 } 74 }
67 75
68 76
69 uintptr_t SignalHandler::GetLinkRegister(const mcontext_t& mcontext) { 77 uintptr_t SignalHandler::GetLinkRegister(const mcontext_t& mcontext) {
70 uintptr_t lr = 0; 78 uintptr_t lr = 0;
71 #if defined(HOST_ARCH_ARM) 79
80 #if defined(HOST_ARCH_IA32)
81 lr = 0;
82 #elif defined(HOST_ARCH_ARM)
72 lr = static_cast<uintptr_t>(mcontext.arm_lr); 83 lr = static_cast<uintptr_t>(mcontext.arm_lr);
73 #elif defined(HOST_ARCH_ARM64) 84 #elif defined(HOST_ARCH_ARM64)
74 lr = static_cast<uintptr_t>(mcontext.regs[30]); 85 lr = static_cast<uintptr_t>(mcontext.regs[30]);
75 #else 86 #else
76 #error Unsupported architecture. 87 #error Unsupported architecture.
77 #endif // HOST_ARCH_... 88 #endif // HOST_ARCH_...
78 return lr; 89 return lr;
79 } 90 }
80 91
81 92
(...skipping 16 matching lines...) Expand all
98 act.sa_handler = SIG_IGN; 109 act.sa_handler = SIG_IGN;
99 sigemptyset(&act.sa_mask); 110 sigemptyset(&act.sa_mask);
100 int r = sigaction(SIGPROF, &act, NULL); 111 int r = sigaction(SIGPROF, &act, NULL);
101 ASSERT(r == 0); 112 ASSERT(r == 0);
102 } 113 }
103 114
104 115
105 } // namespace dart 116 } // namespace dart
106 117
107 #endif // defined(TARGET_OS_ANDROID) 118 #endif // defined(TARGET_OS_ANDROID)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698