| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 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 | 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 | |
| 7 #if defined(TARGET_ARCH_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
| 8 | 7 |
| 9 #include "vm/cpu.h" | 8 #include "vm/cpu.h" |
| 9 #include "vm/cpu_arm64.h" |
| 10 |
| 10 #include "vm/cpuinfo.h" | 11 #include "vm/cpuinfo.h" |
| 11 #include "vm/simulator.h" | 12 #include "vm/simulator.h" |
| 12 | 13 |
| 13 #if !defined(USING_SIMULATOR) | 14 #if !defined(USING_SIMULATOR) |
| 14 #include <sys/syscall.h> /* NOLINT */ | 15 #include <sys/syscall.h> /* NOLINT */ |
| 15 #include <unistd.h> /* NOLINT */ | 16 #include <unistd.h> /* NOLINT */ |
| 16 #endif | 17 #endif |
| 17 | 18 |
| 18 namespace dart { | 19 namespace dart { |
| 19 | 20 |
| 20 void CPU::FlushICache(uword start, uword size) { | 21 void CPU::FlushICache(uword start, uword size) { |
| 21 #if TARGET_OS_IOS | 22 #if TARGET_OS_IOS |
| 22 // Precompilation never patches code so there should be no I cache flushes. | 23 // Precompilation never patches code so there should be no I cache flushes. |
| 23 UNREACHABLE(); | 24 UNREACHABLE(); |
| 24 #endif | 25 #endif |
| 25 | 26 |
| 26 #if !defined(USING_SIMULATOR) && !TARGET_OS_IOS | 27 #if !defined(USING_SIMULATOR) && !TARGET_OS_IOS |
| 27 // Nothing to do. Flushing no instructions. | 28 // Nothing to do. Flushing no instructions. |
| 28 if (size == 0) { | 29 if (size == 0) { |
| 29 return; | 30 return; |
| 30 } | 31 } |
| 31 | 32 |
| 32 // ARM recommends using the gcc intrinsic __clear_cache on Linux and Android. | 33 // ARM recommends using the gcc intrinsic __clear_cache on Linux and Android. |
| 33 // blogs.arm.com/software-enablement/141-caches-and-self-modifying-code/ | 34 // blogs.arm.com/software-enablement/141-caches-and-self-modifying-code/ |
| 34 #if defined(__linux__) || defined(ANDROID) | 35 #if defined(TARGET_OS_ANDROID) || \ |
| 36 defined(TARGET_OS_FUCHSIA) || \ |
| 37 defined(TARGET_OS_LINUX) |
| 35 extern void __clear_cache(char*, char*); | 38 extern void __clear_cache(char*, char*); |
| 36 char* beg = reinterpret_cast<char*>(start); | 39 char* beg = reinterpret_cast<char*>(start); |
| 37 char* end = reinterpret_cast<char*>(start + size); | 40 char* end = reinterpret_cast<char*>(start + size); |
| 38 ::__clear_cache(beg, end); | 41 ::__clear_cache(beg, end); |
| 39 #else | 42 #else |
| 40 #error FlushICache only tested/supported on Linux and Android | 43 #error FlushICache only tested/supported on Android, Fuchsia, and Linux |
| 41 #endif | 44 #endif |
| 42 | 45 |
| 43 #endif | 46 #endif |
| 44 } | 47 } |
| 45 | 48 |
| 46 | 49 |
| 47 const char* CPU::Id() { | 50 const char* CPU::Id() { |
| 48 return | 51 return |
| 49 #if defined(USING_SIMULATOR) | 52 #if defined(USING_SIMULATOR) |
| 50 "sim" | 53 "sim" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 ASSERT(hardware_ != NULL); | 102 ASSERT(hardware_ != NULL); |
| 100 free(const_cast<char*>(hardware_)); | 103 free(const_cast<char*>(hardware_)); |
| 101 hardware_ = NULL; | 104 hardware_ = NULL; |
| 102 CpuInfo::Cleanup(); | 105 CpuInfo::Cleanup(); |
| 103 } | 106 } |
| 104 #endif // !defined(USING_SIMULATOR) | 107 #endif // !defined(USING_SIMULATOR) |
| 105 | 108 |
| 106 } // namespace dart | 109 } // namespace dart |
| 107 | 110 |
| 108 #endif // defined TARGET_ARCH_ARM64 | 111 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |