| 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 MIPS instructions if we are not generating a native | 5 // Declares a Simulator for MIPS instructions if we are not generating a native |
| 6 // MIPS binary. This Simulator allows us to run and debug MIPS code generation | 6 // MIPS binary. This Simulator allows us to run and debug MIPS 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 MIPS HW platform. | 10 // on a MIPS HW platform. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 // Accessor for the pc. | 54 // Accessor for the pc. |
| 55 void set_pc(int32_t value) { pc_ = value; } | 55 void set_pc(int32_t value) { pc_ = value; } |
| 56 int32_t get_pc() const { return pc_; } | 56 int32_t get_pc() const { return pc_; } |
| 57 | 57 |
| 58 // Accessors for hi, lo registers. | 58 // Accessors for hi, lo registers. |
| 59 void set_hi_register(int32_t value) { hi_reg_ = value; } | 59 void set_hi_register(int32_t value) { hi_reg_ = value; } |
| 60 void set_lo_register(int32_t value) { lo_reg_ = value; } | 60 void set_lo_register(int32_t value) { lo_reg_ = value; } |
| 61 int32_t get_hi_register() const { return hi_reg_; } | 61 int32_t get_hi_register() const { return hi_reg_; } |
| 62 int32_t get_lo_register() const { return lo_reg_; } | 62 int32_t get_lo_register() const { return lo_reg_; } |
| 63 | 63 |
| 64 int32_t get_fcsr_condition_bit(int32_t cc) const { |
| 65 if (cc == 0) { |
| 66 return 23; |
| 67 } else { |
| 68 return 24 + cc; |
| 69 } |
| 70 } |
| 71 |
| 72 void set_fcsr_bit(uint32_t cc, bool value) { |
| 73 if (value) { |
| 74 fcsr_ |= (1 << cc); |
| 75 } else { |
| 76 fcsr_ &= ~(1 << cc); |
| 77 } |
| 78 } |
| 79 |
| 80 bool test_fcsr_bit(uint32_t cc) { |
| 81 return fcsr_ & (1 << cc); |
| 82 } |
| 83 |
| 64 // Accessor to the internal simulator stack top. | 84 // Accessor to the internal simulator stack top. |
| 65 uword StackTop() const; | 85 uword StackTop() const; |
| 66 | 86 |
| 67 // The isolate's top_exit_frame_info refers to a Dart frame in the simulator | 87 // The isolate's top_exit_frame_info refers to a Dart frame in the simulator |
| 68 // stack. The simulator's top_exit_frame_info refers to a C++ frame in the | 88 // stack. The simulator's top_exit_frame_info refers to a C++ frame in the |
| 69 // native stack. | 89 // native stack. |
| 70 uword top_exit_frame_info() const { return top_exit_frame_info_; } | 90 uword top_exit_frame_info() const { return top_exit_frame_info_; } |
| 71 void set_top_exit_frame_info(uword value) { top_exit_frame_info_ = value; } | 91 void set_top_exit_frame_info(uword value) { top_exit_frame_info_ = value; } |
| 72 | 92 |
| 73 // Call on program start. | 93 // Call on program start. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 102 // simulated execution, so that the simulator can "return" to the native | 122 // simulated execution, so that the simulator can "return" to the native |
| 103 // C code. | 123 // C code. |
| 104 static const uword kEndSimulatingPC = -1; | 124 static const uword kEndSimulatingPC = -1; |
| 105 | 125 |
| 106 // Special registers for the results of div, divu. | 126 // Special registers for the results of div, divu. |
| 107 int32_t hi_reg_; | 127 int32_t hi_reg_; |
| 108 int32_t lo_reg_; | 128 int32_t lo_reg_; |
| 109 | 129 |
| 110 int32_t registers_[kNumberOfCpuRegisters]; | 130 int32_t registers_[kNumberOfCpuRegisters]; |
| 111 int32_t fregisters_[kNumberOfFRegisters]; | 131 int32_t fregisters_[kNumberOfFRegisters]; |
| 132 int32_t fcsr_; |
| 112 uword pc_; | 133 uword pc_; |
| 113 | 134 |
| 114 // Simulator support. | 135 // Simulator support. |
| 115 char* stack_; | 136 char* stack_; |
| 116 int icount_; | 137 int icount_; |
| 117 bool delay_slot_; | 138 bool delay_slot_; |
| 118 SimulatorSetjmpBuffer* last_setjmp_buffer_; | 139 SimulatorSetjmpBuffer* last_setjmp_buffer_; |
| 119 uword top_exit_frame_info_; | 140 uword top_exit_frame_info_; |
| 120 | 141 |
| 121 // Registered breakpoints. | 142 // Registered breakpoints. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 } | 198 } |
| 178 | 199 |
| 179 friend class SimulatorDebugger; | 200 friend class SimulatorDebugger; |
| 180 friend class SimulatorSetjmpBuffer; | 201 friend class SimulatorSetjmpBuffer; |
| 181 DISALLOW_COPY_AND_ASSIGN(Simulator); | 202 DISALLOW_COPY_AND_ASSIGN(Simulator); |
| 182 }; | 203 }; |
| 183 | 204 |
| 184 } // namespace dart | 205 } // namespace dart |
| 185 | 206 |
| 186 #endif // VM_SIMULATOR_MIPS_H_ | 207 #endif // VM_SIMULATOR_MIPS_H_ |
| OLD | NEW |