OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
7 | 7 |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/cpu.h" | 9 #include "vm/cpu.h" |
10 #include "vm/cpuinfo.h" | 10 #include "vm/cpuinfo.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 "arm"; | 62 "arm"; |
63 } | 63 } |
64 | 64 |
65 | 65 |
66 bool HostCPUFeatures::integer_division_supported_ = false; | 66 bool HostCPUFeatures::integer_division_supported_ = false; |
67 bool HostCPUFeatures::vfp_supported_ = false; | 67 bool HostCPUFeatures::vfp_supported_ = false; |
68 bool HostCPUFeatures::neon_supported_ = false; | 68 bool HostCPUFeatures::neon_supported_ = false; |
69 bool HostCPUFeatures::hardfp_supported_ = false; | 69 bool HostCPUFeatures::hardfp_supported_ = false; |
70 const char* HostCPUFeatures::hardware_ = NULL; | 70 const char* HostCPUFeatures::hardware_ = NULL; |
71 ARMVersion HostCPUFeatures::arm_version_ = ARMvUnknown; | 71 ARMVersion HostCPUFeatures::arm_version_ = ARMvUnknown; |
| 72 intptr_t HostCPUFeatures::store_pc_read_offset_ = 8; |
72 #if defined(DEBUG) | 73 #if defined(DEBUG) |
73 bool HostCPUFeatures::initialized_ = false; | 74 bool HostCPUFeatures::initialized_ = false; |
74 #endif | 75 #endif |
75 | 76 |
76 | 77 |
77 #if defined(HOST_ARCH_ARM) | 78 #if defined(HOST_ARCH_ARM) |
78 void HostCPUFeatures::InitOnce() { | 79 void HostCPUFeatures::InitOnce() { |
79 CpuInfo::InitOnce(); | 80 CpuInfo::InitOnce(); |
80 hardware_ = CpuInfo::GetCpuModel(); | 81 hardware_ = CpuInfo::GetCpuModel(); |
81 | 82 |
82 // Has floating point unit. | 83 // Has floating point unit. |
83 vfp_supported_ = CpuInfo::FieldContains(kCpuInfoFeatures, "vfp") && | 84 vfp_supported_ = CpuInfo::FieldContains(kCpuInfoFeatures, "vfp") && |
84 FLAG_use_vfp; | 85 FLAG_use_vfp; |
85 | 86 |
86 // Check for ARMv5, ARMv6 or ARMv7. It can be in either the Processor or | 87 // Check for ARMv5, ARMv6 or ARMv7. It can be in either the Processor or |
87 // Model information fields. | 88 // Model information fields. |
88 if (CpuInfo::FieldContains(kCpuInfoProcessor, "ARM926EJ-S") || | 89 if (CpuInfo::FieldContains(kCpuInfoProcessor, "ARM926EJ-S") || |
89 CpuInfo::FieldContains(kCpuInfoModel, "ARM926EJ-S")) { | 90 CpuInfo::FieldContains(kCpuInfoModel, "ARM926EJ-S")) { |
90 // Lego Mindstorm EV3. | 91 // Lego Mindstorm EV3. |
91 arm_version_ = ARMv5TE; | 92 arm_version_ = ARMv5TE; |
| 93 // On ARMv5, the PC read offset in an STR or STM instruction is either 8 or |
| 94 // 12 bytes depending on the implementation. On the Mindstorm EV3 it is 12 |
| 95 // bytes. |
| 96 store_pc_read_offset_ = 12; |
92 } else if (CpuInfo::FieldContains(kCpuInfoProcessor, "ARMv6") || | 97 } else if (CpuInfo::FieldContains(kCpuInfoProcessor, "ARMv6") || |
93 CpuInfo::FieldContains(kCpuInfoModel, "ARMv6")) { | 98 CpuInfo::FieldContains(kCpuInfoModel, "ARMv6")) { |
94 // Raspberry Pi, etc. | 99 // Raspberry Pi, etc. |
95 arm_version_ = ARMv6; | 100 arm_version_ = ARMv6; |
96 } else { | 101 } else { |
97 ASSERT(CpuInfo::FieldContains(kCpuInfoProcessor, "ARMv7") || | 102 ASSERT(CpuInfo::FieldContains(kCpuInfoProcessor, "ARMv7") || |
98 CpuInfo::FieldContains(kCpuInfoModel, "ARMv7")); | 103 CpuInfo::FieldContains(kCpuInfoModel, "ARMv7")); |
99 arm_version_ = ARMv7; | 104 arm_version_ = ARMv7; |
100 } | 105 } |
101 | 106 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 ASSERT(hardware_ != NULL); | 173 ASSERT(hardware_ != NULL); |
169 free(const_cast<char*>(hardware_)); | 174 free(const_cast<char*>(hardware_)); |
170 hardware_ = NULL; | 175 hardware_ = NULL; |
171 CpuInfo::Cleanup(); | 176 CpuInfo::Cleanup(); |
172 } | 177 } |
173 #endif // defined(HOST_ARCH_ARM) | 178 #endif // defined(HOST_ARCH_ARM) |
174 | 179 |
175 } // namespace dart | 180 } // namespace dart |
176 | 181 |
177 #endif // defined TARGET_ARCH_ARM | 182 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |