| 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 <math.h> // for isnan. | 5 #include <math.h> // for isnan. |
| 6 #include <setjmp.h> | 6 #include <setjmp.h> |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 | 8 |
| 9 #include "vm/globals.h" | 9 #include "vm/globals.h" |
| 10 #if defined(TARGET_ARCH_ARM) | 10 #if defined(TARGET_ARCH_ARM) |
| (...skipping 1464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1475 ASSERT(instr->Bits(21, 2) == 0x1); | 1475 ASSERT(instr->Bits(21, 2) == 0x1); |
| 1476 // Format(instr, "blx'cond 'rm"); | 1476 // Format(instr, "blx'cond 'rm"); |
| 1477 Register rm = instr->RmField(); | 1477 Register rm = instr->RmField(); |
| 1478 int32_t rm_val = get_register(rm); | 1478 int32_t rm_val = get_register(rm); |
| 1479 intptr_t pc = get_pc(); | 1479 intptr_t pc = get_pc(); |
| 1480 set_register(LR, pc + Instr::kInstrSize); | 1480 set_register(LR, pc + Instr::kInstrSize); |
| 1481 set_pc(rm_val); | 1481 set_pc(rm_val); |
| 1482 break; | 1482 break; |
| 1483 } | 1483 } |
| 1484 case 7: { | 1484 case 7: { |
| 1485 if (instr->Bits(21, 2) == 0x1) { | 1485 if ((instr->Bits(21, 2) == 0x1) && (instr->ConditionField() == AL)) { |
| 1486 // Format(instr, "bkpt'cond #'imm12_4"); | 1486 // Format(instr, "bkpt #'imm12_4"); |
| 1487 SimulatorDebugger dbg(this); | 1487 SimulatorDebugger dbg(this); |
| 1488 set_pc(get_pc() + Instr::kInstrSize); | 1488 set_pc(get_pc() + Instr::kInstrSize); |
| 1489 char buffer[32]; | 1489 char buffer[32]; |
| 1490 snprintf(buffer, sizeof(buffer), "bkpt #0x%x", instr->BkptField()); | 1490 snprintf(buffer, sizeof(buffer), "bkpt #0x%x", instr->BkptField()); |
| 1491 dbg.Stop(instr, buffer); | 1491 dbg.Stop(instr, buffer); |
| 1492 } else { | 1492 } else { |
| 1493 // Format(instr, "smc'cond"); | 1493 // Format(instr, "smc'cond"); |
| 1494 UnimplementedInstruction(instr); | 1494 UnimplementedInstruction(instr); |
| 1495 } | 1495 } |
| 1496 break; | 1496 break; |
| (...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2060 } else { | 2060 } else { |
| 2061 WriteW(addr, get_register(rd), instr); | 2061 WriteW(addr, get_register(rd), instr); |
| 2062 } | 2062 } |
| 2063 } | 2063 } |
| 2064 } | 2064 } |
| 2065 } | 2065 } |
| 2066 | 2066 |
| 2067 | 2067 |
| 2068 void Simulator::DoDivision(Instr* instr) { | 2068 void Simulator::DoDivision(Instr* instr) { |
| 2069 ASSERT(CPUFeatures::integer_division_supported()); | 2069 ASSERT(CPUFeatures::integer_division_supported()); |
| 2070 Register rd = instr->RdField(); | 2070 Register rd = instr->DivRdField(); |
| 2071 Register rn = instr->RnField(); | 2071 Register rn = instr->DivRnField(); |
| 2072 Register rm = instr->RmField(); | 2072 Register rm = instr->DivRmField(); |
| 2073 | 2073 |
| 2074 // TODO(zra): Does the hardware trap on divide-by-zero? | 2074 // ARMv7-a does not trap on divide-by-zero. The destination register is just |
| 2075 // Revisit when we test on ARM hardware. | 2075 // set to 0. |
| 2076 if (get_register(rm) == 0) { | 2076 if (get_register(rm) == 0) { |
| 2077 set_register(rd, 0); | 2077 set_register(rd, 0); |
| 2078 return; | 2078 return; |
| 2079 } | 2079 } |
| 2080 | 2080 |
| 2081 if (instr->Bit(21) == 1) { | 2081 if (instr->Bit(21) == 1) { |
| 2082 // unsigned division. | 2082 // unsigned division. |
| 2083 uint32_t rn_val = static_cast<uint32_t>(get_register(rn)); | 2083 uint32_t rn_val = static_cast<uint32_t>(get_register(rn)); |
| 2084 uint32_t rm_val = static_cast<uint32_t>(get_register(rm)); | 2084 uint32_t rm_val = static_cast<uint32_t>(get_register(rm)); |
| 2085 uint32_t result = rn_val / rm_val; | 2085 uint32_t result = rn_val / rm_val; |
| (...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2922 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); | 2922 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); |
| 2923 } | 2923 } |
| 2924 buf->Longjmp(); | 2924 buf->Longjmp(); |
| 2925 } | 2925 } |
| 2926 | 2926 |
| 2927 } // namespace dart | 2927 } // namespace dart |
| 2928 | 2928 |
| 2929 #endif // !defined(HOST_ARCH_ARM) | 2929 #endif // !defined(HOST_ARCH_ARM) |
| 2930 | 2930 |
| 2931 #endif // defined TARGET_ARCH_ARM | 2931 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |