| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 ARM64 instructions if we are not generating a native | 5 // Declares a Simulator for ARM64 instructions if we are not generating a native |
| 6 // ARM64 binary. This Simulator allows us to run and debug ARM64 code generation | 6 // ARM64 binary. This Simulator allows us to run and debug ARM64 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 ARM64 HW platform. | 10 // on a ARM64 HW platform. |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 // Registered breakpoints. | 101 // Registered breakpoints. |
| 102 Instr* break_pc_; | 102 Instr* break_pc_; |
| 103 int64_t break_instr_; | 103 int64_t break_instr_; |
| 104 | 104 |
| 105 // Illegal memory access support. | 105 // Illegal memory access support. |
| 106 static bool IsIllegalAddress(uword addr) { | 106 static bool IsIllegalAddress(uword addr) { |
| 107 return addr < 64*1024; | 107 return addr < 64*1024; |
| 108 } | 108 } |
| 109 void HandleIllegalAccess(uword addr, Instr* instr); | 109 void HandleIllegalAccess(uword addr, Instr* instr); |
| 110 | 110 |
| 111 // Handles an unaligned memory access. |
| 112 void UnalignedAccess(const char* msg, uword addr, Instr* instr); |
| 113 |
| 111 // Handles a legal instruction that the simulator does not implement. | 114 // Handles a legal instruction that the simulator does not implement. |
| 112 void UnimplementedInstruction(Instr* instr); | 115 void UnimplementedInstruction(Instr* instr); |
| 113 | 116 |
| 114 // Unsupported instructions use Format to print an error and stop execution. | 117 // Unsupported instructions use Format to print an error and stop execution. |
| 115 void Format(Instr* instr, const char* format); | 118 void Format(Instr* instr, const char* format); |
| 116 | 119 |
| 120 inline uint8_t ReadBU(uword addr); |
| 121 inline int8_t ReadB(uword addr); |
| 122 inline void WriteB(uword addr, uint8_t value); |
| 123 |
| 124 inline uint16_t ReadHU(uword addr, Instr* instr); |
| 125 inline int16_t ReadH(uword addr, Instr* instr); |
| 126 inline void WriteH(uword addr, uint16_t value, Instr* instr); |
| 127 |
| 128 inline uint32_t ReadWU(uword addr, Instr* instr); |
| 129 inline int32_t ReadW(uword addr, Instr* instr); |
| 130 inline void WriteW(uword addr, uint32_t value, Instr* instr); |
| 131 |
| 132 inline intptr_t ReadX(uword addr, Instr* instr); |
| 133 inline void WriteX(uword addr, intptr_t value, Instr* instr); |
| 134 |
| 117 // Helper functions to set the conditional flags in the architecture state. | 135 // Helper functions to set the conditional flags in the architecture state. |
| 118 void SetNZFlagsW(int32_t val); | 136 void SetNZFlagsW(int32_t val); |
| 119 bool CarryFromW(int32_t left, int32_t right); | 137 bool CarryFromW(int32_t left, int32_t right); |
| 120 bool BorrowFromW(int32_t left, int32_t right); | 138 bool BorrowFromW(int32_t left, int32_t right); |
| 121 bool OverflowFromW( | 139 bool OverflowFromW( |
| 122 int32_t alu_out, int32_t left, int32_t right, bool addition); | 140 int32_t alu_out, int32_t left, int32_t right, bool addition); |
| 123 | 141 |
| 124 void SetNZFlagsX(int64_t val); | 142 void SetNZFlagsX(int64_t val); |
| 125 bool CarryFromX(int64_t left, int64_t right); | 143 bool CarryFromX(int64_t left, int64_t right); |
| 126 bool BorrowFromX(int64_t left, int64_t right); | 144 bool BorrowFromX(int64_t left, int64_t right); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 151 | 169 |
| 152 // Executes ARM64 instructions until the PC reaches kEndSimulatingPC. | 170 // Executes ARM64 instructions until the PC reaches kEndSimulatingPC. |
| 153 void Execute(); | 171 void Execute(); |
| 154 | 172 |
| 155 DISALLOW_COPY_AND_ASSIGN(Simulator); | 173 DISALLOW_COPY_AND_ASSIGN(Simulator); |
| 156 }; | 174 }; |
| 157 | 175 |
| 158 } // namespace dart | 176 } // namespace dart |
| 159 | 177 |
| 160 #endif // VM_SIMULATOR_ARM64_H_ | 178 #endif // VM_SIMULATOR_ARM64_H_ |
| OLD | NEW |