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 ARM instructions if we are not generating a native | 5 // Declares a Simulator for ARM instructions if we are not generating a native |
6 // ARM binary. This Simulator allows us to run and debug ARM code generation on | 6 // ARM binary. This Simulator allows us to run and debug ARM code generation on |
7 // regular desktop machines. | 7 // 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 ARM HW platform. | 10 // on a ARM HW platform. |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 simd_value_t qregisters_[kNumberOfQRegisters]; | 142 simd_value_t qregisters_[kNumberOfQRegisters]; |
143 }; | 143 }; |
144 bool fp_n_flag_; | 144 bool fp_n_flag_; |
145 bool fp_z_flag_; | 145 bool fp_z_flag_; |
146 bool fp_c_flag_; | 146 bool fp_c_flag_; |
147 bool fp_v_flag_; | 147 bool fp_v_flag_; |
148 | 148 |
149 // Simulator support. | 149 // Simulator support. |
150 char* stack_; | 150 char* stack_; |
151 bool pc_modified_; | 151 bool pc_modified_; |
152 int icount_; | 152 intptr_t icount_; |
153 static int32_t flag_stop_sim_at_; | 153 static int32_t flag_stop_sim_at_; |
154 SimulatorSetjmpBuffer* last_setjmp_buffer_; | 154 SimulatorSetjmpBuffer* last_setjmp_buffer_; |
155 uword top_exit_frame_info_; | 155 uword top_exit_frame_info_; |
156 | 156 |
157 // Registered breakpoints. | 157 // Registered breakpoints. |
158 Instr* break_pc_; | 158 Instr* break_pc_; |
159 int32_t break_instr_; | 159 int32_t break_instr_; |
160 | 160 |
161 // Illegal memory access support. | 161 // Illegal memory access support. |
162 static bool IsIllegalAddress(uword addr) { | 162 static bool IsIllegalAddress(uword addr) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 void DoDivision(Instr* instr); | 198 void DoDivision(Instr* instr); |
199 | 199 |
200 inline uint8_t ReadBU(uword addr); | 200 inline uint8_t ReadBU(uword addr); |
201 inline int8_t ReadB(uword addr); | 201 inline int8_t ReadB(uword addr); |
202 inline void WriteB(uword addr, uint8_t value); | 202 inline void WriteB(uword addr, uint8_t value); |
203 | 203 |
204 inline uint16_t ReadHU(uword addr, Instr* instr); | 204 inline uint16_t ReadHU(uword addr, Instr* instr); |
205 inline int16_t ReadH(uword addr, Instr* instr); | 205 inline int16_t ReadH(uword addr, Instr* instr); |
206 inline void WriteH(uword addr, uint16_t value, Instr* instr); | 206 inline void WriteH(uword addr, uint16_t value, Instr* instr); |
207 | 207 |
208 inline int ReadW(uword addr, Instr* instr); | 208 inline intptr_t ReadW(uword addr, Instr* instr); |
209 inline void WriteW(uword addr, int value, Instr* instr); | 209 inline void WriteW(uword addr, intptr_t value, Instr* instr); |
210 | 210 |
211 // Synchronization primitives support. | 211 // Synchronization primitives support. |
212 void ClearExclusive(); | 212 void ClearExclusive(); |
213 int ReadExclusiveW(uword addr, Instr* instr); | 213 intptr_t ReadExclusiveW(uword addr, Instr* instr); |
214 int WriteExclusiveW(uword addr, int value, Instr* instr); | 214 intptr_t WriteExclusiveW(uword addr, intptr_t value, Instr* instr); |
215 | 215 |
216 // TODO(regis): Remove exclusive access support machinery if not needed. | 216 // TODO(regis): Remove exclusive access support machinery if not needed. |
217 // In Dart, there is at most one thread per isolate. | 217 // In Dart, there is at most one thread per isolate. |
218 // We keep track of 16 exclusive access address tags across all isolates. | 218 // We keep track of 16 exclusive access address tags across all isolates. |
219 // Since we cannot simulate a native context switch, which clears | 219 // Since we cannot simulate a native context switch, which clears |
220 // the exclusive access state of the local monitor (using the CLREX | 220 // the exclusive access state of the local monitor (using the CLREX |
221 // instruction), we associate the isolate requesting exclusive access to the | 221 // instruction), we associate the isolate requesting exclusive access to the |
222 // address tag. Multiple isolates requesting exclusive access (using the LDREX | 222 // address tag. Multiple isolates requesting exclusive access (using the LDREX |
223 // instruction) to the same address will result in multiple address tags being | 223 // instruction) to the same address will result in multiple address tags being |
224 // created for the same address, one per isolate. | 224 // created for the same address, one per isolate. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 } | 266 } |
267 | 267 |
268 friend class SimulatorDebugger; | 268 friend class SimulatorDebugger; |
269 friend class SimulatorSetjmpBuffer; | 269 friend class SimulatorSetjmpBuffer; |
270 DISALLOW_COPY_AND_ASSIGN(Simulator); | 270 DISALLOW_COPY_AND_ASSIGN(Simulator); |
271 }; | 271 }; |
272 | 272 |
273 } // namespace dart | 273 } // namespace dart |
274 | 274 |
275 #endif // VM_SIMULATOR_ARM_H_ | 275 #endif // VM_SIMULATOR_ARM_H_ |
OLD | NEW |