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