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 970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 | 981 |
982 #undef VERIFIY | 982 #undef VERIFIY |
983 | 983 |
984 // Disassemble the instruction at *instr_ptr into the output buffer. | 984 // Disassemble the instruction at *instr_ptr into the output buffer. |
985 int Decoder::InstructionDecode(byte* instr_ptr) { | 985 int Decoder::InstructionDecode(byte* instr_ptr) { |
986 Instruction* instr = Instruction::At(instr_ptr); | 986 Instruction* instr = Instruction::At(instr_ptr); |
987 // Print raw instruction bytes. | 987 // Print raw instruction bytes. |
988 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "%08x ", | 988 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "%08x ", |
989 instr->InstructionBits()); | 989 instr->InstructionBits()); |
990 | 990 |
| 991 #if ABI_USES_FUNCTION_DESCRIPTORS |
| 992 // The first field will be identified as a jump table entry. We emit the rest |
| 993 // of the structure as zero, so just skip past them. |
| 994 if (instr->InstructionBits() == 0) { |
| 995 Format(instr, "constant"); |
| 996 return Instruction::kInstrSize; |
| 997 } |
| 998 #endif |
| 999 |
991 switch (instr->OpcodeValue() << 26) { | 1000 switch (instr->OpcodeValue() << 26) { |
992 case TWI: { | 1001 case TWI: { |
993 PrintSoftwareInterrupt(instr->SvcValue()); | 1002 PrintSoftwareInterrupt(instr->SvcValue()); |
994 break; | 1003 break; |
995 } | 1004 } |
996 case MULLI: { | 1005 case MULLI: { |
997 UnknownFormat(instr, "mulli"); | 1006 UnknownFormat(instr, "mulli"); |
998 break; | 1007 break; |
999 } | 1008 } |
1000 case SUBFIC: { | 1009 case SUBFIC: { |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1355 pc += d.InstructionDecode(buffer, pc); | 1364 pc += d.InstructionDecode(buffer, pc); |
1356 v8::internal::PrintF(f, "%p %08x %s\n", prev_pc, | 1365 v8::internal::PrintF(f, "%p %08x %s\n", prev_pc, |
1357 *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); | 1366 *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); |
1358 } | 1367 } |
1359 } | 1368 } |
1360 | 1369 |
1361 | 1370 |
1362 } // namespace disasm | 1371 } // namespace disasm |
1363 | 1372 |
1364 #endif // V8_TARGET_ARCH_PPC | 1373 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |