OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1688 } | 1688 } |
1689 default: | 1689 default: |
1690 Unknown(instr); // Not used by V8. | 1690 Unknown(instr); // Not used by V8. |
1691 } | 1691 } |
1692 } else { | 1692 } else { |
1693 Unknown(instr); // Not used by V8. | 1693 Unknown(instr); // Not used by V8. |
1694 } | 1694 } |
1695 } | 1695 } |
1696 | 1696 |
1697 | 1697 |
| 1698 static const char* const barrier_option_names[] = { |
| 1699 "invalid", "oshld", "oshst", "osh", "invalid", "nshld", "nshst", "nsh", |
| 1700 "invalid", "ishld", "ishst", "ish", "invalid", "ld", "st", "sy", |
| 1701 }; |
| 1702 |
| 1703 |
1698 void Decoder::DecodeSpecialCondition(Instruction* instr) { | 1704 void Decoder::DecodeSpecialCondition(Instruction* instr) { |
1699 switch (instr->SpecialValue()) { | 1705 switch (instr->SpecialValue()) { |
1700 case 5: | 1706 case 5: |
1701 if ((instr->Bits(18, 16) == 0) && (instr->Bits(11, 6) == 0x28) && | 1707 if ((instr->Bits(18, 16) == 0) && (instr->Bits(11, 6) == 0x28) && |
1702 (instr->Bit(4) == 1)) { | 1708 (instr->Bit(4) == 1)) { |
1703 // vmovl signed | 1709 // vmovl signed |
1704 if ((instr->VdValue() & 1) != 0) Unknown(instr); | 1710 if ((instr->VdValue() & 1) != 0) Unknown(instr); |
1705 int Vd = (instr->Bit(22) << 3) | (instr->VdValue() >> 1); | 1711 int Vd = (instr->Bit(22) << 3) | (instr->VdValue() >> 1); |
1706 int Vm = (instr->Bit(5) << 4) | instr->VmValue(); | 1712 int Vm = (instr->Bit(5) << 4) | instr->VmValue(); |
1707 int imm3 = instr->Bits(21, 19); | 1713 int imm3 = instr->Bits(21, 19); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1764 if (offset == 0) { | 1770 if (offset == 0) { |
1765 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, | 1771 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, |
1766 "pld [r%d]", Rn); | 1772 "pld [r%d]", Rn); |
1767 } else if (instr->Bit(23) == 0) { | 1773 } else if (instr->Bit(23) == 0) { |
1768 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, | 1774 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, |
1769 "pld [r%d, #-%d]", Rn, offset); | 1775 "pld [r%d, #-%d]", Rn, offset); |
1770 } else { | 1776 } else { |
1771 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, | 1777 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, |
1772 "pld [r%d, #+%d]", Rn, offset); | 1778 "pld [r%d, #+%d]", Rn, offset); |
1773 } | 1779 } |
| 1780 } else if (instr->SpecialValue() == 0xA && instr->Bits(22, 20) == 7) { |
| 1781 int option = instr->Bits(3, 0); |
| 1782 switch (instr->Bits(7, 4)) { |
| 1783 case 4: |
| 1784 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, |
| 1785 "dsb %s", barrier_option_names[option]); |
| 1786 break; |
| 1787 case 5: |
| 1788 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, |
| 1789 "dmb %s", barrier_option_names[option]); |
| 1790 break; |
| 1791 case 6: |
| 1792 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, |
| 1793 "isb %s", barrier_option_names[option]); |
| 1794 break; |
| 1795 default: |
| 1796 Unknown(instr); |
| 1797 } |
1774 } else { | 1798 } else { |
1775 Unknown(instr); | 1799 Unknown(instr); |
1776 } | 1800 } |
1777 break; | 1801 break; |
1778 case 0x1D: | 1802 case 0x1D: |
1779 if (instr->Opc1Value() == 0x7 && instr->Bits(19, 18) == 0x2 && | 1803 if (instr->Opc1Value() == 0x7 && instr->Bits(19, 18) == 0x2 && |
1780 instr->Bits(11, 9) == 0x5 && instr->Bits(7, 6) == 0x1 && | 1804 instr->Bits(11, 9) == 0x5 && instr->Bits(7, 6) == 0x1 && |
1781 instr->Bit(4) == 0x0) { | 1805 instr->Bit(4) == 0x0) { |
1782 // VRINTA, VRINTN, VRINTP, VRINTM (floating-point) | 1806 // VRINTA, VRINTN, VRINTP, VRINTM (floating-point) |
1783 bool dp_operation = (instr->SzValue() == 1); | 1807 bool dp_operation = (instr->SzValue() == 1); |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1984 v8::internal::PrintF( | 2008 v8::internal::PrintF( |
1985 f, "%p %08x %s\n", | 2009 f, "%p %08x %s\n", |
1986 prev_pc, *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); | 2010 prev_pc, *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); |
1987 } | 2011 } |
1988 } | 2012 } |
1989 | 2013 |
1990 | 2014 |
1991 } // namespace disasm | 2015 } // namespace disasm |
1992 | 2016 |
1993 #endif // V8_TARGET_ARCH_ARM | 2017 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |