OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 | 5 |
6 // Declares a Simulator for PPC instructions if we are not generating a native | 6 // Declares a Simulator for PPC instructions if we are not generating a native |
7 // PPC binary. This Simulator allows us to run and debug PPC code generation on | 7 // PPC binary. This Simulator allows us to run and debug PPC code generation on |
8 // regular desktop machines. | 8 // regular desktop machines. |
9 // V8 calls into generated code by "calling" the CALL_GENERATED_CODE macro, | 9 // V8 calls into generated code by "calling" the CALL_GENERATED_CODE macro, |
10 // which will start execution in the Simulator or forwards to the real entry | 10 // which will start execution in the Simulator or forwards to the real entry |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 // Known bad pc value to ensure that the simulator does not execute | 246 // Known bad pc value to ensure that the simulator does not execute |
247 // without being properly setup. | 247 // without being properly setup. |
248 bad_lr = -1, | 248 bad_lr = -1, |
249 // A pc value used to signal the simulator to stop execution. Generally | 249 // A pc value used to signal the simulator to stop execution. Generally |
250 // the lr is set to this value on transition from native C code to | 250 // the lr is set to this value on transition from native C code to |
251 // simulated execution, so that the simulator can "return" to the native | 251 // simulated execution, so that the simulator can "return" to the native |
252 // C code. | 252 // C code. |
253 end_sim_pc = -2 | 253 end_sim_pc = -2 |
254 }; | 254 }; |
255 | 255 |
| 256 enum BCType { BC_OFFSET, BC_LINK_REG, BC_CTR_REG }; |
| 257 |
256 // Unsupported instructions use Format to print an error and stop execution. | 258 // Unsupported instructions use Format to print an error and stop execution. |
257 void Format(Instruction* instr, const char* format); | 259 void Format(Instruction* instr, const char* format); |
258 | 260 |
259 // Helper functions to set the conditional flags in the architecture state. | 261 // Helper functions to set the conditional flags in the architecture state. |
260 bool CarryFrom(int32_t left, int32_t right, int32_t carry = 0); | 262 bool CarryFrom(int32_t left, int32_t right, int32_t carry = 0); |
261 bool BorrowFrom(int32_t left, int32_t right); | 263 bool BorrowFrom(int32_t left, int32_t right); |
262 bool OverflowFrom(int32_t alu_out, int32_t left, int32_t right, | 264 bool OverflowFrom(int32_t alu_out, int32_t left, int32_t right, |
263 bool addition); | 265 bool addition); |
264 | 266 |
265 // Helper functions to decode common "addressing" modes | 267 // Helper functions to decode common "addressing" modes |
(...skipping 29 matching lines...) Expand all Loading... |
295 inline uint32_t ReadWU(intptr_t addr, Instruction* instr); | 297 inline uint32_t ReadWU(intptr_t addr, Instruction* instr); |
296 inline int32_t ReadW(intptr_t addr, Instruction* instr); | 298 inline int32_t ReadW(intptr_t addr, Instruction* instr); |
297 inline void WriteW(intptr_t addr, uint32_t value, Instruction* instr); | 299 inline void WriteW(intptr_t addr, uint32_t value, Instruction* instr); |
298 inline void WriteW(intptr_t addr, int32_t value, Instruction* instr); | 300 inline void WriteW(intptr_t addr, int32_t value, Instruction* instr); |
299 | 301 |
300 intptr_t* ReadDW(intptr_t addr); | 302 intptr_t* ReadDW(intptr_t addr); |
301 void WriteDW(intptr_t addr, int64_t value); | 303 void WriteDW(intptr_t addr, int64_t value); |
302 | 304 |
303 void Trace(Instruction* instr); | 305 void Trace(Instruction* instr); |
304 void SetCR0(intptr_t result, bool setSO = false); | 306 void SetCR0(intptr_t result, bool setSO = false); |
305 void ExecuteBranchConditional(Instruction* instr); | 307 void ExecuteBranchConditional(Instruction* instr, BCType type); |
306 void ExecuteExt1(Instruction* instr); | 308 void ExecuteExt1(Instruction* instr); |
307 bool ExecuteExt2_10bit(Instruction* instr); | 309 bool ExecuteExt2_10bit(Instruction* instr); |
308 bool ExecuteExt2_9bit_part1(Instruction* instr); | 310 bool ExecuteExt2_9bit_part1(Instruction* instr); |
309 bool ExecuteExt2_9bit_part2(Instruction* instr); | 311 bool ExecuteExt2_9bit_part2(Instruction* instr); |
310 void ExecuteExt2_5bit(Instruction* instr); | 312 void ExecuteExt2_5bit(Instruction* instr); |
311 void ExecuteExt2(Instruction* instr); | 313 void ExecuteExt2(Instruction* instr); |
312 void ExecuteExt4(Instruction* instr); | 314 void ExecuteExt4(Instruction* instr); |
313 #if V8_TARGET_ARCH_PPC64 | 315 #if V8_TARGET_ARCH_PPC64 |
314 void ExecuteExt5(Instruction* instr); | 316 void ExecuteExt5(Instruction* instr); |
315 #endif | 317 #endif |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 | 421 |
420 static inline void UnregisterCTryCatch() { | 422 static inline void UnregisterCTryCatch() { |
421 Simulator::current(Isolate::Current())->PopAddress(); | 423 Simulator::current(Isolate::Current())->PopAddress(); |
422 } | 424 } |
423 }; | 425 }; |
424 } | 426 } |
425 } // namespace v8::internal | 427 } // namespace v8::internal |
426 | 428 |
427 #endif // !defined(USE_SIMULATOR) | 429 #endif // !defined(USE_SIMULATOR) |
428 #endif // V8_PPC_SIMULATOR_PPC_H_ | 430 #endif // V8_PPC_SIMULATOR_PPC_H_ |
OLD | NEW |