| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/disassembler.h" | 5 #include "vm/disassembler.h" |
| 6 | 6 |
| 7 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64. | 7 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64. |
| 8 #if defined(TARGET_ARCH_ARM64) | 8 #if defined(TARGET_ARCH_ARM64) |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 | 10 |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 // consumed by the caller.) FormatOption returns the number of | 368 // consumed by the caller.) FormatOption returns the number of |
| 369 // characters that were consumed from the formatting string. | 369 // characters that were consumed from the formatting string. |
| 370 int ARM64Decoder::FormatOption(Instr* instr, const char* format) { | 370 int ARM64Decoder::FormatOption(Instr* instr, const char* format) { |
| 371 switch (format[0]) { | 371 switch (format[0]) { |
| 372 case 'b': { | 372 case 'b': { |
| 373 if (format[3] == 'i') { | 373 if (format[3] == 'i') { |
| 374 ASSERT(STRING_STARTS_WITH(format, "bitimm")); | 374 ASSERT(STRING_STARTS_WITH(format, "bitimm")); |
| 375 const uint64_t imm = instr->ImmLogical(); | 375 const uint64_t imm = instr->ImmLogical(); |
| 376 buffer_pos_ += OS::SNPrint(current_position_in_buffer(), | 376 buffer_pos_ += OS::SNPrint(current_position_in_buffer(), |
| 377 remaining_size_in_buffer(), | 377 remaining_size_in_buffer(), |
| 378 "0x%"Px64, | 378 "0x%" Px64, |
| 379 imm); | 379 imm); |
| 380 return 6; | 380 return 6; |
| 381 } else { | 381 } else { |
| 382 ASSERT(STRING_STARTS_WITH(format, "bitpos")); | 382 ASSERT(STRING_STARTS_WITH(format, "bitpos")); |
| 383 int bitpos = instr->Bits(19, 4) | (instr->Bit(31) << 5); | 383 int bitpos = instr->Bits(19, 4) | (instr->Bit(31) << 5); |
| 384 buffer_pos_ += OS::SNPrint(current_position_in_buffer(), | 384 buffer_pos_ += OS::SNPrint(current_position_in_buffer(), |
| 385 remaining_size_in_buffer(), | 385 remaining_size_in_buffer(), |
| 386 "#%d", | 386 "#%d", |
| 387 bitpos); | 387 bitpos); |
| 388 return 6; | 388 return 6; |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 Print("Unknown Shift"); | 520 Print("Unknown Shift"); |
| 521 } | 521 } |
| 522 ret = 6; | 522 ret = 6; |
| 523 } | 523 } |
| 524 } else { | 524 } else { |
| 525 ASSERT(STRING_STARTS_WITH(format, "imm16")); | 525 ASSERT(STRING_STARTS_WITH(format, "imm16")); |
| 526 imm = instr->Imm16Field(); | 526 imm = instr->Imm16Field(); |
| 527 } | 527 } |
| 528 buffer_pos_ += OS::SNPrint(current_position_in_buffer(), | 528 buffer_pos_ += OS::SNPrint(current_position_in_buffer(), |
| 529 remaining_size_in_buffer(), | 529 remaining_size_in_buffer(), |
| 530 "0x%"Px64, | 530 "0x%" Px64, |
| 531 imm); | 531 imm); |
| 532 return ret; | 532 return ret; |
| 533 } else { | 533 } else { |
| 534 ASSERT(STRING_STARTS_WITH(format, "immd")); | 534 ASSERT(STRING_STARTS_WITH(format, "immd")); |
| 535 double dimm = bit_cast<double, int64_t>( | 535 double dimm = bit_cast<double, int64_t>( |
| 536 Instr::VFPExpandImm(instr->Imm8Field())); | 536 Instr::VFPExpandImm(instr->Imm8Field())); |
| 537 buffer_pos_ += OS::SNPrint(current_position_in_buffer(), | 537 buffer_pos_ += OS::SNPrint(current_position_in_buffer(), |
| 538 remaining_size_in_buffer(), | 538 remaining_size_in_buffer(), |
| 539 "%f", | 539 "%f", |
| 540 dimm); | 540 dimm); |
| 541 return 4; | 541 return 4; |
| 542 } | 542 } |
| 543 } | 543 } |
| 544 case 'm': { | 544 case 'm': { |
| 545 ASSERT(STRING_STARTS_WITH(format, "memop")); | 545 ASSERT(STRING_STARTS_WITH(format, "memop")); |
| 546 PrintMemOperand(instr); | 546 PrintMemOperand(instr); |
| 547 return 5; | 547 return 5; |
| 548 } | 548 } |
| 549 case 'p': { | 549 case 'p': { |
| 550 if (format[1] == 'c') { | 550 if (format[1] == 'c') { |
| 551 if (format[2] == 'a') { | 551 if (format[2] == 'a') { |
| 552 ASSERT(STRING_STARTS_WITH(format, "pcadr")); | 552 ASSERT(STRING_STARTS_WITH(format, "pcadr")); |
| 553 const int64_t immhi = instr->SImm19Field(); | 553 const int64_t immhi = instr->SImm19Field(); |
| 554 const int64_t immlo = instr->Bits(29, 2); | 554 const int64_t immlo = instr->Bits(29, 2); |
| 555 const int64_t off = (immhi << 2) | immlo; | 555 const int64_t off = (immhi << 2) | immlo; |
| 556 const int64_t pc = reinterpret_cast<int64_t>(instr); | 556 const int64_t pc = reinterpret_cast<int64_t>(instr); |
| 557 const int64_t dest = pc + off; | 557 const int64_t dest = pc + off; |
| 558 buffer_pos_ += OS::SNPrint(current_position_in_buffer(), | 558 buffer_pos_ += OS::SNPrint(current_position_in_buffer(), |
| 559 remaining_size_in_buffer(), | 559 remaining_size_in_buffer(), |
| 560 "0x%"Px64, | 560 "0x%" Px64, |
| 561 dest); | 561 dest); |
| 562 } else { | 562 } else { |
| 563 ASSERT(STRING_STARTS_WITH(format, "pcldr")); | 563 ASSERT(STRING_STARTS_WITH(format, "pcldr")); |
| 564 const int64_t off = instr->SImm19Field() << 2; | 564 const int64_t off = instr->SImm19Field() << 2; |
| 565 const int64_t pc = reinterpret_cast<int64_t>(instr); | 565 const int64_t pc = reinterpret_cast<int64_t>(instr); |
| 566 const int64_t dest = pc + off; | 566 const int64_t dest = pc + off; |
| 567 buffer_pos_ += OS::SNPrint(current_position_in_buffer(), | 567 buffer_pos_ += OS::SNPrint(current_position_in_buffer(), |
| 568 remaining_size_in_buffer(), | 568 remaining_size_in_buffer(), |
| 569 "0x%"Px64, | 569 "0x%" Px64, |
| 570 dest); | 570 dest); |
| 571 } | 571 } |
| 572 return 5; | 572 return 5; |
| 573 } else { | 573 } else { |
| 574 ASSERT(STRING_STARTS_WITH(format, "pmemop")); | 574 ASSERT(STRING_STARTS_WITH(format, "pmemop")); |
| 575 PrintPairMemOperand(instr); | 575 PrintPairMemOperand(instr); |
| 576 return 6; | 576 return 6; |
| 577 } | 577 } |
| 578 } | 578 } |
| 579 case 'r': { | 579 case 'r': { |
| (...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1434 int32_t instruction_bits = Instr::At(pc)->InstructionBits(); | 1434 int32_t instruction_bits = Instr::At(pc)->InstructionBits(); |
| 1435 OS::SNPrint(hex_buffer, hex_size, "%08x", instruction_bits); | 1435 OS::SNPrint(hex_buffer, hex_size, "%08x", instruction_bits); |
| 1436 if (out_instr_size) { | 1436 if (out_instr_size) { |
| 1437 *out_instr_size = Instr::kInstrSize; | 1437 *out_instr_size = Instr::kInstrSize; |
| 1438 } | 1438 } |
| 1439 } | 1439 } |
| 1440 | 1440 |
| 1441 } // namespace dart | 1441 } // namespace dart |
| 1442 | 1442 |
| 1443 #endif // defined TARGET_ARCH_ARM | 1443 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |