OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 // A Disassembler object is used to disassemble a block of code instruction by | 5 // A Disassembler object is used to disassemble a block of code instruction by |
6 // instruction. The default implementation of the NameConverter object can be | 6 // instruction. The default implementation of the NameConverter object can be |
7 // overriden to modify register names or to do symbol lookup on addresses. | 7 // overriden to modify register names or to do symbol lookup on addresses. |
8 // | 8 // |
9 // The example below will disassemble a block of code and print it to stdout. | 9 // The example below will disassemble a block of code and print it to stdout. |
10 // | 10 // |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 71 |
72 // Handle formatting of instructions and their options. | 72 // Handle formatting of instructions and their options. |
73 int FormatRegister(Instruction* instr, const char* option); | 73 int FormatRegister(Instruction* instr, const char* option); |
74 int FormatOption(Instruction* instr, const char* option); | 74 int FormatOption(Instruction* instr, const char* option); |
75 void Format(Instruction* instr, const char* format); | 75 void Format(Instruction* instr, const char* format); |
76 void Unknown(Instruction* instr); | 76 void Unknown(Instruction* instr); |
77 void UnknownFormat(Instruction* instr, const char* opcname); | 77 void UnknownFormat(Instruction* instr, const char* opcname); |
78 | 78 |
79 void DecodeExt1(Instruction* instr); | 79 void DecodeExt1(Instruction* instr); |
80 void DecodeExt2(Instruction* instr); | 80 void DecodeExt2(Instruction* instr); |
| 81 void DecodeExt3(Instruction* instr); |
81 void DecodeExt4(Instruction* instr); | 82 void DecodeExt4(Instruction* instr); |
82 void DecodeExt5(Instruction* instr); | 83 void DecodeExt5(Instruction* instr); |
83 | 84 |
84 const disasm::NameConverter& converter_; | 85 const disasm::NameConverter& converter_; |
85 Vector<char> out_buffer_; | 86 Vector<char> out_buffer_; |
86 int out_buffer_pos_; | 87 int out_buffer_pos_; |
87 | 88 |
88 DISALLOW_COPY_AND_ASSIGN(Decoder); | 89 DISALLOW_COPY_AND_ASSIGN(Decoder); |
89 }; | 90 }; |
90 | 91 |
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
869 Format(instr, "isel 'rt, 'ra, 'rb"); | 870 Format(instr, "isel 'rt, 'ra, 'rb"); |
870 return; | 871 return; |
871 } | 872 } |
872 default: { | 873 default: { |
873 Unknown(instr); // not used by V8 | 874 Unknown(instr); // not used by V8 |
874 } | 875 } |
875 } | 876 } |
876 } | 877 } |
877 | 878 |
878 | 879 |
| 880 void Decoder::DecodeExt3(Instruction* instr) { |
| 881 switch (instr->Bits(10, 1) << 1) { |
| 882 case FCFID: { |
| 883 Format(instr, "fcfids'. 'Dt, 'Db"); |
| 884 break; |
| 885 } |
| 886 default: { |
| 887 Unknown(instr); // not used by V8 |
| 888 } |
| 889 } |
| 890 } |
| 891 |
| 892 |
879 void Decoder::DecodeExt4(Instruction* instr) { | 893 void Decoder::DecodeExt4(Instruction* instr) { |
880 switch (instr->Bits(5, 1) << 1) { | 894 switch (instr->Bits(5, 1) << 1) { |
881 case FDIV: { | 895 case FDIV: { |
882 Format(instr, "fdiv'. 'Dt, 'Da, 'Db"); | 896 Format(instr, "fdiv'. 'Dt, 'Da, 'Db"); |
883 return; | 897 return; |
884 } | 898 } |
885 case FSUB: { | 899 case FSUB: { |
886 Format(instr, "fsub'. 'Dt, 'Da, 'Db"); | 900 Format(instr, "fsub'. 'Dt, 'Da, 'Db"); |
887 return; | 901 return; |
888 } | 902 } |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1286 break; | 1300 break; |
1287 } | 1301 } |
1288 case STFD: { | 1302 case STFD: { |
1289 Format(instr, "stfd 'Dt, 'int16('ra)"); | 1303 Format(instr, "stfd 'Dt, 'int16('ra)"); |
1290 break; | 1304 break; |
1291 } | 1305 } |
1292 case STFDU: { | 1306 case STFDU: { |
1293 Format(instr, "stfdu 'Dt, 'int16('ra)"); | 1307 Format(instr, "stfdu 'Dt, 'int16('ra)"); |
1294 break; | 1308 break; |
1295 } | 1309 } |
1296 case EXT3: | 1310 case EXT3: { |
| 1311 DecodeExt3(instr); |
| 1312 break; |
| 1313 } |
1297 case EXT4: { | 1314 case EXT4: { |
1298 DecodeExt4(instr); | 1315 DecodeExt4(instr); |
1299 break; | 1316 break; |
1300 } | 1317 } |
1301 case EXT5: { | 1318 case EXT5: { |
1302 DecodeExt5(instr); | 1319 DecodeExt5(instr); |
1303 break; | 1320 break; |
1304 } | 1321 } |
1305 #if V8_TARGET_ARCH_PPC64 | 1322 #if V8_TARGET_ARCH_PPC64 |
1306 case LD: { | 1323 case LD: { |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1406 pc += d.InstructionDecode(buffer, pc); | 1423 pc += d.InstructionDecode(buffer, pc); |
1407 v8::internal::PrintF(f, "%p %08x %s\n", prev_pc, | 1424 v8::internal::PrintF(f, "%p %08x %s\n", prev_pc, |
1408 *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); | 1425 *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); |
1409 } | 1426 } |
1410 } | 1427 } |
1411 | 1428 |
1412 | 1429 |
1413 } // namespace disasm | 1430 } // namespace disasm |
1414 | 1431 |
1415 #endif // V8_TARGET_ARCH_PPC | 1432 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |