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 // 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 imm21 >>= (32 - kImm21Bits); | 337 imm21 >>= (32 - kImm21Bits); |
338 out_buffer_pos_ += | 338 out_buffer_pos_ += |
339 SNPrintF(out_buffer_ + out_buffer_pos_, "%s", | 339 SNPrintF(out_buffer_ + out_buffer_pos_, "%s", |
340 converter_.NameOfAddress(reinterpret_cast<byte*>(instr) + | 340 converter_.NameOfAddress(reinterpret_cast<byte*>(instr) + |
341 delta_pc + (imm21 << n_bits))); | 341 delta_pc + (imm21 << n_bits))); |
342 } | 342 } |
343 | 343 |
344 | 344 |
345 // Print 26-bit hex immediate value. | 345 // Print 26-bit hex immediate value. |
346 void Decoder::PrintXImm26(Instruction* instr) { | 346 void Decoder::PrintXImm26(Instruction* instr) { |
347 uint32_t imm = static_cast<uint32_t>(instr->Imm26Value()) << kImmFieldShift; | 347 uint64_t target = static_cast<uint64_t>(instr->Imm26Value()) |
348 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "0x%x", imm); | 348 << kImmFieldShift; |
| 349 target = (reinterpret_cast<uint64_t>(instr) & ~0xfffffff) | target; |
| 350 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "0x%lx", target); |
349 } | 351 } |
350 | 352 |
351 | 353 |
352 // Print 26-bit signed immediate value. | 354 // Print 26-bit signed immediate value. |
353 void Decoder::PrintSImm26(Instruction* instr) { | 355 void Decoder::PrintSImm26(Instruction* instr) { |
354 int32_t imm26 = instr->Imm26Value(); | 356 int32_t imm26 = instr->Imm26Value(); |
355 // set sign | 357 // set sign |
356 imm26 <<= (32 - kImm26Bits); | 358 imm26 <<= (32 - kImm26Bits); |
357 imm26 >>= (32 - kImm26Bits); | 359 imm26 >>= (32 - kImm26Bits); |
358 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "%d", imm26); | 360 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "%d", imm26); |
(...skipping 1566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1925 prev_pc, *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); | 1927 prev_pc, *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); |
1926 } | 1928 } |
1927 } | 1929 } |
1928 | 1930 |
1929 | 1931 |
1930 #undef UNSUPPORTED | 1932 #undef UNSUPPORTED |
1931 | 1933 |
1932 } // namespace disasm | 1934 } // namespace disasm |
1933 | 1935 |
1934 #endif // V8_TARGET_ARCH_MIPS64 | 1936 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |