OLD | NEW |
---|---|
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // CPU specific code for arm independent of OS goes here. | 5 // CPU specific code for arm independent of OS goes here. |
6 #ifdef __arm__ | 6 #ifdef __arm__ |
7 #ifdef __QNXNTO__ | 7 #ifdef __QNXNTO__ |
8 #include <sys/mman.h> // for cache flushing. | 8 #include <sys/mman.h> // for cache flushing. |
9 #undef MAP_TYPE | 9 #undef MAP_TYPE |
10 #else | 10 #else |
(...skipping 27 matching lines...) Expand all Loading... | |
38 Simulator::FlushICache(Isolate::Current()->simulator_i_cache(), start, size); | 38 Simulator::FlushICache(Isolate::Current()->simulator_i_cache(), start, size); |
39 | 39 |
40 #elif V8_OS_QNX | 40 #elif V8_OS_QNX |
41 msync(start, size, MS_SYNC | MS_INVALIDATE_ICACHE); | 41 msync(start, size, MS_SYNC | MS_INVALIDATE_ICACHE); |
42 | 42 |
43 #else | 43 #else |
44 register uint32_t beg asm("r0") = reinterpret_cast<uint32_t>(start); | 44 register uint32_t beg asm("r0") = reinterpret_cast<uint32_t>(start); |
45 register uint32_t end asm("r1") = beg + size; | 45 register uint32_t end asm("r1") = beg + size; |
46 register uint32_t flg asm("r2") = 0; | 46 register uint32_t flg asm("r2") = 0; |
47 | 47 |
48 #ifdef __clang__ | |
49 // This variant of the asm avoids a constant pool entry, which can be | |
50 // problematic when LTO'ing. It is also slightly shorter. | |
51 register uint32_t scno asm("r7") = __ARM_NR_cacheflush; | |
bnoordhuis
2015/03/07 18:34:49
I don't think it's safe to assume that the compile
pcc1
2015/03/07 21:26:39
Please see https://gcc.gnu.org/onlinedocs/gcc/Loca
| |
52 | |
53 asm volatile("svc 0\n" | |
54 : | |
55 : "r"(beg), "r"(end), "r"(flg), "r"(scno) | |
56 : "memory"); | |
57 #else | |
58 // Use a different variant of the asm with GCC because some versions doesn't | |
59 // support r7 as an asm input. | |
48 asm volatile( | 60 asm volatile( |
49 // This assembly works for both ARM and Thumb targets. | 61 // This assembly works for both ARM and Thumb targets. |
50 | 62 |
51 // Preserve r7; it is callee-saved, and GCC uses it as a frame pointer for | 63 // Preserve r7; it is callee-saved, and GCC uses it as a frame pointer for |
52 // Thumb targets. | 64 // Thumb targets. |
53 " push {r7}\n" | 65 " push {r7}\n" |
54 // r0 = beg | 66 // r0 = beg |
55 // r1 = end | 67 // r1 = end |
56 // r2 = flags (0) | 68 // r2 = flags (0) |
57 " ldr r7, =%c[scno]\n" // r7 = syscall number | 69 " ldr r7, =%c[scno]\n" // r7 = syscall number |
58 " svc 0\n" | 70 " svc 0\n" |
59 | 71 |
60 " pop {r7}\n" | 72 " pop {r7}\n" |
61 : | 73 : |
62 : "r" (beg), "r" (end), "r" (flg), [scno] "i" (__ARM_NR_cacheflush) | 74 : "r" (beg), "r" (end), "r" (flg), [scno] "i" (__ARM_NR_cacheflush) |
63 : "memory"); | 75 : "memory"); |
64 #endif | 76 #endif |
77 #endif | |
65 } | 78 } |
66 | 79 |
67 } } // namespace v8::internal | 80 } } // namespace v8::internal |
68 | 81 |
69 #endif // V8_TARGET_ARCH_ARM | 82 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |