| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 // Print the register name according to the active name converter. | 185 // Print the register name according to the active name converter. |
| 186 void Decoder::PrintRegister(int reg) { | 186 void Decoder::PrintRegister(int reg) { |
| 187 Print(converter_.NameOfCPURegister(reg)); | 187 Print(converter_.NameOfCPURegister(reg)); |
| 188 } | 188 } |
| 189 | 189 |
| 190 // Print the VFP S register name according to the active name converter. | 190 // Print the VFP S register name according to the active name converter. |
| 191 void Decoder::PrintSRegister(int reg) { | 191 void Decoder::PrintSRegister(int reg) { |
| 192 Print(VFPRegisters::Name(reg, false)); | 192 Print(VFPRegisters::Name(reg, false)); |
| 193 } | 193 } |
| 194 | 194 |
| 195 // Print the VFP D register name according to the active name converter. | 195 // Print the VFP D register name according to the active name converter. |
| 196 void Decoder::PrintDRegister(int reg) { | 196 void Decoder::PrintDRegister(int reg) { |
| 197 Print(VFPRegisters::Name(reg, true)); | 197 Print(VFPRegisters::Name(reg, true)); |
| 198 } | 198 } |
| 199 | 199 |
| 200 | 200 |
| 201 // These shift names are defined in a way to match the native disassembler | 201 // These shift names are defined in a way to match the native disassembler |
| 202 // formatting. See for example the command "objdump -d <binary file>". | 202 // formatting. See for example the command "objdump -d <binary file>". |
| 203 static const char* const shift_names[kNumberOfShifts] = { | 203 static const char* const shift_names[kNumberOfShifts] = { |
| 204 "lsl", "lsr", "asr", "ror" | 204 "lsl", "lsr", "asr", "ror" |
| 205 }; | 205 }; |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 VFPRegPrecision precision = | 374 VFPRegPrecision precision = |
| 375 format[0] == 'D' ? kDoublePrecision : kSinglePrecision; | 375 format[0] == 'D' ? kDoublePrecision : kSinglePrecision; |
| 376 | 376 |
| 377 int retval = 2; | 377 int retval = 2; |
| 378 int reg = -1; | 378 int reg = -1; |
| 379 if (format[1] == 'n') { | 379 if (format[1] == 'n') { |
| 380 reg = instr->VFPNRegValue(precision); | 380 reg = instr->VFPNRegValue(precision); |
| 381 } else if (format[1] == 'm') { | 381 } else if (format[1] == 'm') { |
| 382 reg = instr->VFPMRegValue(precision); | 382 reg = instr->VFPMRegValue(precision); |
| 383 } else if (format[1] == 'd') { | 383 } else if (format[1] == 'd') { |
| 384 reg = instr->VFPDRegValue(precision); | 384 if ((instr->TypeValue() == 7) && |
| 385 (instr->Bit(24) == 0x0) && |
| 386 (instr->Bits(11, 9) == 0x5) && |
| 387 (instr->Bit(4) == 0x1)) { |
| 388 // vmov.32 has Vd in a different place. |
| 389 reg = instr->Bits(19, 16) | (instr->Bit(7) << 4); |
| 390 } else { |
| 391 reg = instr->VFPDRegValue(precision); |
| 392 } |
| 393 |
| 385 if (format[2] == '+') { | 394 if (format[2] == '+') { |
| 386 int immed8 = instr->Immed8Value(); | 395 int immed8 = instr->Immed8Value(); |
| 387 if (format[0] == 'S') reg += immed8 - 1; | 396 if (format[0] == 'S') reg += immed8 - 1; |
| 388 if (format[0] == 'D') reg += (immed8 / 2 - 1); | 397 if (format[0] == 'D') reg += (immed8 / 2 - 1); |
| 389 } | 398 } |
| 390 if (format[2] == '+') retval = 3; | 399 if (format[2] == '+') retval = 3; |
| 391 } else { | 400 } else { |
| 392 UNREACHABLE(); | 401 UNREACHABLE(); |
| 393 } | 402 } |
| 394 | 403 |
| (...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1173 } else { | 1182 } else { |
| 1174 Unknown(instr); // Not used by V8. | 1183 Unknown(instr); // Not used by V8. |
| 1175 } | 1184 } |
| 1176 } else { | 1185 } else { |
| 1177 Unknown(instr); // Not used by V8. | 1186 Unknown(instr); // Not used by V8. |
| 1178 } | 1187 } |
| 1179 } else { | 1188 } else { |
| 1180 if ((instr->VCValue() == 0x0) && | 1189 if ((instr->VCValue() == 0x0) && |
| 1181 (instr->VAValue() == 0x0)) { | 1190 (instr->VAValue() == 0x0)) { |
| 1182 DecodeVMOVBetweenCoreAndSinglePrecisionRegisters(instr); | 1191 DecodeVMOVBetweenCoreAndSinglePrecisionRegisters(instr); |
| 1192 } else if ((instr->VLValue() == 0x0) && |
| 1193 (instr->VCValue() == 0x1) && |
| 1194 (instr->Bit(23) == 0x0)) { |
| 1195 if (instr->Bit(21) == 0x0) { |
| 1196 Format(instr, "vmov.32'cond 'Dd[0], 'rt"); |
| 1197 } else { |
| 1198 Format(instr, "vmov.32'cond 'Dd[1], 'rt"); |
| 1199 } |
| 1183 } else if ((instr->VCValue() == 0x0) && | 1200 } else if ((instr->VCValue() == 0x0) && |
| 1184 (instr->VAValue() == 0x7) && | 1201 (instr->VAValue() == 0x7) && |
| 1185 (instr->Bits(19, 16) == 0x1)) { | 1202 (instr->Bits(19, 16) == 0x1)) { |
| 1186 if (instr->VLValue() == 0) { | 1203 if (instr->VLValue() == 0) { |
| 1187 if (instr->Bits(15, 12) == 0xF) { | 1204 if (instr->Bits(15, 12) == 0xF) { |
| 1188 Format(instr, "vmsr'cond FPSCR, APSR"); | 1205 Format(instr, "vmsr'cond FPSCR, APSR"); |
| 1189 } else { | 1206 } else { |
| 1190 Format(instr, "vmsr'cond FPSCR, 'rt"); | 1207 Format(instr, "vmsr'cond FPSCR, 'rt"); |
| 1191 } | 1208 } |
| 1192 } else { | 1209 } else { |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1336 } | 1353 } |
| 1337 break; | 1354 break; |
| 1338 } | 1355 } |
| 1339 default: | 1356 default: |
| 1340 Unknown(instr); // Not used by V8. | 1357 Unknown(instr); // Not used by V8. |
| 1341 } | 1358 } |
| 1342 } else if (instr->CoprocessorValue() == 0xB) { | 1359 } else if (instr->CoprocessorValue() == 0xB) { |
| 1343 switch (instr->OpcodeValue()) { | 1360 switch (instr->OpcodeValue()) { |
| 1344 case 0x2: | 1361 case 0x2: |
| 1345 // Load and store double to two GP registers | 1362 // Load and store double to two GP registers |
| 1346 if (instr->Bits(7, 4) != 0x1) { | 1363 if (instr->Bits(7, 6) != 0 || instr->Bit(4) != 1) { |
| 1347 Unknown(instr); // Not used by V8. | 1364 Unknown(instr); // Not used by V8. |
| 1348 } else if (instr->HasL()) { | 1365 } else if (instr->HasL()) { |
| 1349 Format(instr, "vmov'cond 'rt, 'rn, 'Dm"); | 1366 Format(instr, "vmov'cond 'rt, 'rn, 'Dm"); |
| 1350 } else { | 1367 } else { |
| 1351 Format(instr, "vmov'cond 'Dm, 'rt, 'rn"); | 1368 Format(instr, "vmov'cond 'Dm, 'rt, 'rn"); |
| 1352 } | 1369 } |
| 1353 break; | 1370 break; |
| 1354 case 0x8: | 1371 case 0x8: |
| 1372 case 0xA: |
| 1355 if (instr->HasL()) { | 1373 if (instr->HasL()) { |
| 1356 Format(instr, "vldr'cond 'Dd, ['rn - 4*'imm08@00]"); | 1374 Format(instr, "vldr'cond 'Dd, ['rn - 4*'imm08@00]"); |
| 1357 } else { | 1375 } else { |
| 1358 Format(instr, "vstr'cond 'Dd, ['rn - 4*'imm08@00]"); | 1376 Format(instr, "vstr'cond 'Dd, ['rn - 4*'imm08@00]"); |
| 1359 } | 1377 } |
| 1360 break; | 1378 break; |
| 1361 case 0xC: | 1379 case 0xC: |
| 1380 case 0xE: |
| 1362 if (instr->HasL()) { | 1381 if (instr->HasL()) { |
| 1363 Format(instr, "vldr'cond 'Dd, ['rn + 4*'imm08@00]"); | 1382 Format(instr, "vldr'cond 'Dd, ['rn + 4*'imm08@00]"); |
| 1364 } else { | 1383 } else { |
| 1365 Format(instr, "vstr'cond 'Dd, ['rn + 4*'imm08@00]"); | 1384 Format(instr, "vstr'cond 'Dd, ['rn + 4*'imm08@00]"); |
| 1366 } | 1385 } |
| 1367 break; | 1386 break; |
| 1368 case 0x4: | 1387 case 0x4: |
| 1369 case 0x5: | 1388 case 0x5: |
| 1370 case 0x9: { | 1389 case 0x6: |
| 1390 case 0x7: |
| 1391 case 0x9: |
| 1392 case 0xB: { |
| 1371 bool to_vfp_register = (instr->VLValue() == 0x1); | 1393 bool to_vfp_register = (instr->VLValue() == 0x1); |
| 1372 if (to_vfp_register) { | 1394 if (to_vfp_register) { |
| 1373 Format(instr, "vldm'cond'pu 'rn'w, {'Dd-'Dd+}"); | 1395 Format(instr, "vldm'cond'pu 'rn'w, {'Dd-'Dd+}"); |
| 1374 } else { | 1396 } else { |
| 1375 Format(instr, "vstm'cond'pu 'rn'w, {'Dd-'Dd+}"); | 1397 Format(instr, "vstm'cond'pu 'rn'w, {'Dd-'Dd+}"); |
| 1376 } | 1398 } |
| 1377 break; | 1399 break; |
| 1378 } | 1400 } |
| 1379 default: | 1401 default: |
| 1380 Unknown(instr); // Not used by V8. | 1402 Unknown(instr); // Not used by V8. |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1534 pc += d.InstructionDecode(buffer, pc); | 1556 pc += d.InstructionDecode(buffer, pc); |
| 1535 fprintf(f, "%p %08x %s\n", | 1557 fprintf(f, "%p %08x %s\n", |
| 1536 prev_pc, *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); | 1558 prev_pc, *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); |
| 1537 } | 1559 } |
| 1538 } | 1560 } |
| 1539 | 1561 |
| 1540 | 1562 |
| 1541 } // namespace disasm | 1563 } // namespace disasm |
| 1542 | 1564 |
| 1543 #endif // V8_TARGET_ARCH_ARM | 1565 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |