| 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 // Declares a Simulator for MIPS instructions if we are not generating a native | 5 // Declares a Simulator for MIPS instructions if we are not generating a native |
| 6 // MIPS binary. This Simulator allows us to run and debug MIPS code generation | 6 // MIPS binary. This Simulator allows us to run and debug MIPS code generation |
| 7 // on regular desktop machines. | 7 // on regular desktop machines. |
| 8 // Dart calls into generated code by "calling" the InvokeDartCode stub, | 8 // Dart calls into generated code by "calling" the InvokeDartCode stub, |
| 9 // which will start execution in the Simulator or forwards to the real entry | 9 // which will start execution in the Simulator or forwards to the real entry |
| 10 // on a MIPS HW platform. | 10 // on a MIPS HW platform. |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 89 |
| 90 // Illegal memory access support. | 90 // Illegal memory access support. |
| 91 static bool IsIllegalAddress(uword addr) { | 91 static bool IsIllegalAddress(uword addr) { |
| 92 return addr < 64*1024; | 92 return addr < 64*1024; |
| 93 } | 93 } |
| 94 void HandleIllegalAccess(uword addr, Instr* instr); | 94 void HandleIllegalAccess(uword addr, Instr* instr); |
| 95 | 95 |
| 96 // Read and write memory. | 96 // Read and write memory. |
| 97 void UnalignedAccess(const char* msg, uword addr, Instr* instr); | 97 void UnalignedAccess(const char* msg, uword addr, Instr* instr); |
| 98 | 98 |
| 99 // Handles a legal instruction that the simulator does not implement. |
| 100 void UnimplementedInstruction(Instr* instr); |
| 101 |
| 102 // If something goes wrong (Unimplemented instruction, illegal access, etc.), |
| 103 // this flag is used to decide whether to die or to drop into the simulator |
| 104 // debugger. Its initial value is false. Then, when we enter the simulator |
| 105 // debugger (for a user set breakpoint, etc.) it is set to true. |
| 106 bool debugger_attached_; |
| 107 |
| 108 // Accessors to set and check whether the simulator debugger is attached. |
| 109 bool debugger_attached() const { return debugger_attached_; } |
| 110 void set_debugger_attached(bool b) { debugger_attached_ = b; } |
| 111 |
| 99 bool OverflowFrom(int32_t alu_out, | 112 bool OverflowFrom(int32_t alu_out, |
| 100 int32_t left, | 113 int32_t left, |
| 101 int32_t right, | 114 int32_t right, |
| 102 bool addition); | 115 bool addition); |
| 103 | 116 |
| 104 void set_pc(uword value) { pc_ = value; } | 117 void set_pc(uword value) { pc_ = value; } |
| 105 | 118 |
| 106 void Format(Instr* instr, const char* format); | 119 void Format(Instr* instr, const char* format); |
| 107 | 120 |
| 108 inline int8_t ReadB(uword addr); | 121 inline int8_t ReadB(uword addr); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 121 | 134 |
| 122 void Execute(); | 135 void Execute(); |
| 123 void ExecuteDelaySlot(); | 136 void ExecuteDelaySlot(); |
| 124 | 137 |
| 125 friend class SimulatorDebugger; | 138 friend class SimulatorDebugger; |
| 126 }; | 139 }; |
| 127 | 140 |
| 128 } // namespace dart | 141 } // namespace dart |
| 129 | 142 |
| 130 #endif // VM_SIMULATOR_MIPS_H_ | 143 #endif // VM_SIMULATOR_MIPS_H_ |
| OLD | NEW |