Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(589)

Side by Side Diff: runtime/vm/simulator_arm64.cc

Issue 1097413004: Use a breakpoint instruction for a stop message on arm instead of (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/simulator_arm.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 819 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 Redirection* current; 830 Redirection* current;
831 for (current = list_; current != NULL; current = current->next_) { 831 for (current = list_; current != NULL; current = current->next_) {
832 if (current->address_of_hlt_instruction() == address_of_hlt) { 832 if (current->address_of_hlt_instruction() == address_of_hlt) {
833 return current->external_function_; 833 return current->external_function_;
834 } 834 }
835 } 835 }
836 return 0; 836 return 0;
837 } 837 }
838 838
839 private: 839 private:
840 static const int32_t kRedirectInstruction = Instr::kRedirectInstruction;
841 Redirection(uword external_function, 840 Redirection(uword external_function,
842 Simulator::CallKind call_kind, 841 Simulator::CallKind call_kind,
843 int argument_count) 842 int argument_count)
844 : external_function_(external_function), 843 : external_function_(external_function),
845 call_kind_(call_kind), 844 call_kind_(call_kind),
846 argument_count_(argument_count), 845 argument_count_(argument_count),
847 hlt_instruction_(kRedirectInstruction), 846 hlt_instruction_(Instr::kSimulatorRedirectInstruction),
848 next_(list_) { 847 next_(list_) {
849 // Atomically prepend this element to the front of the global list. 848 // Atomically prepend this element to the front of the global list.
850 // Note: Since elements are never removed, there is no ABA issue. 849 // Note: Since elements are never removed, there is no ABA issue.
851 Redirection* list_head = list_; 850 Redirection* list_head = list_;
852 do { 851 do {
853 next_ = list_head; 852 next_ = list_head;
854 list_head = reinterpret_cast<Redirection*>( 853 list_head = reinterpret_cast<Redirection*>(
855 AtomicOperations::CompareAndSwapWord( 854 AtomicOperations::CompareAndSwapWord(
856 reinterpret_cast<uword*>(&list_), 855 reinterpret_cast<uword*>(&list_),
857 reinterpret_cast<uword>(next_), 856 reinterpret_cast<uword>(next_),
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after
1682 1681
1683 void Simulator::DecodeExceptionGen(Instr* instr) { 1682 void Simulator::DecodeExceptionGen(Instr* instr) {
1684 if ((instr->Bits(0, 2) == 1) && (instr->Bits(2, 3) == 0) && 1683 if ((instr->Bits(0, 2) == 1) && (instr->Bits(2, 3) == 0) &&
1685 (instr->Bits(21, 3) == 0)) { 1684 (instr->Bits(21, 3) == 0)) {
1686 // Format(instr, "svc 'imm16"); 1685 // Format(instr, "svc 'imm16");
1687 UnimplementedInstruction(instr); 1686 UnimplementedInstruction(instr);
1688 } else if ((instr->Bits(0, 2) == 0) && (instr->Bits(2, 3) == 0) && 1687 } else if ((instr->Bits(0, 2) == 0) && (instr->Bits(2, 3) == 0) &&
1689 (instr->Bits(21, 3) == 1)) { 1688 (instr->Bits(21, 3) == 1)) {
1690 // Format(instr, "brk 'imm16"); 1689 // Format(instr, "brk 'imm16");
1691 SimulatorDebugger dbg(this); 1690 SimulatorDebugger dbg(this);
1692 uint16_t imm = static_cast<uint16_t>(instr->Imm16Field()); 1691 int32_t imm = instr->Imm16Field();
1693 char buffer[32]; 1692 if (imm == Instr::kStopMessageCode) {
1694 snprintf(buffer, sizeof(buffer), "brk #0x%x", imm); 1693 const char* message = *reinterpret_cast<const char**>(
1695 set_pc(get_pc() + Instr::kInstrSize); 1694 reinterpret_cast<intptr_t>(instr) - 2 * Instr::kInstrSize);
1696 dbg.Stop(instr, buffer); 1695 set_pc(get_pc() + Instr::kInstrSize);
1696 dbg.Stop(instr, message);
1697 } else {
1698 char buffer[32];
1699 snprintf(buffer, sizeof(buffer), "brk #0x%x", imm);
1700 set_pc(get_pc() + Instr::kInstrSize);
1701 dbg.Stop(instr, buffer);
1702 }
1697 } else if ((instr->Bits(0, 2) == 0) && (instr->Bits(2, 3) == 0) && 1703 } else if ((instr->Bits(0, 2) == 0) && (instr->Bits(2, 3) == 0) &&
1698 (instr->Bits(21, 3) == 2)) { 1704 (instr->Bits(21, 3) == 2)) {
1699 // Format(instr, "hlt 'imm16"); 1705 // Format(instr, "hlt 'imm16");
1700 uint16_t imm = static_cast<uint16_t>(instr->Imm16Field()); 1706 uint16_t imm = static_cast<uint16_t>(instr->Imm16Field());
1701 if (imm == Instr::kStopMessageCode) { 1707 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); 1708 SimulatorDebugger dbg(this);
1709 dbg.Stop(instr, "breakpoint"); 1709 dbg.Stop(instr, "breakpoint");
1710 } else if (imm == Instr::kSimulatorRedirectCode) { 1710 } else if (imm == Instr::kSimulatorRedirectCode) {
1711 DoRedirectedCall(instr); 1711 DoRedirectedCall(instr);
1712 } else { 1712 } else {
1713 UnimplementedInstruction(instr); 1713 UnimplementedInstruction(instr);
1714 } 1714 }
1715 } else { 1715 } else {
1716 UnimplementedInstruction(instr); 1716 UnimplementedInstruction(instr);
1717 } 1717 }
(...skipping 1776 matching lines...) Expand 10 before | Expand all | Expand 10 after
3494 set_register(NULL, kExceptionObjectReg, bit_cast<int64_t>(raw_exception)); 3494 set_register(NULL, kExceptionObjectReg, bit_cast<int64_t>(raw_exception));
3495 set_register(NULL, kStackTraceObjectReg, bit_cast<int64_t>(raw_stacktrace)); 3495 set_register(NULL, kStackTraceObjectReg, bit_cast<int64_t>(raw_stacktrace));
3496 buf->Longjmp(); 3496 buf->Longjmp();
3497 } 3497 }
3498 3498
3499 } // namespace dart 3499 } // namespace dart
3500 3500
3501 #endif // !defined(HOST_ARCH_ARM64) 3501 #endif // !defined(HOST_ARCH_ARM64)
3502 3502
3503 #endif // defined TARGET_ARCH_ARM64 3503 #endif // defined TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « runtime/vm/simulator_arm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698