OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 // Special case of set_register and get_register to access the raw PC value. | 99 // Special case of set_register and get_register to access the raw PC value. |
100 void set_pc(int32_t value); | 100 void set_pc(int32_t value); |
101 int32_t get_pc() const; | 101 int32_t get_pc() const; |
102 | 102 |
103 // Accessor to the internal simulator stack area. | 103 // Accessor to the internal simulator stack area. |
104 uintptr_t StackLimit() const; | 104 uintptr_t StackLimit() const; |
105 | 105 |
106 // Executes ARM instructions until the PC reaches end_sim_pc. | 106 // Executes ARM instructions until the PC reaches end_sim_pc. |
107 void Execute(); | 107 void Execute(); |
108 | 108 |
| 109 // Call on program start. |
| 110 static void Initialize(); |
| 111 |
109 // V8 generally calls into generated code with 5 parameters. This is a | 112 // V8 generally calls into generated code with 5 parameters. This is a |
110 // convenience function, which sets up the simulator state and grabs the | 113 // convenience function, which sets up the simulator state and grabs the |
111 // result on return. | 114 // result on return. |
112 v8::internal::Object* Call(int32_t entry, int32_t p0, int32_t p1, | 115 v8::internal::Object* Call(int32_t entry, int32_t p0, int32_t p1, |
113 int32_t p2, int32_t p3, int32_t p4); | 116 int32_t p2, int32_t p3, int32_t p4); |
114 | 117 |
115 private: | 118 private: |
116 enum special_values { | 119 enum special_values { |
117 // Known bad pc value to ensure that the simulator does not execute | 120 // Known bad pc value to ensure that the simulator does not execute |
118 // without being properly setup. | 121 // without being properly setup. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 void DecodeType2(Instr* instr); | 171 void DecodeType2(Instr* instr); |
169 void DecodeType3(Instr* instr); | 172 void DecodeType3(Instr* instr); |
170 void DecodeType4(Instr* instr); | 173 void DecodeType4(Instr* instr); |
171 void DecodeType5(Instr* instr); | 174 void DecodeType5(Instr* instr); |
172 void DecodeType6(Instr* instr); | 175 void DecodeType6(Instr* instr); |
173 void DecodeType7(Instr* instr); | 176 void DecodeType7(Instr* instr); |
174 | 177 |
175 // Executes one instruction. | 178 // Executes one instruction. |
176 void InstructionDecode(Instr* instr); | 179 void InstructionDecode(Instr* instr); |
177 | 180 |
| 181 // Runtime call support. |
| 182 static void* RedirectExternalReference(void* external_function, |
| 183 bool fp_return); |
| 184 |
178 // For use in calls that take two double values, constructed from r0, r1, r2 | 185 // For use in calls that take two double values, constructed from r0, r1, r2 |
179 // and r3. | 186 // and r3. |
180 void GetFpArgs(double* x, double* y); | 187 void GetFpArgs(double* x, double* y); |
181 void SetFpResult(const double& result); | 188 void SetFpResult(const double& result); |
182 void TrashCallerSaveRegisters(); | 189 void TrashCallerSaveRegisters(); |
183 | 190 |
184 // architecture state | 191 // architecture state |
185 int32_t registers_[16]; | 192 int32_t registers_[16]; |
186 bool n_flag_; | 193 bool n_flag_; |
187 bool z_flag_; | 194 bool z_flag_; |
188 bool c_flag_; | 195 bool c_flag_; |
189 bool v_flag_; | 196 bool v_flag_; |
190 | 197 |
191 // simulator support | 198 // simulator support |
192 char* stack_; | 199 char* stack_; |
193 bool pc_modified_; | 200 bool pc_modified_; |
194 int icount_; | 201 int icount_; |
| 202 static bool initialized_; |
195 | 203 |
196 // registered breakpoints | 204 // registered breakpoints |
197 Instr* break_pc_; | 205 Instr* break_pc_; |
198 instr_t break_instr_; | 206 instr_t break_instr_; |
199 }; | 207 }; |
200 | 208 |
201 } } // namespace assembler::arm | 209 } } // namespace assembler::arm |
202 | 210 |
203 #endif // defined(__arm__) | 211 #endif // defined(__arm__) |
204 | 212 |
205 #endif // V8_ARM_SIMULATOR_ARM_H_ | 213 #endif // V8_ARM_SIMULATOR_ARM_H_ |
OLD | NEW |