OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 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. |
| 4 |
| 5 #include "vm/globals.h" |
| 6 |
| 7 #if defined(TARGET_ARCH_ARM64) |
| 8 |
| 9 #include "vm/cpu.h" |
| 10 #include "vm/cpuinfo.h" |
| 11 #include "vm/simulator.h" |
| 12 |
| 13 #if defined(HOST_ARCH_ARM64) |
| 14 #include <sys/syscall.h> /* NOLINT */ |
| 15 #include <unistd.h> /* NOLINT */ |
| 16 #endif |
| 17 |
| 18 namespace dart { |
| 19 |
| 20 void CPU::FlushICache(uword start, uword size) { |
| 21 #if defined(USING_SIMULATOR) |
| 22 // Nothing to do. |
| 23 #else |
| 24 UNIMPLEMENTED(); |
| 25 #endif |
| 26 } |
| 27 |
| 28 |
| 29 const char* CPU::Id() { |
| 30 return |
| 31 #if !defined(HOST_ARCH_ARM64) |
| 32 "sim" |
| 33 #endif // !defined(HOST_ARCH_ARM64) |
| 34 "arm64"; |
| 35 } |
| 36 |
| 37 |
| 38 const char* HostCPUFeatures::hardware_ = NULL; |
| 39 #if defined(DEBUG) |
| 40 bool HostCPUFeatures::initialized_ = false; |
| 41 #endif |
| 42 |
| 43 |
| 44 #if defined(HOST_ARCH_ARM64) |
| 45 void HostCPUFeatures::InitOnce() { |
| 46 CpuInfo::InitOnce(); |
| 47 hardware_ = CpuInfo::GetCpuModel(); |
| 48 #if defined(DEBUG) |
| 49 initialized_ = true; |
| 50 #endif |
| 51 } |
| 52 |
| 53 |
| 54 void HostCPUFeatures::Cleanup() { |
| 55 DEBUG_ASSERT(initialized_); |
| 56 #if defined(DEBUG) |
| 57 initialized_ = false; |
| 58 #endif |
| 59 ASSERT(hardware_ != NULL); |
| 60 free(const_cast<char*>(hardware_)); |
| 61 hardware_ = NULL; |
| 62 CpuInfo::Cleanup(); |
| 63 } |
| 64 |
| 65 #else |
| 66 |
| 67 void HostCPUFeatures::InitOnce() { |
| 68 CpuInfo::InitOnce(); |
| 69 hardware_ = CpuInfo::GetCpuModel(); |
| 70 #if defined(DEBUG) |
| 71 initialized_ = true; |
| 72 #endif |
| 73 } |
| 74 |
| 75 |
| 76 void HostCPUFeatures::Cleanup() { |
| 77 DEBUG_ASSERT(initialized_); |
| 78 #if defined(DEBUG) |
| 79 initialized_ = false; |
| 80 #endif |
| 81 ASSERT(hardware_ != NULL); |
| 82 free(const_cast<char*>(hardware_)); |
| 83 hardware_ = NULL; |
| 84 CpuInfo::Cleanup(); |
| 85 } |
| 86 #endif // defined(HOST_ARCH_ARM64) |
| 87 |
| 88 } // namespace dart |
| 89 |
| 90 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |