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 #if defined(TARGET_ARCH_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
7 | 7 |
8 #include "vm/cpu.h" | 8 #include "vm/cpu.h" |
9 #include "vm/cpu_arm64.h" | 9 #include "vm/cpu_arm64.h" |
10 | 10 |
11 #include "vm/cpuinfo.h" | 11 #include "vm/cpuinfo.h" |
12 #include "vm/simulator.h" | 12 #include "vm/simulator.h" |
13 | 13 |
14 #if !defined(USING_SIMULATOR) | 14 #if !defined(USING_SIMULATOR) |
15 #include <sys/syscall.h> /* NOLINT */ | 15 #include <sys/syscall.h> /* NOLINT */ |
16 #include <unistd.h> /* NOLINT */ | 16 #include <unistd.h> /* NOLINT */ |
17 #endif | 17 #endif |
18 | 18 |
19 namespace dart { | 19 namespace dart { |
20 | 20 |
21 void CPU::FlushICache(uword start, uword size) { | 21 void CPU::FlushICache(uword start, uword size) { |
22 #if TARGET_OS_IOS | 22 #if HOST_OS_IOS |
23 // 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. |
24 UNREACHABLE(); | 24 UNREACHABLE(); |
25 #endif | 25 #endif |
26 | 26 |
27 #if !defined(USING_SIMULATOR) && !TARGET_OS_IOS | 27 #if !defined(USING_SIMULATOR) && !HOST_OS_IOS |
28 // Nothing to do. Flushing no instructions. | 28 // Nothing to do. Flushing no instructions. |
29 if (size == 0) { | 29 if (size == 0) { |
30 return; | 30 return; |
31 } | 31 } |
32 | 32 |
33 // 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. |
34 // blogs.arm.com/software-enablement/141-caches-and-self-modifying-code/ | 34 // blogs.arm.com/software-enablement/141-caches-and-self-modifying-code/ |
35 #if defined(TARGET_OS_ANDROID) || defined(TARGET_OS_FUCHSIA) || \ | 35 #if defined(HOST_OS_ANDROID) || defined(HOST_OS_FUCHSIA) || \ |
36 defined(TARGET_OS_LINUX) | 36 defined(HOST_OS_LINUX) |
37 extern void __clear_cache(char*, char*); | 37 extern void __clear_cache(char*, char*); |
38 char* beg = reinterpret_cast<char*>(start); | 38 char* beg = reinterpret_cast<char*>(start); |
39 char* end = reinterpret_cast<char*>(start + size); | 39 char* end = reinterpret_cast<char*>(start + size); |
40 ::__clear_cache(beg, end); | 40 ::__clear_cache(beg, end); |
41 #else | 41 #else |
42 #error FlushICache only tested/supported on Android, Fuchsia, and Linux | 42 #error FlushICache only tested/supported on Android, Fuchsia, and Linux |
43 #endif | 43 #endif |
44 | 44 |
45 #endif | 45 #endif |
46 } | 46 } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 ASSERT(hardware_ != NULL); | 101 ASSERT(hardware_ != NULL); |
102 free(const_cast<char*>(hardware_)); | 102 free(const_cast<char*>(hardware_)); |
103 hardware_ = NULL; | 103 hardware_ = NULL; |
104 CpuInfo::Cleanup(); | 104 CpuInfo::Cleanup(); |
105 } | 105 } |
106 #endif // !defined(USING_SIMULATOR) | 106 #endif // !defined(USING_SIMULATOR) |
107 | 107 |
108 } // namespace dart | 108 } // namespace dart |
109 | 109 |
110 #endif // defined TARGET_ARCH_ARM64 | 110 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |