OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #include <stdarg.h> | 5 #include <stdarg.h> |
6 #include <stdlib.h> | 6 #include <stdlib.h> |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #if V8_TARGET_ARCH_ARM | 9 #if V8_TARGET_ARCH_ARM |
10 | 10 |
(...skipping 3006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3017 | 3017 |
3018 void Simulator::DecodeType6(Instruction* instr) { | 3018 void Simulator::DecodeType6(Instruction* instr) { |
3019 DecodeType6CoprocessorIns(instr); | 3019 DecodeType6CoprocessorIns(instr); |
3020 } | 3020 } |
3021 | 3021 |
3022 | 3022 |
3023 void Simulator::DecodeType7(Instruction* instr) { | 3023 void Simulator::DecodeType7(Instruction* instr) { |
3024 if (instr->Bit(24) == 1) { | 3024 if (instr->Bit(24) == 1) { |
3025 SoftwareInterrupt(instr); | 3025 SoftwareInterrupt(instr); |
3026 } else { | 3026 } else { |
3027 DecodeTypeVFP(instr); | 3027 switch (instr->CoprocessorValue()) { |
| 3028 case 10: // Fall through. |
| 3029 case 11: |
| 3030 DecodeTypeVFP(instr); |
| 3031 break; |
| 3032 case 15: |
| 3033 DecodeTypeCP15(instr); |
| 3034 break; |
| 3035 default: |
| 3036 UNIMPLEMENTED(); |
| 3037 } |
3028 } | 3038 } |
3029 } | 3039 } |
3030 | 3040 |
3031 | 3041 |
3032 // void Simulator::DecodeTypeVFP(Instruction* instr) | 3042 // void Simulator::DecodeTypeVFP(Instruction* instr) |
3033 // The Following ARMv7 VFPv instructions are currently supported. | 3043 // The Following ARMv7 VFPv instructions are currently supported. |
3034 // vmov :Sn = Rt | 3044 // vmov :Sn = Rt |
3035 // vmov :Rt = Sn | 3045 // vmov :Rt = Sn |
3036 // vcvt: Dd = Sm | 3046 // vcvt: Dd = Sm |
3037 // vcvt: Sd = Dm | 3047 // vcvt: Sd = Dm |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3326 inv_op_vfp_flag_ = (rt_value >> 0) & 1; | 3336 inv_op_vfp_flag_ = (rt_value >> 0) & 1; |
3327 FPSCR_rounding_mode_ = | 3337 FPSCR_rounding_mode_ = |
3328 static_cast<VFPRoundingMode>((rt_value) & kVFPRoundingModeMask); | 3338 static_cast<VFPRoundingMode>((rt_value) & kVFPRoundingModeMask); |
3329 } | 3339 } |
3330 } else { | 3340 } else { |
3331 UNIMPLEMENTED(); // Not used by V8. | 3341 UNIMPLEMENTED(); // Not used by V8. |
3332 } | 3342 } |
3333 } | 3343 } |
3334 } | 3344 } |
3335 | 3345 |
| 3346 void Simulator::DecodeTypeCP15(Instruction* instr) { |
| 3347 DCHECK((instr->TypeValue() == 7) && (instr->Bit(24) == 0x0)); |
| 3348 DCHECK(instr->CoprocessorValue() == 15); |
| 3349 |
| 3350 if (instr->Bit(4) == 1) { |
| 3351 // mcr |
| 3352 int crn = instr->Bits(19, 16); |
| 3353 int crm = instr->Bits(3, 0); |
| 3354 int opc1 = instr->Bits(23, 21); |
| 3355 int opc2 = instr->Bits(7, 5); |
| 3356 if ((opc1 == 0) && (crn == 7)) { |
| 3357 // ARMv6 memory barrier operations. |
| 3358 // Details available in ARM DDI 0406C.b, B3-1750. |
| 3359 if (((crm == 10) && (opc2 == 5)) || // CP15DMB |
| 3360 ((crm == 10) && (opc2 == 4)) || // CP15DSB |
| 3361 ((crm == 5) && (opc2 == 4))) { // CP15ISB |
| 3362 // These are ignored by the simulator for now. |
| 3363 } else { |
| 3364 UNIMPLEMENTED(); |
| 3365 } |
| 3366 } |
| 3367 } else { |
| 3368 UNIMPLEMENTED(); |
| 3369 } |
| 3370 } |
3336 | 3371 |
3337 void Simulator::DecodeVMOVBetweenCoreAndSinglePrecisionRegisters( | 3372 void Simulator::DecodeVMOVBetweenCoreAndSinglePrecisionRegisters( |
3338 Instruction* instr) { | 3373 Instruction* instr) { |
3339 DCHECK((instr->Bit(4) == 1) && (instr->VCValue() == 0x0) && | 3374 DCHECK((instr->Bit(4) == 1) && (instr->VCValue() == 0x0) && |
3340 (instr->VAValue() == 0x0)); | 3375 (instr->VAValue() == 0x0)); |
3341 | 3376 |
3342 int t = instr->RtValue(); | 3377 int t = instr->RtValue(); |
3343 int n = instr->VFPNRegValue(kSinglePrecision); | 3378 int n = instr->VFPNRegValue(kSinglePrecision); |
3344 bool to_arm_register = (instr->VLValue() == 0x1); | 3379 bool to_arm_register = (instr->VLValue() == 0x1); |
3345 | 3380 |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3839 UNIMPLEMENTED(); | 3874 UNIMPLEMENTED(); |
3840 } | 3875 } |
3841 break; | 3876 break; |
3842 case 0xA: | 3877 case 0xA: |
3843 case 0xB: | 3878 case 0xB: |
3844 if ((instr->Bits(22, 20) == 5) && (instr->Bits(15, 12) == 0xf)) { | 3879 if ((instr->Bits(22, 20) == 5) && (instr->Bits(15, 12) == 0xf)) { |
3845 // pld: ignore instruction. | 3880 // pld: ignore instruction. |
3846 } else if (instr->SpecialValue() == 0xA && instr->Bits(22, 20) == 7) { | 3881 } else if (instr->SpecialValue() == 0xA && instr->Bits(22, 20) == 7) { |
3847 // dsb, dmb, isb: ignore instruction for now. | 3882 // dsb, dmb, isb: ignore instruction for now. |
3848 // TODO(binji): implement | 3883 // TODO(binji): implement |
| 3884 // Also refer to the ARMv6 CP15 equivalents in DecodeTypeCP15. |
3849 } else { | 3885 } else { |
3850 UNIMPLEMENTED(); | 3886 UNIMPLEMENTED(); |
3851 } | 3887 } |
3852 break; | 3888 break; |
3853 case 0x1D: | 3889 case 0x1D: |
3854 if (instr->Opc1Value() == 0x7 && instr->Opc3Value() == 0x1 && | 3890 if (instr->Opc1Value() == 0x7 && instr->Opc3Value() == 0x1 && |
3855 instr->Bits(11, 9) == 0x5 && instr->Bits(19, 18) == 0x2) { | 3891 instr->Bits(11, 9) == 0x5 && instr->Bits(19, 18) == 0x2) { |
3856 if (instr->SzValue() == 0x1) { | 3892 if (instr->SzValue() == 0x1) { |
3857 int vm = instr->VFPMRegValue(kDoublePrecision); | 3893 int vm = instr->VFPMRegValue(kDoublePrecision); |
3858 int vd = instr->VFPDRegValue(kDoublePrecision); | 3894 int vd = instr->VFPDRegValue(kDoublePrecision); |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4197 set_register(sp, current_sp + sizeof(uintptr_t)); | 4233 set_register(sp, current_sp + sizeof(uintptr_t)); |
4198 return address; | 4234 return address; |
4199 } | 4235 } |
4200 | 4236 |
4201 } // namespace internal | 4237 } // namespace internal |
4202 } // namespace v8 | 4238 } // namespace v8 |
4203 | 4239 |
4204 #endif // USE_SIMULATOR | 4240 #endif // USE_SIMULATOR |
4205 | 4241 |
4206 #endif // V8_TARGET_ARCH_ARM | 4242 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |