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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 | 265 |
266 // Print 21-bit immediate value. | 266 // Print 21-bit immediate value. |
267 void Decoder::PrintXImm21(Instruction* instr) { | 267 void Decoder::PrintXImm21(Instruction* instr) { |
268 uint32_t imm = instr->Imm21Value(); | 268 uint32_t imm = instr->Imm21Value(); |
269 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "0x%x", imm); | 269 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "0x%x", imm); |
270 } | 270 } |
271 | 271 |
272 | 272 |
273 // Print 26-bit immediate value. | 273 // Print 26-bit immediate value. |
274 void Decoder::PrintXImm26(Instruction* instr) { | 274 void Decoder::PrintXImm26(Instruction* instr) { |
275 uint32_t imm = instr->Imm26Value() << kImmFieldShift; | 275 uint32_t imm = static_cast<uint32_t>(instr->Imm26Value()) << kImmFieldShift; |
276 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "0x%x", imm); | 276 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "0x%x", imm); |
277 } | 277 } |
278 | 278 |
279 | 279 |
280 // Print 26-bit immediate value. | 280 // Print 26-bit immediate value. |
281 void Decoder::PrintCode(Instruction* instr) { | 281 void Decoder::PrintCode(Instruction* instr) { |
282 if (instr->OpcodeFieldRaw() != SPECIAL) | 282 if (instr->OpcodeFieldRaw() != SPECIAL) |
283 return; // Not a break or trap instruction. | 283 return; // Not a break or trap instruction. |
284 switch (instr->FunctionFieldRaw()) { | 284 switch (instr->FunctionFieldRaw()) { |
285 case BREAK: { | 285 case BREAK: { |
(...skipping 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1583 prev_pc, *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); | 1583 prev_pc, *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); |
1584 } | 1584 } |
1585 } | 1585 } |
1586 | 1586 |
1587 | 1587 |
1588 #undef UNSUPPORTED | 1588 #undef UNSUPPORTED |
1589 | 1589 |
1590 } // namespace disasm | 1590 } // namespace disasm |
1591 | 1591 |
1592 #endif // V8_TARGET_ARCH_MIPS64 | 1592 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |