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 <setjmp.h> // NOLINT | 5 #include <setjmp.h> // NOLINT |
6 #include <stdlib.h> | 6 #include <stdlib.h> |
7 | 7 |
8 #include "vm/globals.h" | 8 #include "vm/globals.h" |
9 #if defined(TARGET_ARCH_ARM64) | 9 #if defined(TARGET_ARCH_ARM64) |
10 | 10 |
(...skipping 1671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1682 | 1682 |
1683 void Simulator::DecodeExceptionGen(Instr* instr) { | 1683 void Simulator::DecodeExceptionGen(Instr* instr) { |
1684 if ((instr->Bits(0, 2) == 1) && (instr->Bits(2, 3) == 0) && | 1684 if ((instr->Bits(0, 2) == 1) && (instr->Bits(2, 3) == 0) && |
1685 (instr->Bits(21, 3) == 0)) { | 1685 (instr->Bits(21, 3) == 0)) { |
1686 // Format(instr, "svc 'imm16"); | 1686 // Format(instr, "svc 'imm16"); |
1687 UnimplementedInstruction(instr); | 1687 UnimplementedInstruction(instr); |
1688 } else if ((instr->Bits(0, 2) == 0) && (instr->Bits(2, 3) == 0) && | 1688 } else if ((instr->Bits(0, 2) == 0) && (instr->Bits(2, 3) == 0) && |
1689 (instr->Bits(21, 3) == 1)) { | 1689 (instr->Bits(21, 3) == 1)) { |
1690 // Format(instr, "brk 'imm16"); | 1690 // Format(instr, "brk 'imm16"); |
1691 SimulatorDebugger dbg(this); | 1691 SimulatorDebugger dbg(this); |
1692 uint16_t imm = static_cast<uint16_t>(instr->Imm16Field()); | 1692 int32_t imm = instr->Imm16Field(); |
1693 char buffer[32]; | 1693 if (imm == Instr::kStopMessageCode) { |
1694 snprintf(buffer, sizeof(buffer), "brk #0x%x", imm); | 1694 const char* message = *reinterpret_cast<const char**>( |
1695 set_pc(get_pc() + Instr::kInstrSize); | 1695 reinterpret_cast<intptr_t>(instr) - 2 * Instr::kInstrSize); |
1696 dbg.Stop(instr, buffer); | 1696 set_pc(get_pc() + Instr::kInstrSize); |
| 1697 dbg.Stop(instr, message); |
| 1698 } else { |
| 1699 char buffer[32]; |
| 1700 snprintf(buffer, sizeof(buffer), "brk #0x%x", imm); |
| 1701 set_pc(get_pc() + Instr::kInstrSize); |
| 1702 dbg.Stop(instr, buffer); |
| 1703 } |
1697 } else if ((instr->Bits(0, 2) == 0) && (instr->Bits(2, 3) == 0) && | 1704 } else if ((instr->Bits(0, 2) == 0) && (instr->Bits(2, 3) == 0) && |
1698 (instr->Bits(21, 3) == 2)) { | 1705 (instr->Bits(21, 3) == 2)) { |
1699 // Format(instr, "hlt 'imm16"); | 1706 // Format(instr, "hlt 'imm16"); |
1700 uint16_t imm = static_cast<uint16_t>(instr->Imm16Field()); | 1707 uint16_t imm = static_cast<uint16_t>(instr->Imm16Field()); |
1701 if (imm == Instr::kStopMessageCode) { | 1708 if (imm == Instr::kSimulatorBreakCode) { |
1702 SimulatorDebugger dbg(this); | |
1703 const char* message = *reinterpret_cast<const char**>( | |
1704 reinterpret_cast<intptr_t>(instr) - 2 * Instr::kInstrSize); | |
1705 set_pc(get_pc() + Instr::kInstrSize); | |
1706 dbg.Stop(instr, message); | |
1707 } else if (imm == Instr::kSimulatorBreakCode) { | |
1708 SimulatorDebugger dbg(this); | 1709 SimulatorDebugger dbg(this); |
1709 dbg.Stop(instr, "breakpoint"); | 1710 dbg.Stop(instr, "breakpoint"); |
1710 } else if (imm == Instr::kSimulatorRedirectCode) { | 1711 } else if (imm == Instr::kSimulatorRedirectCode) { |
1711 DoRedirectedCall(instr); | 1712 DoRedirectedCall(instr); |
1712 } else { | 1713 } else { |
1713 UnimplementedInstruction(instr); | 1714 UnimplementedInstruction(instr); |
1714 } | 1715 } |
1715 } else { | 1716 } else { |
1716 UnimplementedInstruction(instr); | 1717 UnimplementedInstruction(instr); |
1717 } | 1718 } |
(...skipping 1776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3494 set_register(NULL, kExceptionObjectReg, bit_cast<int64_t>(raw_exception)); | 3495 set_register(NULL, kExceptionObjectReg, bit_cast<int64_t>(raw_exception)); |
3495 set_register(NULL, kStackTraceObjectReg, bit_cast<int64_t>(raw_stacktrace)); | 3496 set_register(NULL, kStackTraceObjectReg, bit_cast<int64_t>(raw_stacktrace)); |
3496 buf->Longjmp(); | 3497 buf->Longjmp(); |
3497 } | 3498 } |
3498 | 3499 |
3499 } // namespace dart | 3500 } // namespace dart |
3500 | 3501 |
3501 #endif // !defined(HOST_ARCH_ARM64) | 3502 #endif // !defined(HOST_ARCH_ARM64) |
3502 | 3503 |
3503 #endif // defined TARGET_ARCH_ARM64 | 3504 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |