| 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 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| 11 // with the distribution. | 11 // with the distribution. |
| 12 // * Neither the name of Google Inc. nor the names of its | 12 // * Neither the name of Google Inc. nor the names of its |
| 13 // contributors may be used to endorse or promote products derived | 13 // contributors may be used to endorse or promote products derived |
| 14 // from this software without specific prior written permission. | 14 // from this software without specific prior written permission. |
| 15 // | 15 // |
| 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 // CPU specific code for arm independent of OS goes here. | 28 // CPU specific code for arm independent of OS goes here. |
| 29 #ifdef __arm__ | 29 #ifdef __arm__ |
| 30 #ifdef __QNXNTO__ |
| 31 #include <sys/mman.h> // for cache flushing. |
| 32 #undef MAP_TYPE |
| 33 #else |
| 30 #include <sys/syscall.h> // for cache flushing. | 34 #include <sys/syscall.h> // for cache flushing. |
| 31 #endif | 35 #endif |
| 36 #endif |
| 32 | 37 |
| 33 #include "v8.h" | 38 #include "v8.h" |
| 34 | 39 |
| 35 #if V8_TARGET_ARCH_ARM | 40 #if V8_TARGET_ARCH_ARM |
| 36 | 41 |
| 37 #include "cpu.h" | 42 #include "cpu.h" |
| 38 #include "macro-assembler.h" | 43 #include "macro-assembler.h" |
| 39 #include "simulator.h" // for cache flushing. | 44 #include "simulator.h" // for cache flushing. |
| 40 | 45 |
| 41 namespace v8 { | 46 namespace v8 { |
| 42 namespace internal { | 47 namespace internal { |
| 43 | 48 |
| 44 void CPU::SetUp() { | 49 void CPU::SetUp() { |
| 45 CpuFeatures::Probe(); | 50 CpuFeatures::Probe(); |
| 46 } | 51 } |
| 47 | 52 |
| 48 | 53 |
| 49 bool CPU::SupportsCrankshaft() { | 54 bool CPU::SupportsCrankshaft() { |
| 50 return CpuFeatures::IsSupported(VFP3); | 55 return CpuFeatures::IsSupported(VFP3); |
| 51 } | 56 } |
| 52 | 57 |
| 53 | 58 |
| 54 void CPU::FlushICache(void* start, size_t size) { | 59 void CPU::FlushICache(void* start, size_t size) { |
| 55 // Nothing to do flushing no instructions. | 60 // Nothing to do flushing no instructions. |
| 56 if (size == 0) { | 61 if (size == 0) { |
| 57 return; | 62 return; |
| 58 } | 63 } |
| 59 | 64 |
| 60 #if defined (USE_SIMULATOR) | 65 #if defined(USE_SIMULATOR) |
| 61 // Not generating ARM instructions for C-code. This means that we are | 66 // Not generating ARM instructions for C-code. This means that we are |
| 62 // building an ARM emulator based target. We should notify the simulator | 67 // building an ARM emulator based target. We should notify the simulator |
| 63 // that the Icache was flushed. | 68 // that the Icache was flushed. |
| 64 // None of this code ends up in the snapshot so there are no issues | 69 // None of this code ends up in the snapshot so there are no issues |
| 65 // around whether or not to generate the code when building snapshots. | 70 // around whether or not to generate the code when building snapshots. |
| 66 Simulator::FlushICache(Isolate::Current()->simulator_i_cache(), start, size); | 71 Simulator::FlushICache(Isolate::Current()->simulator_i_cache(), start, size); |
| 72 #elif V8_OS_QNX |
| 73 msync(start, size, MS_SYNC | MS_INVALIDATE_ICACHE); |
| 67 #else | 74 #else |
| 68 // Ideally, we would call | 75 // Ideally, we would call |
| 69 // syscall(__ARM_NR_cacheflush, start, | 76 // syscall(__ARM_NR_cacheflush, start, |
| 70 // reinterpret_cast<intptr_t>(start) + size, 0); | 77 // reinterpret_cast<intptr_t>(start) + size, 0); |
| 71 // however, syscall(int, ...) is not supported on all platforms, especially | 78 // however, syscall(int, ...) is not supported on all platforms, especially |
| 72 // not when using EABI, so we call the __ARM_NR_cacheflush syscall directly. | 79 // not when using EABI, so we call the __ARM_NR_cacheflush syscall directly. |
| 73 | 80 |
| 74 register uint32_t beg asm("a1") = reinterpret_cast<uint32_t>(start); | 81 register uint32_t beg asm("a1") = reinterpret_cast<uint32_t>(start); |
| 75 register uint32_t end asm("a2") = | 82 register uint32_t end asm("a2") = |
| 76 reinterpret_cast<uint32_t>(start) + size; | 83 reinterpret_cast<uint32_t>(start) + size; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 102 : "=r" (beg) | 109 : "=r" (beg) |
| 103 : "0" (beg), "r" (end), "r" (flg), "r" (__ARM_NR_cacheflush) | 110 : "0" (beg), "r" (end), "r" (flg), "r" (__ARM_NR_cacheflush) |
| 104 : "r3"); | 111 : "r3"); |
| 105 #endif | 112 #endif |
| 106 #endif | 113 #endif |
| 107 } | 114 } |
| 108 | 115 |
| 109 } } // namespace v8::internal | 116 } } // namespace v8::internal |
| 110 | 117 |
| 111 #endif // V8_TARGET_ARCH_ARM | 118 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |