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 1783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1794 | 1794 |
1795 | 1795 |
1796 static const char* const barrier_option_names[] = { | 1796 static const char* const barrier_option_names[] = { |
1797 "invalid", "oshld", "oshst", "osh", "invalid", "nshld", "nshst", "nsh", | 1797 "invalid", "oshld", "oshst", "osh", "invalid", "nshld", "nshst", "nsh", |
1798 "invalid", "ishld", "ishst", "ish", "invalid", "ld", "st", "sy", | 1798 "invalid", "ishld", "ishst", "ish", "invalid", "ld", "st", "sy", |
1799 }; | 1799 }; |
1800 | 1800 |
1801 | 1801 |
1802 void Decoder::DecodeSpecialCondition(Instruction* instr) { | 1802 void Decoder::DecodeSpecialCondition(Instruction* instr) { |
1803 switch (instr->SpecialValue()) { | 1803 switch (instr->SpecialValue()) { |
| 1804 case 4: |
| 1805 if (instr->Bits(21, 20) == 2 && instr->Bits(11, 8) == 1 && |
| 1806 instr->Bit(4) == 1) { |
| 1807 // vmov Qd, Qm |
| 1808 int Vd = instr->VFPDRegValue(kSimd128Precision); |
| 1809 int Vm = instr->VFPMRegValue(kSimd128Precision); |
| 1810 out_buffer_pos_ += |
| 1811 SNPrintF(out_buffer_ + out_buffer_pos_, "vmov q%d, q%d", Vd, Vm); |
| 1812 } else { |
| 1813 Unknown(instr); |
| 1814 } |
| 1815 break; |
1804 case 5: | 1816 case 5: |
1805 if ((instr->Bits(18, 16) == 0) && (instr->Bits(11, 6) == 0x28) && | 1817 if ((instr->Bits(18, 16) == 0) && (instr->Bits(11, 6) == 0x28) && |
1806 (instr->Bit(4) == 1)) { | 1818 (instr->Bit(4) == 1)) { |
1807 // vmovl signed | 1819 // vmovl signed |
1808 if ((instr->VdValue() & 1) != 0) Unknown(instr); | 1820 if ((instr->VdValue() & 1) != 0) Unknown(instr); |
1809 int Vd = (instr->Bit(22) << 3) | (instr->VdValue() >> 1); | 1821 int Vd = (instr->Bit(22) << 3) | (instr->VdValue() >> 1); |
1810 int Vm = (instr->Bit(5) << 4) | instr->VmValue(); | 1822 int Vm = (instr->Bit(5) << 4) | instr->VmValue(); |
1811 int imm3 = instr->Bits(21, 19); | 1823 int imm3 = instr->Bits(21, 19); |
1812 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, | 1824 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, |
1813 "vmovl.s%d q%d, d%d", imm3*8, Vd, Vm); | 1825 "vmovl.s%d q%d, d%d", imm3*8, Vd, Vm); |
1814 } else { | 1826 } else { |
1815 Unknown(instr); | 1827 Unknown(instr); |
1816 } | 1828 } |
1817 break; | 1829 break; |
| 1830 case 6: |
| 1831 if (instr->Bits(21, 20) == 0 && instr->Bits(11, 8) == 1 && |
| 1832 instr->Bit(4) == 1) { |
| 1833 if (instr->Bit(6) == 0) { |
| 1834 // veor Dd, Dn, Dm |
| 1835 int Vd = instr->VFPDRegValue(kDoublePrecision); |
| 1836 int Vn = instr->VFPNRegValue(kDoublePrecision); |
| 1837 int Vm = instr->VFPMRegValue(kDoublePrecision); |
| 1838 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, |
| 1839 "veor d%d, d%d, d%d", Vd, Vn, Vm); |
| 1840 |
| 1841 } else { |
| 1842 // veor Qd, Qn, Qm |
| 1843 int Vd = instr->VFPDRegValue(kSimd128Precision); |
| 1844 int Vn = instr->VFPNRegValue(kSimd128Precision); |
| 1845 int Vm = instr->VFPMRegValue(kSimd128Precision); |
| 1846 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, |
| 1847 "veor q%d, q%d, q%d", Vd, Vn, Vm); |
| 1848 } |
| 1849 } else { |
| 1850 Unknown(instr); |
| 1851 } |
| 1852 break; |
1818 case 7: | 1853 case 7: |
1819 if ((instr->Bits(18, 16) == 0) && (instr->Bits(11, 6) == 0x28) && | 1854 if ((instr->Bits(18, 16) == 0) && (instr->Bits(11, 6) == 0x28) && |
1820 (instr->Bit(4) == 1)) { | 1855 (instr->Bit(4) == 1)) { |
1821 // vmovl unsigned | 1856 // vmovl unsigned |
1822 if ((instr->VdValue() & 1) != 0) Unknown(instr); | 1857 if ((instr->VdValue() & 1) != 0) Unknown(instr); |
1823 int Vd = (instr->Bit(22) << 3) | (instr->VdValue() >> 1); | 1858 int Vd = (instr->Bit(22) << 3) | (instr->VdValue() >> 1); |
1824 int Vm = (instr->Bit(5) << 4) | instr->VmValue(); | 1859 int Vm = (instr->Bit(5) << 4) | instr->VmValue(); |
1825 int imm3 = instr->Bits(21, 19); | 1860 int imm3 = instr->Bits(21, 19); |
1826 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, | 1861 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, |
1827 "vmovl.u%d q%d, d%d", imm3*8, Vd, Vm); | 1862 "vmovl.u%d q%d, d%d", imm3*8, Vd, Vm); |
1828 } else if ((instr->Bits(21, 16) == 0x32) && (instr->Bits(11, 7) == 0) && | 1863 } else if ((instr->Bits(21, 16) == 0x32) && (instr->Bits(11, 7) == 0) && |
1829 (instr->Bit(4) == 0)) { | 1864 (instr->Bit(4) == 0)) { |
1830 int Vd = instr->VFPDRegValue(kDoublePrecision); | 1865 if (instr->Bit(6) == 0) { |
1831 int Vm = instr->VFPMRegValue(kDoublePrecision); | 1866 int Vd = instr->VFPDRegValue(kDoublePrecision); |
1832 char rtype = (instr->Bit(6) == 0) ? 'd' : 'q'; | 1867 int Vm = instr->VFPMRegValue(kDoublePrecision); |
1833 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, | 1868 out_buffer_pos_ += |
1834 "vswp %c%d, %c%d", rtype, Vd, rtype, Vm); | 1869 SNPrintF(out_buffer_ + out_buffer_pos_, "vswp d%d, d%d", Vd, Vm); |
| 1870 } else { |
| 1871 int Vd = instr->VFPDRegValue(kSimd128Precision); |
| 1872 int Vm = instr->VFPMRegValue(kSimd128Precision); |
| 1873 out_buffer_pos_ += |
| 1874 SNPrintF(out_buffer_ + out_buffer_pos_, "vswp q%d, q%d", Vd, Vm); |
| 1875 } |
1835 } else { | 1876 } else { |
1836 Unknown(instr); | 1877 Unknown(instr); |
1837 } | 1878 } |
1838 break; | 1879 break; |
1839 case 8: | 1880 case 8: |
1840 if (instr->Bits(21, 20) == 0) { | 1881 if (instr->Bits(21, 20) == 0) { |
1841 // vst1 | 1882 // vst1 |
1842 int Vd = (instr->Bit(22) << 4) | instr->VdValue(); | 1883 int Vd = (instr->Bit(22) << 4) | instr->VdValue(); |
1843 int Rn = instr->VnValue(); | 1884 int Rn = instr->VnValue(); |
1844 int type = instr->Bits(11, 8); | 1885 int type = instr->Bits(11, 8); |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2170 pc += d.InstructionDecode(buffer, pc); | 2211 pc += d.InstructionDecode(buffer, pc); |
2171 v8::internal::PrintF(f, "%p %08x %s\n", static_cast<void*>(prev_pc), | 2212 v8::internal::PrintF(f, "%p %08x %s\n", static_cast<void*>(prev_pc), |
2172 *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); | 2213 *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); |
2173 } | 2214 } |
2174 } | 2215 } |
2175 | 2216 |
2176 | 2217 |
2177 } // namespace disasm | 2218 } // namespace disasm |
2178 | 2219 |
2179 #endif // V8_TARGET_ARCH_ARM | 2220 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |