| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef V8_ARM64_SIMULATOR_ARM64_H_ | 5 #ifndef V8_ARM64_SIMULATOR_ARM64_H_ |
| 6 #define V8_ARM64_SIMULATOR_ARM64_H_ | 6 #define V8_ARM64_SIMULATOR_ARM64_H_ |
| 7 | 7 |
| 8 #include <stdarg.h> | 8 #include <stdarg.h> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 // for the 'next' command. | 475 // for the 'next' command. |
| 476 void CheckBreakNext(); | 476 void CheckBreakNext(); |
| 477 | 477 |
| 478 // Disassemble instruction at the given address. | 478 // Disassemble instruction at the given address. |
| 479 void PrintInstructionsAt(Instruction* pc, uint64_t count); | 479 void PrintInstructionsAt(Instruction* pc, uint64_t count); |
| 480 | 480 |
| 481 void PrintSystemRegisters(bool print_all = false); | 481 void PrintSystemRegisters(bool print_all = false); |
| 482 void PrintRegisters(bool print_all_regs = false); | 482 void PrintRegisters(bool print_all_regs = false); |
| 483 void PrintFPRegisters(bool print_all_regs = false); | 483 void PrintFPRegisters(bool print_all_regs = false); |
| 484 void PrintProcessorState(); | 484 void PrintProcessorState(); |
| 485 void PrintWrite(uint8_t* address, uint64_t value, unsigned num_bytes); | 485 void PrintWrite(uintptr_t address, uint64_t value, unsigned num_bytes); |
| 486 void LogSystemRegisters() { | 486 void LogSystemRegisters() { |
| 487 if (log_parameters_ & LOG_SYS_REGS) PrintSystemRegisters(); | 487 if (log_parameters_ & LOG_SYS_REGS) PrintSystemRegisters(); |
| 488 } | 488 } |
| 489 void LogRegisters() { | 489 void LogRegisters() { |
| 490 if (log_parameters_ & LOG_REGS) PrintRegisters(); | 490 if (log_parameters_ & LOG_REGS) PrintRegisters(); |
| 491 } | 491 } |
| 492 void LogFPRegisters() { | 492 void LogFPRegisters() { |
| 493 if (log_parameters_ & LOG_FP_REGS) PrintFPRegisters(); | 493 if (log_parameters_ & LOG_FP_REGS) PrintFPRegisters(); |
| 494 } | 494 } |
| 495 void LogProcessorState() { | 495 void LogProcessorState() { |
| 496 LogSystemRegisters(); | 496 LogSystemRegisters(); |
| 497 LogRegisters(); | 497 LogRegisters(); |
| 498 LogFPRegisters(); | 498 LogFPRegisters(); |
| 499 } | 499 } |
| 500 void LogWrite(uint8_t* address, uint64_t value, unsigned num_bytes) { | 500 template <typename T> |
| 501 if (log_parameters_ & LOG_WRITE) PrintWrite(address, value, num_bytes); | 501 void LogWrite(uintptr_t address, T value) { |
| 502 uint64_t raw_value = 0; |
| 503 DCHECK(sizeof(value) <= sizeof(raw_value)); |
| 504 if (log_parameters_ & LOG_WRITE) { |
| 505 memcpy(&raw_value, &value, sizeof(value)); |
| 506 PrintWrite(address, raw_value, sizeof(value)); |
| 507 } |
| 502 } | 508 } |
| 503 | 509 |
| 504 int log_parameters() { return log_parameters_; } | 510 int log_parameters() { return log_parameters_; } |
| 505 void set_log_parameters(int new_parameters) { | 511 void set_log_parameters(int new_parameters) { |
| 506 log_parameters_ = new_parameters; | 512 log_parameters_ = new_parameters; |
| 507 if (!decoder_) { | 513 if (!decoder_) { |
| 508 if (new_parameters & LOG_DISASM) { | 514 if (new_parameters & LOG_DISASM) { |
| 509 PrintF("Run --debug-sim to dynamically turn on disassembler\n"); | 515 PrintF("Run --debug-sim to dynamically turn on disassembler\n"); |
| 510 } | 516 } |
| 511 return; | 517 return; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 AddrMode addrmode); | 596 AddrMode addrmode); |
| 591 void LoadStorePairHelper(Instruction* instr, AddrMode addrmode); | 597 void LoadStorePairHelper(Instruction* instr, AddrMode addrmode); |
| 592 uint8_t* LoadStoreAddress(unsigned addr_reg, | 598 uint8_t* LoadStoreAddress(unsigned addr_reg, |
| 593 int64_t offset, | 599 int64_t offset, |
| 594 AddrMode addrmode); | 600 AddrMode addrmode); |
| 595 void LoadStoreWriteBack(unsigned addr_reg, | 601 void LoadStoreWriteBack(unsigned addr_reg, |
| 596 int64_t offset, | 602 int64_t offset, |
| 597 AddrMode addrmode); | 603 AddrMode addrmode); |
| 598 void CheckMemoryAccess(uint8_t* address, uint8_t* stack); | 604 void CheckMemoryAccess(uint8_t* address, uint8_t* stack); |
| 599 | 605 |
| 600 uint64_t MemoryRead(uint8_t* address, unsigned num_bytes); | 606 template <typename T, typename A> |
| 601 uint8_t MemoryRead8(uint8_t* address); | 607 T MemoryRead(A address) { |
| 602 uint16_t MemoryRead16(uint8_t* address); | 608 T value; |
| 603 uint32_t MemoryRead32(uint8_t* address); | 609 STATIC_ASSERT((sizeof(value) == 1) || (sizeof(value) == 2) || |
| 604 float MemoryReadFP32(uint8_t* address); | 610 (sizeof(value) == 4) || (sizeof(value) == 8)); |
| 605 uint64_t MemoryRead64(uint8_t* address); | 611 memcpy(&value, reinterpret_cast<const void*>(address), sizeof(value)); |
| 606 double MemoryReadFP64(uint8_t* address); | 612 return value; |
| 613 } |
| 607 | 614 |
| 608 void MemoryWrite(uint8_t* address, uint64_t value, unsigned num_bytes); | 615 template <typename T, typename A> |
| 609 void MemoryWrite32(uint8_t* address, uint32_t value); | 616 void MemoryWrite(A address, T value) { |
| 610 void MemoryWriteFP32(uint8_t* address, float value); | 617 STATIC_ASSERT((sizeof(value) == 1) || (sizeof(value) == 2) || |
| 611 void MemoryWrite64(uint8_t* address, uint64_t value); | 618 (sizeof(value) == 4) || (sizeof(value) == 8)); |
| 612 void MemoryWriteFP64(uint8_t* address, double value); | 619 LogWrite(reinterpret_cast<uintptr_t>(address), value); |
| 613 | 620 memcpy(reinterpret_cast<void*>(address), &value, sizeof(value)); |
| 621 } |
| 614 | 622 |
| 615 template <typename T> | 623 template <typename T> |
| 616 T ShiftOperand(T value, | 624 T ShiftOperand(T value, |
| 617 Shift shift_type, | 625 Shift shift_type, |
| 618 unsigned amount); | 626 unsigned amount); |
| 619 template <typename T> | 627 template <typename T> |
| 620 T ExtendValue(T value, | 628 T ExtendValue(T value, |
| 621 Extend extend_type, | 629 Extend extend_type, |
| 622 unsigned left_shift = 0); | 630 unsigned left_shift = 0); |
| 623 template <typename T> | 631 template <typename T> |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 829 static void UnregisterCTryCatch() { | 837 static void UnregisterCTryCatch() { |
| 830 Simulator::current(Isolate::Current())->PopAddress(); | 838 Simulator::current(Isolate::Current())->PopAddress(); |
| 831 } | 839 } |
| 832 }; | 840 }; |
| 833 | 841 |
| 834 #endif // !defined(USE_SIMULATOR) | 842 #endif // !defined(USE_SIMULATOR) |
| 835 | 843 |
| 836 } } // namespace v8::internal | 844 } } // namespace v8::internal |
| 837 | 845 |
| 838 #endif // V8_ARM64_SIMULATOR_ARM64_H_ | 846 #endif // V8_ARM64_SIMULATOR_ARM64_H_ |
| OLD | NEW |