MIPS: Fix disassembler for J and JAL instructions.

Adapted disassembler for J and JAL instructions.

TEST=cctest/test-disasm-mips/Type0,
     cctest/test-disasm-mips64/Type3
BUG=

Review URL: https://codereview.chromium.org/1258743004

Cr-Commit-Position: refs/heads/master@{#29921}
This commit is contained in:
Ilija.Pavlovic 2015-07-30 02:16:35 -07:00 committed by Commit bot
parent 437c789a26
commit 496bd53bcc
2 changed files with 8 additions and 4 deletions

View File

@ -352,8 +352,10 @@ void Decoder::PrintPCImm21(Instruction* instr, int delta_pc, int n_bits) {
// Print 26-bit hex immediate value.
void Decoder::PrintXImm26(Instruction* instr) {
uint32_t imm = instr->Imm26Value() << kImmFieldShift;
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "0x%x", imm);
uint32_t target = static_cast<uint32_t>(instr->Imm26Value())
<< kImmFieldShift;
target = (reinterpret_cast<uint32_t>(instr) & ~0xfffffff) | target;
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "0x%x", target);
}

View File

@ -344,8 +344,10 @@ void Decoder::PrintPCImm21(Instruction* instr, int delta_pc, int n_bits) {
// Print 26-bit hex immediate value.
void Decoder::PrintXImm26(Instruction* instr) {
uint32_t imm = static_cast<uint32_t>(instr->Imm26Value()) << kImmFieldShift;
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "0x%x", imm);
uint64_t target = static_cast<uint64_t>(instr->Imm26Value())
<< kImmFieldShift;
target = (reinterpret_cast<uint64_t>(instr) & ~0xfffffff) | target;
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "0x%lx", target);
}