Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 442 } else if ((format[3] == '1') && (format[4] == '6')) { | 442 } else if ((format[3] == '1') && (format[4] == '6')) { |
| 443 ASSERT(STRING_STARTS_WITH(format, "off16to20")); | 443 ASSERT(STRING_STARTS_WITH(format, "off16to20")); |
| 444 out_buffer_pos_ += v8i::OS::SNPrintF(out_buffer_ + out_buffer_pos_, | 444 out_buffer_pos_ += v8i::OS::SNPrintF(out_buffer_ + out_buffer_pos_, |
| 445 "%d", instr->Bits(20, 16) +1); | 445 "%d", instr->Bits(20, 16) +1); |
| 446 return 9; | 446 return 9; |
| 447 } else if (format[3] == '7') { | 447 } else if (format[3] == '7') { |
| 448 ASSERT(STRING_STARTS_WITH(format, "off7to11")); | 448 ASSERT(STRING_STARTS_WITH(format, "off7to11")); |
| 449 out_buffer_pos_ += v8i::OS::SNPrintF(out_buffer_ + out_buffer_pos_, | 449 out_buffer_pos_ += v8i::OS::SNPrintF(out_buffer_ + out_buffer_pos_, |
| 450 "%d", instr->ShiftAmountField()); | 450 "%d", instr->ShiftAmountField()); |
| 451 return 8; | 451 return 8; |
| 452 } else if (format[3] == '0') { | |
| 453 // 'off0to3and8to19 16-bit immediate encoded in bits 19-8 and 3-0. | |
| 454 ASSERT(STRING_STARTS_WITH(format, "off0to3and8to19")); | |
| 455 out_buffer_pos_ += v8i::OS::SNPrintF(out_buffer_ + out_buffer_pos_, | |
| 456 "%d", | |
| 457 (instr->Bits(19, 8) << 4) + | |
| 458 instr->Bits(3, 0)); | |
| 459 return 15; | |
| 452 } | 460 } |
| 453 // 'off8: 8-bit offset for extra load and store instructions | 461 // 'off8: 8-bit offset for extra load and store instructions |
| 454 ASSERT(STRING_STARTS_WITH(format, "off8")); | 462 ASSERT(STRING_STARTS_WITH(format, "off8")); |
| 455 int offs8 = (instr->ImmedHField() << 4) | instr->ImmedLField(); | 463 int offs8 = (instr->ImmedHField() << 4) | instr->ImmedLField(); |
| 456 out_buffer_pos_ += v8i::OS::SNPrintF(out_buffer_ + out_buffer_pos_, | 464 out_buffer_pos_ += v8i::OS::SNPrintF(out_buffer_ + out_buffer_pos_, |
| 457 "%d", offs8); | 465 "%d", offs8); |
| 458 return 4; | 466 return 4; |
| 459 } | 467 } |
| 460 case 'p': { // 'pu: P and U bits for load and store instructions | 468 case 'p': { // 'pu: P and U bits for load and store instructions |
| 461 ASSERT(STRING_STARTS_WITH(format, "pu")); | 469 ASSERT(STRING_STARTS_WITH(format, "pu")); |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 643 break; | 651 break; |
| 644 } | 652 } |
| 645 default: { | 653 default: { |
| 646 // The PU field is a 2-bit field. | 654 // The PU field is a 2-bit field. |
| 647 UNREACHABLE(); | 655 UNREACHABLE(); |
| 648 break; | 656 break; |
| 649 } | 657 } |
| 650 } | 658 } |
| 651 return; | 659 return; |
| 652 } | 660 } |
| 661 } else if ((type == 0) && instr->IsMiscType0()) { | |
|
Erik Corry
2010/04/08 12:56:30
This is a little strange to me, but if it matches
Søren Thygesen Gjesse
2010/04/08 13:29:06
Section A5.2 in ARM® Architecture Reference Manual
| |
| 662 if (instr->Bits(22, 21) == 1) { | |
| 663 switch (instr->Bits(7, 4)) { | |
| 664 case BX: | |
| 665 Format(instr, "bx'cond 'rm"); | |
| 666 break; | |
| 667 case BLX: | |
| 668 Format(instr, "blx'cond 'rm"); | |
| 669 break; | |
| 670 case BKPT: | |
| 671 Format(instr, "bkpt 'off0to3and8to19"); | |
| 672 break; | |
| 673 default: | |
| 674 Unknown(instr); // not used by V8 | |
| 675 break; | |
| 676 } | |
| 677 } else if (instr->Bits(22, 21) == 3) { | |
| 678 switch (instr->Bits(7, 4)) { | |
| 679 case CLZ: | |
| 680 Format(instr, "clz'cond 'rd, 'rm"); | |
| 681 break; | |
| 682 default: | |
| 683 Unknown(instr); // not used by V8 | |
| 684 break; | |
| 685 } | |
| 686 } else { | |
| 687 Unknown(instr); // not used by V8 | |
| 688 } | |
| 653 } else { | 689 } else { |
| 654 switch (instr->OpcodeField()) { | 690 switch (instr->OpcodeField()) { |
| 655 case AND: { | 691 case AND: { |
| 656 Format(instr, "and'cond's 'rd, 'rn, 'shift_op"); | 692 Format(instr, "and'cond's 'rd, 'rn, 'shift_op"); |
| 657 break; | 693 break; |
| 658 } | 694 } |
| 659 case EOR: { | 695 case EOR: { |
| 660 Format(instr, "eor'cond's 'rd, 'rn, 'shift_op"); | 696 Format(instr, "eor'cond's 'rd, 'rn, 'shift_op"); |
| 661 break; | 697 break; |
| 662 } | 698 } |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 689 Format(instr, "tst'cond 'rn, 'shift_op"); | 725 Format(instr, "tst'cond 'rn, 'shift_op"); |
| 690 } else { | 726 } else { |
| 691 Unknown(instr); // not used by V8 | 727 Unknown(instr); // not used by V8 |
| 692 } | 728 } |
| 693 break; | 729 break; |
| 694 } | 730 } |
| 695 case TEQ: { | 731 case TEQ: { |
| 696 if (instr->HasS()) { | 732 if (instr->HasS()) { |
| 697 Format(instr, "teq'cond 'rn, 'shift_op"); | 733 Format(instr, "teq'cond 'rn, 'shift_op"); |
| 698 } else { | 734 } else { |
| 699 switch (instr->Bits(7, 4)) { | 735 Unknown(instr); // not used by V8 |
|
Erik Corry
2010/04/08 12:56:30
UNREACHABLE(); // Handled by IsMiscType0 code abo
Søren Thygesen Gjesse
2010/04/08 13:29:06
Done.
| |
| 700 case BX: | |
| 701 Format(instr, "bx'cond 'rm"); | |
| 702 break; | |
| 703 case BLX: | |
| 704 Format(instr, "blx'cond 'rm"); | |
| 705 break; | |
| 706 default: | |
| 707 Unknown(instr); // not used by V8 | |
| 708 break; | |
| 709 } | |
| 710 } | 736 } |
| 711 break; | 737 break; |
| 712 } | 738 } |
| 713 case CMP: { | 739 case CMP: { |
| 714 if (instr->HasS()) { | 740 if (instr->HasS()) { |
| 715 Format(instr, "cmp'cond 'rn, 'shift_op"); | 741 Format(instr, "cmp'cond 'rn, 'shift_op"); |
| 716 } else { | 742 } else { |
| 717 Unknown(instr); // not used by V8 | 743 Unknown(instr); // not used by V8 |
| 718 } | 744 } |
| 719 break; | 745 break; |
| 720 } | 746 } |
| 721 case CMN: { | 747 case CMN: { |
| 722 if (instr->HasS()) { | 748 if (instr->HasS()) { |
| 723 Format(instr, "cmn'cond 'rn, 'shift_op"); | 749 Format(instr, "cmn'cond 'rn, 'shift_op"); |
| 724 } else { | 750 } else { |
| 725 switch (instr->Bits(7, 4)) { | 751 Unknown(instr); // not used by V8 |
|
Erik Corry
2010/04/08 12:56:30
And here.
Søren Thygesen Gjesse
2010/04/08 13:29:06
Done.
| |
| 726 case CLZ: | |
| 727 Format(instr, "clz'cond 'rd, 'rm"); | |
| 728 break; | |
| 729 default: | |
| 730 Unknown(instr); // not used by V8 | |
| 731 break; | |
| 732 } | |
| 733 } | 752 } |
| 734 break; | 753 break; |
| 735 } | 754 } |
| 736 case ORR: { | 755 case ORR: { |
| 737 Format(instr, "orr'cond's 'rd, 'rn, 'shift_op"); | 756 Format(instr, "orr'cond's 'rd, 'rn, 'shift_op"); |
| 738 break; | 757 break; |
| 739 } | 758 } |
| 740 case MOV: { | 759 case MOV: { |
| 741 Format(instr, "mov'cond's 'rd, 'shift_op"); | 760 Format(instr, "mov'cond's 'rd, 'shift_op"); |
| 742 break; | 761 break; |
| (...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1280 buffer[0] = '\0'; | 1299 buffer[0] = '\0'; |
| 1281 byte* prev_pc = pc; | 1300 byte* prev_pc = pc; |
| 1282 pc += d.InstructionDecode(buffer, pc); | 1301 pc += d.InstructionDecode(buffer, pc); |
| 1283 fprintf(f, "%p %08x %s\n", | 1302 fprintf(f, "%p %08x %s\n", |
| 1284 prev_pc, *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); | 1303 prev_pc, *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); |
| 1285 } | 1304 } |
| 1286 } | 1305 } |
| 1287 | 1306 |
| 1288 | 1307 |
| 1289 } // namespace disasm | 1308 } // namespace disasm |
| OLD | NEW |