Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 892 } | 892 } |
| 893 } | 893 } |
| 894 } | 894 } |
| 895 | 895 |
| 896 | 896 |
| 897 void Decoder::DecodeType2(Instruction* instr) { | 897 void Decoder::DecodeType2(Instruction* instr) { |
| 898 switch (instr->PUField()) { | 898 switch (instr->PUField()) { |
| 899 case da_x: { | 899 case da_x: { |
| 900 if (instr->HasW()) { | 900 if (instr->HasW()) { |
| 901 Unknown(instr); // not used in V8 | 901 Unknown(instr); // not used in V8 |
| 902 return; | |
| 902 } | 903 } |
| 903 Format(instr, "'memop'cond'b 'rd, ['rn], #-'off12"); | 904 Format(instr, "'memop'cond'b 'rd, ['rn], #-'off12"); |
| 904 break; | 905 break; |
| 905 } | 906 } |
| 906 case ia_x: { | 907 case ia_x: { |
| 907 if (instr->HasW()) { | 908 if (instr->HasW()) { |
| 908 Unknown(instr); // not used in V8 | 909 Unknown(instr); // not used in V8 |
| 910 return; | |
| 909 } | 911 } |
| 910 Format(instr, "'memop'cond'b 'rd, ['rn], #+'off12"); | 912 Format(instr, "'memop'cond'b 'rd, ['rn], #+'off12"); |
| 911 break; | 913 break; |
| 912 } | 914 } |
| 913 case db_x: { | 915 case db_x: { |
| 914 Format(instr, "'memop'cond'b 'rd, ['rn, #-'off12]'w"); | 916 Format(instr, "'memop'cond'b 'rd, ['rn, #-'off12]'w"); |
| 915 break; | 917 break; |
| 916 } | 918 } |
| 917 case ib_x: { | 919 case ib_x: { |
| 918 Format(instr, "'memop'cond'b 'rd, ['rn, #+'off12]'w"); | 920 Format(instr, "'memop'cond'b 'rd, ['rn, #+'off12]'w"); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 985 default: { | 987 default: { |
| 986 // The PU field is a 2-bit field. | 988 // The PU field is a 2-bit field. |
| 987 UNREACHABLE(); | 989 UNREACHABLE(); |
| 988 break; | 990 break; |
| 989 } | 991 } |
| 990 } | 992 } |
| 991 } | 993 } |
| 992 | 994 |
| 993 | 995 |
| 994 void Decoder::DecodeType4(Instruction* instr) { | 996 void Decoder::DecodeType4(Instruction* instr) { |
| 995 ASSERT(instr->Bit(22) == 0); // Privileged mode currently not supported. | 997 if (instr->Bit(22) != 0) { |
| 996 if (instr->HasL()) { | 998 // Privileged mode currently not supported. |
| 997 Format(instr, "ldm'cond'pu 'rn'w, 'rlist"); | 999 Unknown(instr); |
| 998 } else { | 1000 } else { |
| 999 Format(instr, "stm'cond'pu 'rn'w, 'rlist"); | 1001 if (instr->HasL()) { |
| 1002 Format(instr, "ldm'cond'pu 'rn'w, 'rlist"); | |
| 1003 } else { | |
| 1004 Format(instr, "stm'cond'pu 'rn'w, 'rlist"); | |
| 1005 } | |
| 1000 } | 1006 } |
| 1001 } | 1007 } |
| 1002 | 1008 |
| 1003 | 1009 |
| 1004 void Decoder::DecodeType5(Instruction* instr) { | 1010 void Decoder::DecodeType5(Instruction* instr) { |
| 1005 Format(instr, "b'l'cond 'target"); | 1011 Format(instr, "b'l'cond 'target"); |
| 1006 } | 1012 } |
| 1007 | 1013 |
| 1008 | 1014 |
| 1009 void Decoder::DecodeType6(Instruction* instr) { | 1015 void Decoder::DecodeType6(Instruction* instr) { |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 1035 } | 1041 } |
| 1036 return Instruction::kInstrSize; | 1042 return Instruction::kInstrSize; |
| 1037 } | 1043 } |
| 1038 | 1044 |
| 1039 | 1045 |
| 1040 // void Decoder::DecodeTypeVFP(Instruction* instr) | 1046 // void Decoder::DecodeTypeVFP(Instruction* instr) |
| 1041 // vmov: Sn = Rt | 1047 // vmov: Sn = Rt |
| 1042 // vmov: Rt = Sn | 1048 // vmov: Rt = Sn |
| 1043 // vcvt: Dd = Sm | 1049 // vcvt: Dd = Sm |
| 1044 // vcvt: Sd = Dm | 1050 // vcvt: Sd = Dm |
| 1051 // Dd = vabs(Dm) | |
| 1052 // Dd = vneg(Dm) | |
| 1045 // Dd = vadd(Dn, Dm) | 1053 // Dd = vadd(Dn, Dm) |
| 1046 // Dd = vsub(Dn, Dm) | 1054 // Dd = vsub(Dn, Dm) |
| 1047 // Dd = vmul(Dn, Dm) | 1055 // Dd = vmul(Dn, Dm) |
| 1048 // Dd = vdiv(Dn, Dm) | 1056 // Dd = vdiv(Dn, Dm) |
| 1049 // vcmp(Dd, Dm) | 1057 // vcmp(Dd, Dm) |
| 1050 // vmrs | 1058 // vmrs |
| 1051 // vmsr | 1059 // vmsr |
| 1052 // Dd = vsqrt(Dm) | 1060 // Dd = vsqrt(Dm) |
| 1053 void Decoder::DecodeTypeVFP(Instruction* instr) { | 1061 void Decoder::DecodeTypeVFP(Instruction* instr) { |
| 1054 ASSERT((instr->TypeValue() == 7) && (instr->Bit(24) == 0x0) ); | 1062 ASSERT((instr->TypeValue() == 7) && (instr->Bit(24) == 0x0) ); |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1290 Format(instr, "vldr'cond 'Dd, ['rn + 4*'imm08@00]"); | 1298 Format(instr, "vldr'cond 'Dd, ['rn + 4*'imm08@00]"); |
| 1291 } else { | 1299 } else { |
| 1292 Format(instr, "vstr'cond 'Dd, ['rn + 4*'imm08@00]"); | 1300 Format(instr, "vstr'cond 'Dd, ['rn + 4*'imm08@00]"); |
| 1293 } | 1301 } |
| 1294 break; | 1302 break; |
| 1295 default: | 1303 default: |
| 1296 Unknown(instr); // Not used by V8. | 1304 Unknown(instr); // Not used by V8. |
| 1297 break; | 1305 break; |
| 1298 } | 1306 } |
| 1299 } else { | 1307 } else { |
| 1300 UNIMPLEMENTED(); // Not used by V8. | 1308 Unknown(instr); // Not used by V8. |
| 1301 } | 1309 } |
| 1302 } | 1310 } |
| 1303 | 1311 |
| 1304 | 1312 |
| 1305 // Disassemble the instruction at *instr_ptr into the output buffer. | 1313 // Disassemble the instruction at *instr_ptr into the output buffer. |
| 1306 int Decoder::InstructionDecode(byte* instr_ptr) { | 1314 int Decoder::InstructionDecode(byte* instr_ptr) { |
| 1307 Instruction* instr = Instruction::At(instr_ptr); | 1315 Instruction* instr = Instruction::At(instr_ptr); |
| 1308 // Print raw instruction bytes. | 1316 // Print raw instruction bytes. |
| 1309 out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_, | 1317 out_buffer_pos_ += OS::SNPrintF(out_buffer_ + out_buffer_pos_, |
| 1310 "%08x ", | 1318 "%08x ", |
| 1311 instr->InstructionBits()); | 1319 instr->InstructionBits()); |
| 1312 if (instr->ConditionField() == kSpecialCondition) { | 1320 if (instr->ConditionField() == kSpecialCondition) { |
| 1313 UNIMPLEMENTED(); | 1321 Unknown(instr); |
| 1322 return Instruction::kInstrSize; | |
| 1323 } | |
| 1324 int instruction_bits = *(reinterpret_cast<int*>(instr_ptr)); | |
| 1325 if ((instruction_bits & 0xfff00000) == 0x03000000) { | |
| 1326 Format(instr, "constant pool begin"); | |
|
Søren Thygesen Gjesse
2011/03/16 22:28:42
Maybe print the constant pool size which is encode
Karl Klose
2011/03/17 10:10:07
Done.
| |
| 1314 return Instruction::kInstrSize; | 1327 return Instruction::kInstrSize; |
| 1315 } | 1328 } |
| 1316 switch (instr->TypeValue()) { | 1329 switch (instr->TypeValue()) { |
| 1317 case 0: | 1330 case 0: |
| 1318 case 1: { | 1331 case 1: { |
| 1319 DecodeType01(instr); | 1332 DecodeType01(instr); |
| 1320 break; | 1333 break; |
| 1321 } | 1334 } |
| 1322 case 2: { | 1335 case 2: { |
| 1323 DecodeType2(instr); | 1336 DecodeType2(instr); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1433 pc += d.InstructionDecode(buffer, pc); | 1446 pc += d.InstructionDecode(buffer, pc); |
| 1434 fprintf(f, "%p %08x %s\n", | 1447 fprintf(f, "%p %08x %s\n", |
| 1435 prev_pc, *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); | 1448 prev_pc, *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); |
| 1436 } | 1449 } |
| 1437 } | 1450 } |
| 1438 | 1451 |
| 1439 | 1452 |
| 1440 } // namespace disasm | 1453 } // namespace disasm |
| 1441 | 1454 |
| 1442 #endif // V8_TARGET_ARCH_ARM | 1455 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |