| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 int32_t lo_reg_; | 68 int32_t lo_reg_; |
| 69 | 69 |
| 70 int32_t registers_[kNumberOfCpuRegisters]; | 70 int32_t registers_[kNumberOfCpuRegisters]; |
| 71 uword pc_; | 71 uword pc_; |
| 72 | 72 |
| 73 // Simulator support. | 73 // Simulator support. |
| 74 char* stack_; | 74 char* stack_; |
| 75 int icount_; | 75 int icount_; |
| 76 bool delay_slot_; | 76 bool delay_slot_; |
| 77 | 77 |
| 78 // Illegal memory access support. |
| 79 static bool IsIllegalAddress(uword addr) { |
| 80 return addr < 64*1024; |
| 81 } |
| 82 |
| 78 bool OverflowFrom(int32_t alu_out, | 83 bool OverflowFrom(int32_t alu_out, |
| 79 int32_t left, | 84 int32_t left, |
| 80 int32_t right, | 85 int32_t right, |
| 81 bool addition); | 86 bool addition); |
| 82 | 87 |
| 83 void set_pc(uword value) { pc_ = value; } | 88 void set_pc(uword value) { pc_ = value; } |
| 84 | 89 |
| 85 void Format(Instr* instr, const char* format); | 90 void Format(Instr* instr, const char* format); |
| 86 | 91 |
| 92 inline int8_t ReadB(uword addr); |
| 93 inline uint8_t ReadBU(uword addr); |
| 94 inline int16_t ReadH(uword addr, Instr* instr); |
| 95 inline uint16_t ReadHU(uword addr, Instr *instr); |
| 96 inline int ReadW(uword addr, Instr* instr); |
| 97 |
| 98 inline void WriteB(uword addr, uint8_t value); |
| 99 inline void WriteH(uword addr, uint16_t value, Instr* isntr); |
| 100 inline void WriteW(uword addr, int value, Instr* instr); |
| 101 |
| 87 void DecodeSpecial(Instr* instr); | 102 void DecodeSpecial(Instr* instr); |
| 88 void DecodeSpecial2(Instr* instr); | 103 void DecodeSpecial2(Instr* instr); |
| 104 void DecodeSpecial3(Instr *instr); |
| 89 void InstructionDecode(Instr* instr); | 105 void InstructionDecode(Instr* instr); |
| 90 | 106 |
| 91 void Execute(); | 107 void Execute(); |
| 92 void ExecuteDelaySlot(); | 108 void ExecuteDelaySlot(); |
| 93 }; | 109 }; |
| 94 | 110 |
| 95 } // namespace dart | 111 } // namespace dart |
| 96 | 112 |
| 97 #endif // VM_SIMULATOR_MIPS_H_ | 113 #endif // VM_SIMULATOR_MIPS_H_ |
| OLD | NEW |