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 #include <assert.h> | 5 #include <assert.h> |
6 #include <stdarg.h> | 6 #include <stdarg.h> |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include "src/v8.h" | 9 #include "src/v8.h" |
10 | 10 |
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
837 current += PrintRightXMMOperand(current); | 837 current += PrintRightXMMOperand(current); |
838 break; | 838 break; |
839 case 0x5f: | 839 case 0x5f: |
840 AppendToBuffer("vmaxsd %s,%s,", NameOfXMMRegister(regop), | 840 AppendToBuffer("vmaxsd %s,%s,", NameOfXMMRegister(regop), |
841 NameOfXMMRegister(vvvv)); | 841 NameOfXMMRegister(vvvv)); |
842 current += PrintRightXMMOperand(current); | 842 current += PrintRightXMMOperand(current); |
843 break; | 843 break; |
844 default: | 844 default: |
845 UnimplementedInstruction(); | 845 UnimplementedInstruction(); |
846 } | 846 } |
| 847 } else if (vex_f3() && vex_0f()) { |
| 848 int mod, regop, rm, vvvv = vex_vreg(); |
| 849 get_modrm(*current, &mod, ®op, &rm); |
| 850 switch (opcode) { |
| 851 case 0x58: |
| 852 AppendToBuffer("vaddss %s,%s,", NameOfXMMRegister(regop), |
| 853 NameOfXMMRegister(vvvv)); |
| 854 current += PrintRightXMMOperand(current); |
| 855 break; |
| 856 case 0x59: |
| 857 AppendToBuffer("vmulss %s,%s,", NameOfXMMRegister(regop), |
| 858 NameOfXMMRegister(vvvv)); |
| 859 current += PrintRightXMMOperand(current); |
| 860 break; |
| 861 case 0x5c: |
| 862 AppendToBuffer("vsubss %s,%s,", NameOfXMMRegister(regop), |
| 863 NameOfXMMRegister(vvvv)); |
| 864 current += PrintRightXMMOperand(current); |
| 865 break; |
| 866 case 0x5d: |
| 867 AppendToBuffer("vminss %s,%s,", NameOfXMMRegister(regop), |
| 868 NameOfXMMRegister(vvvv)); |
| 869 current += PrintRightXMMOperand(current); |
| 870 break; |
| 871 case 0x5e: |
| 872 AppendToBuffer("vdivss %s,%s,", NameOfXMMRegister(regop), |
| 873 NameOfXMMRegister(vvvv)); |
| 874 current += PrintRightXMMOperand(current); |
| 875 break; |
| 876 case 0x5f: |
| 877 AppendToBuffer("vmaxss %s,%s,", NameOfXMMRegister(regop), |
| 878 NameOfXMMRegister(vvvv)); |
| 879 current += PrintRightXMMOperand(current); |
| 880 break; |
| 881 default: |
| 882 UnimplementedInstruction(); |
| 883 } |
847 } else { | 884 } else { |
848 UnimplementedInstruction(); | 885 UnimplementedInstruction(); |
849 } | 886 } |
850 | 887 |
851 return static_cast<int>(current - data); | 888 return static_cast<int>(current - data); |
852 } | 889 } |
853 | 890 |
854 | 891 |
855 // Returns number of bytes used, including *data. | 892 // Returns number of bytes used, including *data. |
856 int DisassemblerIA32::FPUInstruction(byte* data) { | 893 int DisassemblerIA32::FPUInstruction(byte* data) { |
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1754 data += PrintRightXMMOperand(data); | 1791 data += PrintRightXMMOperand(data); |
1755 } else if (b2 == 0x5A) { | 1792 } else if (b2 == 0x5A) { |
1756 data += 3; | 1793 data += 3; |
1757 int mod, regop, rm; | 1794 int mod, regop, rm; |
1758 get_modrm(*data, &mod, ®op, &rm); | 1795 get_modrm(*data, &mod, ®op, &rm); |
1759 AppendToBuffer("cvtsd2ss %s,", NameOfXMMRegister(regop)); | 1796 AppendToBuffer("cvtsd2ss %s,", NameOfXMMRegister(regop)); |
1760 data += PrintRightXMMOperand(data); | 1797 data += PrintRightXMMOperand(data); |
1761 } else { | 1798 } else { |
1762 const char* mnem = "?"; | 1799 const char* mnem = "?"; |
1763 switch (b2) { | 1800 switch (b2) { |
1764 case 0x2A: mnem = "cvtsi2sd"; break; | 1801 case 0x2A: |
1765 case 0x2C: mnem = "cvttsd2si"; break; | 1802 mnem = "cvtsi2sd"; |
1766 case 0x2D: mnem = "cvtsd2si"; break; | 1803 break; |
1767 case 0x51: mnem = "sqrtsd"; break; | 1804 case 0x2C: |
1768 case 0x58: mnem = "addsd"; break; | 1805 mnem = "cvttsd2si"; |
1769 case 0x59: mnem = "mulsd"; break; | 1806 break; |
1770 case 0x5C: mnem = "subsd"; break; | 1807 case 0x2D: |
| 1808 mnem = "cvtsd2si"; |
| 1809 break; |
| 1810 case 0x51: |
| 1811 mnem = "sqrtsd"; |
| 1812 break; |
| 1813 case 0x58: |
| 1814 mnem = "addsd"; |
| 1815 break; |
| 1816 case 0x59: |
| 1817 mnem = "mulsd"; |
| 1818 break; |
| 1819 case 0x5C: |
| 1820 mnem = "subsd"; |
| 1821 break; |
1771 case 0x5D: | 1822 case 0x5D: |
1772 mnem = "minsd"; | 1823 mnem = "minsd"; |
1773 break; | 1824 break; |
1774 case 0x5E: mnem = "divsd"; break; | 1825 case 0x5E: |
| 1826 mnem = "divsd"; |
| 1827 break; |
1775 case 0x5F: | 1828 case 0x5F: |
1776 mnem = "maxsd"; | 1829 mnem = "maxsd"; |
1777 break; | 1830 break; |
1778 } | 1831 } |
1779 data += 3; | 1832 data += 3; |
1780 int mod, regop, rm; | 1833 int mod, regop, rm; |
1781 get_modrm(*data, &mod, ®op, &rm); | 1834 get_modrm(*data, &mod, ®op, &rm); |
1782 if (b2 == 0x2A) { | 1835 if (b2 == 0x2A) { |
1783 AppendToBuffer("%s %s,", mnem, NameOfXMMRegister(regop)); | 1836 AppendToBuffer("%s %s,", mnem, NameOfXMMRegister(regop)); |
1784 data += PrintRightOperand(data); | 1837 data += PrintRightOperand(data); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1821 int mod, regop, rm; | 1874 int mod, regop, rm; |
1822 get_modrm(*data, &mod, ®op, &rm); | 1875 get_modrm(*data, &mod, ®op, &rm); |
1823 data += PrintRightXMMOperand(data); | 1876 data += PrintRightXMMOperand(data); |
1824 AppendToBuffer(",%s", NameOfXMMRegister(regop)); | 1877 AppendToBuffer(",%s", NameOfXMMRegister(regop)); |
1825 } else if (b2 == 0x10) { | 1878 } else if (b2 == 0x10) { |
1826 data += 3; | 1879 data += 3; |
1827 int mod, regop, rm; | 1880 int mod, regop, rm; |
1828 get_modrm(*data, &mod, ®op, &rm); | 1881 get_modrm(*data, &mod, ®op, &rm); |
1829 AppendToBuffer("movss %s,", NameOfXMMRegister(regop)); | 1882 AppendToBuffer("movss %s,", NameOfXMMRegister(regop)); |
1830 data += PrintRightXMMOperand(data); | 1883 data += PrintRightXMMOperand(data); |
1831 } else if (b2 == 0x2C) { | |
1832 data += 3; | |
1833 int mod, regop, rm; | |
1834 get_modrm(*data, &mod, ®op, &rm); | |
1835 AppendToBuffer("cvttss2si %s,", NameOfCPURegister(regop)); | |
1836 data += PrintRightXMMOperand(data); | |
1837 } else if (b2 == 0x58) { | |
1838 data += 3; | |
1839 int mod, regop, rm; | |
1840 get_modrm(*data, &mod, ®op, &rm); | |
1841 AppendToBuffer("addss %s,", NameOfXMMRegister(regop)); | |
1842 data += PrintRightXMMOperand(data); | |
1843 } else if (b2 == 0x59) { | |
1844 data += 3; | |
1845 int mod, regop, rm; | |
1846 get_modrm(*data, &mod, ®op, &rm); | |
1847 AppendToBuffer("mulss %s,", NameOfXMMRegister(regop)); | |
1848 data += PrintRightXMMOperand(data); | |
1849 } else if (b2 == 0x5A) { | 1884 } else if (b2 == 0x5A) { |
1850 data += 3; | 1885 data += 3; |
1851 int mod, regop, rm; | 1886 int mod, regop, rm; |
1852 get_modrm(*data, &mod, ®op, &rm); | 1887 get_modrm(*data, &mod, ®op, &rm); |
1853 AppendToBuffer("cvtss2sd %s,", NameOfXMMRegister(regop)); | 1888 AppendToBuffer("cvtss2sd %s,", NameOfXMMRegister(regop)); |
1854 data += PrintRightXMMOperand(data); | 1889 data += PrintRightXMMOperand(data); |
1855 } else if (b2 == 0x5c) { | |
1856 data += 3; | |
1857 int mod, regop, rm; | |
1858 get_modrm(*data, &mod, ®op, &rm); | |
1859 AppendToBuffer("subss %s,", NameOfXMMRegister(regop)); | |
1860 data += PrintRightXMMOperand(data); | |
1861 } else if (b2 == 0x5e) { | |
1862 data += 3; | |
1863 int mod, regop, rm; | |
1864 get_modrm(*data, &mod, ®op, &rm); | |
1865 AppendToBuffer("divss %s,", NameOfXMMRegister(regop)); | |
1866 data += PrintRightXMMOperand(data); | |
1867 } else if (b2 == 0x6F) { | 1890 } else if (b2 == 0x6F) { |
1868 data += 3; | 1891 data += 3; |
1869 int mod, regop, rm; | 1892 int mod, regop, rm; |
1870 get_modrm(*data, &mod, ®op, &rm); | 1893 get_modrm(*data, &mod, ®op, &rm); |
1871 AppendToBuffer("movdqu %s,", NameOfXMMRegister(regop)); | 1894 AppendToBuffer("movdqu %s,", NameOfXMMRegister(regop)); |
1872 data += PrintRightXMMOperand(data); | 1895 data += PrintRightXMMOperand(data); |
1873 } else if (b2 == 0x7F) { | 1896 } else if (b2 == 0x7F) { |
1874 AppendToBuffer("movdqu "); | 1897 AppendToBuffer("movdqu "); |
1875 data += 3; | 1898 data += 3; |
1876 int mod, regop, rm; | 1899 int mod, regop, rm; |
1877 get_modrm(*data, &mod, ®op, &rm); | 1900 get_modrm(*data, &mod, ®op, &rm); |
1878 data += PrintRightXMMOperand(data); | 1901 data += PrintRightXMMOperand(data); |
1879 AppendToBuffer(",%s", NameOfXMMRegister(regop)); | 1902 AppendToBuffer(",%s", NameOfXMMRegister(regop)); |
1880 } else { | 1903 } else { |
1881 UnimplementedInstruction(); | 1904 const char* mnem = "?"; |
| 1905 switch (b2) { |
| 1906 case 0x2A: |
| 1907 mnem = "cvtsi2ss"; |
| 1908 break; |
| 1909 case 0x2C: |
| 1910 mnem = "cvttss2si"; |
| 1911 break; |
| 1912 case 0x2D: |
| 1913 mnem = "cvtss2si"; |
| 1914 break; |
| 1915 case 0x51: |
| 1916 mnem = "sqrtss"; |
| 1917 break; |
| 1918 case 0x58: |
| 1919 mnem = "addss"; |
| 1920 break; |
| 1921 case 0x59: |
| 1922 mnem = "mulss"; |
| 1923 break; |
| 1924 case 0x5C: |
| 1925 mnem = "subss"; |
| 1926 break; |
| 1927 case 0x5D: |
| 1928 mnem = "minss"; |
| 1929 break; |
| 1930 case 0x5E: |
| 1931 mnem = "divss"; |
| 1932 break; |
| 1933 case 0x5F: |
| 1934 mnem = "maxss"; |
| 1935 break; |
| 1936 } |
| 1937 data += 3; |
| 1938 int mod, regop, rm; |
| 1939 get_modrm(*data, &mod, ®op, &rm); |
| 1940 if (b2 == 0x2A) { |
| 1941 AppendToBuffer("%s %s,", mnem, NameOfXMMRegister(regop)); |
| 1942 data += PrintRightOperand(data); |
| 1943 } else if (b2 == 0x2C || b2 == 0x2D) { |
| 1944 AppendToBuffer("%s %s,", mnem, NameOfCPURegister(regop)); |
| 1945 data += PrintRightXMMOperand(data); |
| 1946 } else if (b2 == 0xC2) { |
| 1947 // Intel manual 2A, Table 3-18. |
| 1948 const char* const pseudo_op[] = { |
| 1949 "cmpeqss", "cmpltss", "cmpless", "cmpunordss", |
| 1950 "cmpneqss", "cmpnltss", "cmpnless", "cmpordss"}; |
| 1951 AppendToBuffer("%s %s,%s", pseudo_op[data[1]], |
| 1952 NameOfXMMRegister(regop), NameOfXMMRegister(rm)); |
| 1953 data += 2; |
| 1954 } else { |
| 1955 AppendToBuffer("%s %s,", mnem, NameOfXMMRegister(regop)); |
| 1956 data += PrintRightXMMOperand(data); |
| 1957 } |
1882 } | 1958 } |
1883 } else if (*(data+1) == 0xA5) { | 1959 } else if (*(data+1) == 0xA5) { |
1884 data += 2; | 1960 data += 2; |
1885 AppendToBuffer("rep_movs"); | 1961 AppendToBuffer("rep_movs"); |
1886 } else if (*(data+1) == 0xAB) { | 1962 } else if (*(data+1) == 0xAB) { |
1887 data += 2; | 1963 data += 2; |
1888 AppendToBuffer("rep_stos"); | 1964 AppendToBuffer("rep_stos"); |
1889 } else { | 1965 } else { |
1890 UnimplementedInstruction(); | 1966 UnimplementedInstruction(); |
1891 } | 1967 } |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2020 fprintf(f, " "); | 2096 fprintf(f, " "); |
2021 } | 2097 } |
2022 fprintf(f, " %s\n", buffer.start()); | 2098 fprintf(f, " %s\n", buffer.start()); |
2023 } | 2099 } |
2024 } | 2100 } |
2025 | 2101 |
2026 | 2102 |
2027 } // namespace disasm | 2103 } // namespace disasm |
2028 | 2104 |
2029 #endif // V8_TARGET_ARCH_IA32 | 2105 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |