Chromium Code Reviews| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 123 // Registered breakpoints. | 123 // Registered breakpoints. |
| 124 Instr* break_pc_; | 124 Instr* break_pc_; |
| 125 int32_t break_instr_; | 125 int32_t break_instr_; |
| 126 | 126 |
| 127 // Illegal memory access support. | 127 // Illegal memory access support. |
| 128 static bool IsIllegalAddress(uword addr) { | 128 static bool IsIllegalAddress(uword addr) { |
| 129 return addr < 64*1024; | 129 return addr < 64*1024; |
| 130 } | 130 } |
| 131 void HandleIllegalAccess(uword addr, Instr* instr); | 131 void HandleIllegalAccess(uword addr, Instr* instr); |
| 132 | 132 |
| 133 // Handles a legal instruction that the simulator does not implement. | |
| 134 void UnimplementedInstruction(Instr* instr); | |
| 135 | |
| 136 // If something goes wrong (Unimplemented instruction, illegal access, etc.), | |
| 137 // this flag is used to decide whether to die or to drop into the simulator | |
| 138 // debugger. Its initial value is false. Then, when we enter the simulator | |
| 139 // debugger (for a user set breakpoint, etc.) it is set to true. | |
| 140 bool debugger_attached_; | |
| 141 | |
| 142 // Accesors to set and check whether the simulator debugger is attached. | |
|
regis
2013/03/21 17:21:13
Accessors
zra
2013/03/21 17:48:52
Done.
| |
| 143 bool debugger_attached() const { return debugger_attached_; } | |
| 144 void set_debugger_attached(bool b) { debugger_attached_ = b; } | |
| 145 | |
| 133 // Unsupported instructions use Format to print an error and stop execution. | 146 // Unsupported instructions use Format to print an error and stop execution. |
| 134 void Format(Instr* instr, const char* format); | 147 void Format(Instr* instr, const char* format); |
| 135 | 148 |
| 136 // Checks if the current instruction should be executed based on its | 149 // Checks if the current instruction should be executed based on its |
| 137 // condition bits. | 150 // condition bits. |
| 138 bool ConditionallyExecute(Instr* instr); | 151 bool ConditionallyExecute(Instr* instr); |
| 139 | 152 |
| 140 // Helper functions to set the conditional flags in the architecture state. | 153 // Helper functions to set the conditional flags in the architecture state. |
| 141 void SetNZFlags(int32_t val); | 154 void SetNZFlags(int32_t val); |
| 142 void SetCFlag(bool val); | 155 void SetCFlag(bool val); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 225 } | 238 } |
| 226 | 239 |
| 227 friend class SimulatorDebugger; | 240 friend class SimulatorDebugger; |
| 228 friend class SimulatorSetjmpBuffer; | 241 friend class SimulatorSetjmpBuffer; |
| 229 DISALLOW_COPY_AND_ASSIGN(Simulator); | 242 DISALLOW_COPY_AND_ASSIGN(Simulator); |
| 230 }; | 243 }; |
| 231 | 244 |
| 232 } // namespace dart | 245 } // namespace dart |
| 233 | 246 |
| 234 #endif // VM_SIMULATOR_ARM_H_ | 247 #endif // VM_SIMULATOR_ARM_H_ |
| OLD | NEW |