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_OS_LINUX) | 6 #if defined(TARGET_OS_LINUX) |
7 | 7 |
8 #include "vm/cpuinfo.h" | 8 #include "vm/cpuinfo.h" |
9 #include "vm/cpuid.h" | 9 #include "vm/cpuid.h" |
10 #include "vm/proccpuinfo.h" | 10 #include "vm/proccpuinfo.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 const char* CpuInfo::fields_[kCpuInfoMax] = {0}; | 21 const char* CpuInfo::fields_[kCpuInfoMax] = {0}; |
22 | 22 |
23 void CpuInfo::InitOnce() { | 23 void CpuInfo::InitOnce() { |
24 #if defined(HOST_ARCH_IA32) || defined(HOST_ARCH_X64) | 24 #if defined(HOST_ARCH_IA32) || defined(HOST_ARCH_X64) |
25 fields_[kCpuInfoProcessor] = "vendor_id"; | 25 fields_[kCpuInfoProcessor] = "vendor_id"; |
26 fields_[kCpuInfoModel] = "model name"; | 26 fields_[kCpuInfoModel] = "model name"; |
27 fields_[kCpuInfoHardware] = "model name"; | 27 fields_[kCpuInfoHardware] = "model name"; |
28 fields_[kCpuInfoFeatures] = "flags"; | 28 fields_[kCpuInfoFeatures] = "flags"; |
29 method_ = kCpuInfoCpuId; | 29 method_ = kCpuInfoCpuId; |
30 CpuId::InitOnce(); | 30 CpuId::InitOnce(); |
31 #elif defined(HOST_ARCH_ARM) || defined(HOST_ARCH_ARM64) | 31 #elif defined(HOST_ARCH_ARM) |
32 // TODO(zra): Verify that these field names are correct for arm64. | |
33 fields_[kCpuInfoProcessor] = "Processor"; | 32 fields_[kCpuInfoProcessor] = "Processor"; |
34 fields_[kCpuInfoModel] = "model name"; | 33 fields_[kCpuInfoModel] = "model name"; |
35 fields_[kCpuInfoHardware] = "Hardware"; | 34 fields_[kCpuInfoHardware] = "Hardware"; |
36 fields_[kCpuInfoFeatures] = "Features"; | 35 fields_[kCpuInfoFeatures] = "Features"; |
37 method_ = kCpuInfoSystem; | 36 method_ = kCpuInfoSystem; |
38 ProcCpuInfo::InitOnce(); | 37 ProcCpuInfo::InitOnce(); |
| 38 #elif defined(HOST_ARCH_ARM64) |
| 39 fields_[kCpuInfoProcessor] = "Processor"; |
| 40 fields_[kCpuInfoModel] = "CPU implementer"; |
| 41 fields_[kCpuInfoHardware] = "CPU implementer"; |
| 42 fields_[kCpuInfoFeatures] = "Features"; |
| 43 method_ = kCpuInfoSystem; |
| 44 ProcCpuInfo::InitOnce(); |
39 #elif defined(HOST_ARCH_MIPS) | 45 #elif defined(HOST_ARCH_MIPS) |
40 fields_[kCpuInfoProcessor] = "system type"; | 46 fields_[kCpuInfoProcessor] = "system type"; |
41 fields_[kCpuInfoModel] = "cpu model"; | 47 fields_[kCpuInfoModel] = "cpu model"; |
42 fields_[kCpuInfoHardware] = "cpu model"; | 48 fields_[kCpuInfoHardware] = "cpu model"; |
43 fields_[kCpuInfoFeatures] = "ASEs implemented"; | 49 fields_[kCpuInfoFeatures] = "ASEs implemented"; |
44 method_ = kCpuInfoSystem; | 50 method_ = kCpuInfoSystem; |
45 ProcCpuInfo::InitOnce(); | 51 ProcCpuInfo::InitOnce(); |
46 #else | 52 #else |
47 #error Unrecognized target architecture | 53 #error Unrecognized target architecture |
48 #endif | 54 #endif |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 (strcmp(field, fields_[kCpuInfoFeatures]) == 0); | 126 (strcmp(field, fields_[kCpuInfoFeatures]) == 0); |
121 } else { | 127 } else { |
122 ASSERT(method_ == kCpuInfoSystem); | 128 ASSERT(method_ == kCpuInfoSystem); |
123 return ProcCpuInfo::HasField(field); | 129 return ProcCpuInfo::HasField(field); |
124 } | 130 } |
125 } | 131 } |
126 | 132 |
127 } // namespace dart | 133 } // namespace dart |
128 | 134 |
129 #endif // defined(TARGET_OS_LINUX) | 135 #endif // defined(TARGET_OS_LINUX) |
OLD | NEW |