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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 int32_t hi_reg_; | 139 int32_t hi_reg_; |
140 int32_t lo_reg_; | 140 int32_t lo_reg_; |
141 | 141 |
142 int32_t registers_[kNumberOfCpuRegisters]; | 142 int32_t registers_[kNumberOfCpuRegisters]; |
143 int32_t fregisters_[kNumberOfFRegisters]; | 143 int32_t fregisters_[kNumberOfFRegisters]; |
144 int32_t fcsr_; | 144 int32_t fcsr_; |
145 uword pc_; | 145 uword pc_; |
146 | 146 |
147 // Simulator support. | 147 // Simulator support. |
148 char* stack_; | 148 char* stack_; |
149 int icount_; | 149 intptr_t icount_; |
150 bool delay_slot_; | 150 bool delay_slot_; |
151 SimulatorSetjmpBuffer* last_setjmp_buffer_; | 151 SimulatorSetjmpBuffer* last_setjmp_buffer_; |
152 uword top_exit_frame_info_; | 152 uword top_exit_frame_info_; |
153 | 153 |
154 // Registered breakpoints. | 154 // Registered breakpoints. |
155 Instr* break_pc_; | 155 Instr* break_pc_; |
156 int32_t break_instr_; | 156 int32_t break_instr_; |
157 | 157 |
158 // Illegal memory access support. | 158 // Illegal memory access support. |
159 static bool IsIllegalAddress(uword addr) { | 159 static bool IsIllegalAddress(uword addr) { |
(...skipping 13 matching lines...) Expand all Loading... |
173 bool addition); | 173 bool addition); |
174 | 174 |
175 void set_pc(uword value) { pc_ = value; } | 175 void set_pc(uword value) { pc_ = value; } |
176 | 176 |
177 void Format(Instr* instr, const char* format); | 177 void Format(Instr* instr, const char* format); |
178 | 178 |
179 inline int8_t ReadB(uword addr); | 179 inline int8_t ReadB(uword addr); |
180 inline uint8_t ReadBU(uword addr); | 180 inline uint8_t ReadBU(uword addr); |
181 inline int16_t ReadH(uword addr, Instr* instr); | 181 inline int16_t ReadH(uword addr, Instr* instr); |
182 inline uint16_t ReadHU(uword addr, Instr *instr); | 182 inline uint16_t ReadHU(uword addr, Instr *instr); |
183 inline int ReadW(uword addr, Instr* instr); | 183 inline intptr_t ReadW(uword addr, Instr* instr); |
184 | 184 |
185 inline void WriteB(uword addr, uint8_t value); | 185 inline void WriteB(uword addr, uint8_t value); |
186 inline void WriteH(uword addr, uint16_t value, Instr* isntr); | 186 inline void WriteH(uword addr, uint16_t value, Instr* isntr); |
187 inline void WriteW(uword addr, int value, Instr* instr); | 187 inline void WriteW(uword addr, intptr_t value, Instr* instr); |
188 | 188 |
189 inline double ReadD(uword addr, Instr* instr); | 189 inline double ReadD(uword addr, Instr* instr); |
190 inline void WriteD(uword addr, double value, Instr* instr); | 190 inline void WriteD(uword addr, double value, Instr* instr); |
191 | 191 |
192 void DoBranch(Instr* instr, bool taken, bool likely); | 192 void DoBranch(Instr* instr, bool taken, bool likely); |
193 void DoBreak(Instr *instr); | 193 void DoBreak(Instr *instr); |
194 | 194 |
195 void DecodeSpecial(Instr* instr); | 195 void DecodeSpecial(Instr* instr); |
196 void DecodeSpecial2(Instr* instr); | 196 void DecodeSpecial2(Instr* instr); |
197 void DecodeRegImm(Instr* instr); | 197 void DecodeRegImm(Instr* instr); |
(...skipping 12 matching lines...) Expand all Loading... |
210 } | 210 } |
211 | 211 |
212 friend class SimulatorDebugger; | 212 friend class SimulatorDebugger; |
213 friend class SimulatorSetjmpBuffer; | 213 friend class SimulatorSetjmpBuffer; |
214 DISALLOW_COPY_AND_ASSIGN(Simulator); | 214 DISALLOW_COPY_AND_ASSIGN(Simulator); |
215 }; | 215 }; |
216 | 216 |
217 } // namespace dart | 217 } // namespace dart |
218 | 218 |
219 #endif // VM_SIMULATOR_MIPS_H_ | 219 #endif // VM_SIMULATOR_MIPS_H_ |
OLD | NEW |