OLD | NEW |
---|---|
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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" // Needed here to get TARGET_ARCH_ARM. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
7 | 7 |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/constants_arm.h" | 9 #include "vm/constants_arm.h" |
10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
337 0xe300c000 | ((target_lo >> 12) << 16) | (target_lo & 0xfff); | 337 0xe300c000 | ((target_lo >> 12) << 16) | (target_lo & 0xfff); |
338 const uword movt_ip = | 338 const uword movt_ip = |
339 0xe340c000 | ((target_hi >> 12) << 16) | (target_hi & 0xfff); | 339 0xe340c000 | ((target_hi >> 12) << 16) | (target_hi & 0xfff); |
340 | 340 |
341 *reinterpret_cast<uword*>(pc_ + (0 * Instr::kInstrSize)) = movw_ip; | 341 *reinterpret_cast<uword*>(pc_ + (0 * Instr::kInstrSize)) = movw_ip; |
342 *reinterpret_cast<uword*>(pc_ + (1 * Instr::kInstrSize)) = movt_ip; | 342 *reinterpret_cast<uword*>(pc_ + (1 * Instr::kInstrSize)) = movt_ip; |
343 CPU::FlushICache(pc_, 2 * Instr::kInstrSize); | 343 CPU::FlushICache(pc_, 2 * Instr::kInstrSize); |
344 } | 344 } |
345 } | 345 } |
346 | 346 |
347 | |
348 ReturnPattern::ReturnPattern(uword pc) | |
349 : pc_(pc) { | |
350 } | |
siva
2015/02/25 22:58:38
Why not inline this in the header file?
Cutch
2015/02/26 18:44:39
Acknowledged.
| |
351 | |
352 | |
353 bool ReturnPattern::IsValid() const { | |
354 Instr* bx_lr = Instr::At(pc_); | |
355 const int32_t B4 = 1 << 4; | |
356 const int32_t B21 = 1 << 21; | |
357 const int32_t B24 = 1 << 24; | |
358 int32_t instruction = (static_cast<int32_t>(AL) << kConditionShift) | | |
359 B24 | B21 | (0xfff << 8) | B4 | | |
360 (static_cast<int32_t>(LR) << kRmShift); | |
361 const ARMVersion version = TargetCPUFeatures::arm_version(); | |
362 if ((version == ARMv5TE) || (version == ARMv6)) { | |
363 return bx_lr->InstructionBits() == instruction; | |
364 } else { | |
365 ASSERT(version == ARMv7); | |
366 return bx_lr->InstructionBits() == instruction; | |
367 } | |
368 return false; | |
369 } | |
370 | |
347 } // namespace dart | 371 } // namespace dart |
348 | 372 |
349 #endif // defined TARGET_ARCH_ARM | 373 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |