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 1671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1682 } | 1682 } |
1683 default: | 1683 default: |
1684 Unknown(instr); // Not used by V8. | 1684 Unknown(instr); // Not used by V8. |
1685 } | 1685 } |
1686 } else { | 1686 } else { |
1687 Unknown(instr); // Not used by V8. | 1687 Unknown(instr); // Not used by V8. |
1688 } | 1688 } |
1689 } | 1689 } |
1690 | 1690 |
1691 | 1691 |
| 1692 static const char* const barrier_option_names[] = { |
| 1693 "invalid", "oshld", "oshst", "osh", "invalid", "nshld", "nshst", "nsh", |
| 1694 "invalid", "ishld", "ishst", "ish", "invalid", "ld", "st", "sy", |
| 1695 }; |
| 1696 |
| 1697 |
1692 void Decoder::DecodeSpecialCondition(Instruction* instr) { | 1698 void Decoder::DecodeSpecialCondition(Instruction* instr) { |
1693 switch (instr->SpecialValue()) { | 1699 switch (instr->SpecialValue()) { |
1694 case 5: | 1700 case 5: |
1695 if ((instr->Bits(18, 16) == 0) && (instr->Bits(11, 6) == 0x28) && | 1701 if ((instr->Bits(18, 16) == 0) && (instr->Bits(11, 6) == 0x28) && |
1696 (instr->Bit(4) == 1)) { | 1702 (instr->Bit(4) == 1)) { |
1697 // vmovl signed | 1703 // vmovl signed |
1698 if ((instr->VdValue() & 1) != 0) Unknown(instr); | 1704 if ((instr->VdValue() & 1) != 0) Unknown(instr); |
1699 int Vd = (instr->Bit(22) << 3) | (instr->VdValue() >> 1); | 1705 int Vd = (instr->Bit(22) << 3) | (instr->VdValue() >> 1); |
1700 int Vm = (instr->Bit(5) << 4) | instr->VmValue(); | 1706 int Vm = (instr->Bit(5) << 4) | instr->VmValue(); |
1701 int imm3 = instr->Bits(21, 19); | 1707 int imm3 = instr->Bits(21, 19); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1758 if (offset == 0) { | 1764 if (offset == 0) { |
1759 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, | 1765 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, |
1760 "pld [r%d]", Rn); | 1766 "pld [r%d]", Rn); |
1761 } else if (instr->Bit(23) == 0) { | 1767 } else if (instr->Bit(23) == 0) { |
1762 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, | 1768 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, |
1763 "pld [r%d, #-%d]", Rn, offset); | 1769 "pld [r%d, #-%d]", Rn, offset); |
1764 } else { | 1770 } else { |
1765 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, | 1771 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, |
1766 "pld [r%d, #+%d]", Rn, offset); | 1772 "pld [r%d, #+%d]", Rn, offset); |
1767 } | 1773 } |
| 1774 } else if (instr->SpecialValue() == 0xA && instr->Bits(22, 20) == 7) { |
| 1775 int option = instr->Bits(3, 0); |
| 1776 switch (instr->Bits(7, 4)) { |
| 1777 case 4: |
| 1778 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, |
| 1779 "dsb %s", barrier_option_names[option]); |
| 1780 break; |
| 1781 case 5: |
| 1782 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, |
| 1783 "dmb %s", barrier_option_names[option]); |
| 1784 break; |
| 1785 case 6: |
| 1786 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, |
| 1787 "isb %s", barrier_option_names[option]); |
| 1788 break; |
| 1789 default: |
| 1790 Unknown(instr); |
| 1791 } |
1768 } else { | 1792 } else { |
1769 Unknown(instr); | 1793 Unknown(instr); |
1770 } | 1794 } |
1771 break; | 1795 break; |
1772 case 0x1D: | 1796 case 0x1D: |
1773 if (instr->Opc1Value() == 0x7 && instr->Bits(19, 18) == 0x2 && | 1797 if (instr->Opc1Value() == 0x7 && instr->Bits(19, 18) == 0x2 && |
1774 instr->Bits(11, 9) == 0x5 && instr->Bits(7, 6) == 0x1 && | 1798 instr->Bits(11, 9) == 0x5 && instr->Bits(7, 6) == 0x1 && |
1775 instr->Bit(4) == 0x0) { | 1799 instr->Bit(4) == 0x0) { |
1776 // VRINTA, VRINTN, VRINTP, VRINTM (floating-point) | 1800 // VRINTA, VRINTN, VRINTP, VRINTM (floating-point) |
1777 bool dp_operation = (instr->SzValue() == 1); | 1801 bool dp_operation = (instr->SzValue() == 1); |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1978 v8::internal::PrintF( | 2002 v8::internal::PrintF( |
1979 f, "%p %08x %s\n", | 2003 f, "%p %08x %s\n", |
1980 prev_pc, *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); | 2004 prev_pc, *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); |
1981 } | 2005 } |
1982 } | 2006 } |
1983 | 2007 |
1984 | 2008 |
1985 } // namespace disasm | 2009 } // namespace disasm |
1986 | 2010 |
1987 #endif // V8_TARGET_ARCH_ARM | 2011 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |