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 #if V8_TARGET_ARCH_X64 | 9 #if V8_TARGET_ARCH_X64 |
10 | 10 |
(...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
987 case 0x2a: | 987 case 0x2a: |
988 AppendToBuffer("%s %s,%s,", vex_w() ? "vcvtqsi2ss" : "vcvtlsi2ss", | 988 AppendToBuffer("%s %s,%s,", vex_w() ? "vcvtqsi2ss" : "vcvtlsi2ss", |
989 NameOfXMMRegister(regop), NameOfXMMRegister(vvvv)); | 989 NameOfXMMRegister(regop), NameOfXMMRegister(vvvv)); |
990 current += PrintRightOperand(current); | 990 current += PrintRightOperand(current); |
991 break; | 991 break; |
992 case 0x2c: | 992 case 0x2c: |
993 AppendToBuffer("vcvttss2si%s %s,", vex_w() ? "q" : "", | 993 AppendToBuffer("vcvttss2si%s %s,", vex_w() ? "q" : "", |
994 NameOfCPURegister(regop)); | 994 NameOfCPURegister(regop)); |
995 current += PrintRightXMMOperand(current); | 995 current += PrintRightXMMOperand(current); |
996 break; | 996 break; |
997 case 0x2d: | |
998 AppendToBuffer("vcvtss2si%s %s,", vex_w() ? "q" : "", | |
999 NameOfCPURegister(regop)); | |
1000 current += PrintRightXMMOperand(current); | |
1001 break; | |
1002 case 0x58: | 997 case 0x58: |
1003 AppendToBuffer("vaddss %s,%s,", NameOfXMMRegister(regop), | 998 AppendToBuffer("vaddss %s,%s,", NameOfXMMRegister(regop), |
1004 NameOfXMMRegister(vvvv)); | 999 NameOfXMMRegister(vvvv)); |
1005 current += PrintRightXMMOperand(current); | 1000 current += PrintRightXMMOperand(current); |
1006 break; | 1001 break; |
1007 case 0x59: | 1002 case 0x59: |
1008 AppendToBuffer("vmulss %s,%s,", NameOfXMMRegister(regop), | 1003 AppendToBuffer("vmulss %s,%s,", NameOfXMMRegister(regop), |
1009 NameOfXMMRegister(vvvv)); | 1004 NameOfXMMRegister(vvvv)); |
1010 current += PrintRightXMMOperand(current); | 1005 current += PrintRightXMMOperand(current); |
1011 break; | 1006 break; |
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1709 AppendToBuffer("%s %s,", mnemonic, NameOfXMMRegister(regop)); | 1704 AppendToBuffer("%s %s,", mnemonic, NameOfXMMRegister(regop)); |
1710 current += PrintRightOperand(current); | 1705 current += PrintRightOperand(current); |
1711 } else if (opcode == 0x2C) { | 1706 } else if (opcode == 0x2C) { |
1712 // CVTTSS2SI: | 1707 // CVTTSS2SI: |
1713 // Convert with truncation scalar single-precision FP to dword integer. | 1708 // Convert with truncation scalar single-precision FP to dword integer. |
1714 int mod, regop, rm; | 1709 int mod, regop, rm; |
1715 get_modrm(*current, &mod, ®op, &rm); | 1710 get_modrm(*current, &mod, ®op, &rm); |
1716 AppendToBuffer("cvttss2si%c %s,", | 1711 AppendToBuffer("cvttss2si%c %s,", |
1717 operand_size_code(), NameOfCPURegister(regop)); | 1712 operand_size_code(), NameOfCPURegister(regop)); |
1718 current += PrintRightXMMOperand(current); | 1713 current += PrintRightXMMOperand(current); |
1719 } else if (opcode == 0x2D) { | |
1720 // CVTSS2SI: | |
1721 // Convert with rounded scalar single-precision FP to dword integer. | |
1722 int mod, regop, rm; | |
1723 get_modrm(*current, &mod, ®op, &rm); | |
1724 AppendToBuffer("cvtss2si%c %s,", operand_size_code(), | |
1725 NameOfCPURegister(regop)); | |
1726 current += PrintRightXMMOperand(current); | |
1727 } else if (opcode == 0x7E) { | 1714 } else if (opcode == 0x7E) { |
1728 int mod, regop, rm; | 1715 int mod, regop, rm; |
1729 get_modrm(*current, &mod, ®op, &rm); | 1716 get_modrm(*current, &mod, ®op, &rm); |
1730 AppendToBuffer("movq %s,", NameOfXMMRegister(regop)); | 1717 AppendToBuffer("movq %s,", NameOfXMMRegister(regop)); |
1731 current += PrintRightXMMOperand(current); | 1718 current += PrintRightXMMOperand(current); |
1732 } else if ((opcode & 0xF8) == 0x58 || opcode == 0x51) { | 1719 } else if ((opcode & 0xF8) == 0x58 || opcode == 0x51) { |
1733 // XMM arithmetic. Mnemonic was retrieved at the start of this function. | 1720 // XMM arithmetic. Mnemonic was retrieved at the start of this function. |
1734 int mod, regop, rm; | 1721 int mod, regop, rm; |
1735 get_modrm(*current, &mod, ®op, &rm); | 1722 get_modrm(*current, &mod, ®op, &rm); |
1736 AppendToBuffer("%s %s,", mnemonic, NameOfXMMRegister(regop)); | 1723 AppendToBuffer("%s %s,", mnemonic, NameOfXMMRegister(regop)); |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1877 } | 1864 } |
1878 } else if (opcode == 0xB8 || opcode == 0xBC || opcode == 0xBD) { | 1865 } else if (opcode == 0xB8 || opcode == 0xBC || opcode == 0xBD) { |
1879 // POPCNT, CTZ, CLZ. | 1866 // POPCNT, CTZ, CLZ. |
1880 AppendToBuffer("%s%c ", mnemonic, operand_size_code()); | 1867 AppendToBuffer("%s%c ", mnemonic, operand_size_code()); |
1881 int mod, regop, rm; | 1868 int mod, regop, rm; |
1882 get_modrm(*current, &mod, ®op, &rm); | 1869 get_modrm(*current, &mod, ®op, &rm); |
1883 AppendToBuffer("%s,", NameOfCPURegister(regop)); | 1870 AppendToBuffer("%s,", NameOfCPURegister(regop)); |
1884 current += PrintRightOperand(current); | 1871 current += PrintRightOperand(current); |
1885 } else if (opcode == 0x0B) { | 1872 } else if (opcode == 0x0B) { |
1886 AppendToBuffer("ud2"); | 1873 AppendToBuffer("ud2"); |
1887 } else if (opcode == 0xAE) { | |
1888 byte modrm = *(data + 2); | |
1889 int mod, regop, rm; | |
1890 get_modrm(modrm, &mod, ®op, &rm); | |
1891 regop &= 0x7; // The REX.R bit does not affect the operation. | |
1892 const char* mnem = NULL; | |
1893 switch (regop) { | |
1894 case 2: | |
1895 mnem = "ldmxcsr"; | |
1896 break; | |
1897 case 3: | |
1898 mnem = "stmxcsr"; | |
1899 break; | |
1900 default: | |
1901 UnimplementedInstruction(); | |
1902 return 2; | |
1903 } | |
1904 DCHECK_NOT_NULL(mnem); | |
1905 AppendToBuffer("%s ", mnem); | |
1906 current += | |
1907 PrintRightOperandHelper(current, &DisassemblerX64::NameOfCPURegister); | |
1908 } else { | 1874 } else { |
1909 UnimplementedInstruction(); | 1875 UnimplementedInstruction(); |
1910 } | 1876 } |
1911 return static_cast<int>(current - data); | 1877 return static_cast<int>(current - data); |
1912 } | 1878 } |
1913 | 1879 |
1914 | 1880 |
1915 // Mnemonics for two-byte opcode instructions starting with 0x0F. | 1881 // Mnemonics for two-byte opcode instructions starting with 0x0F. |
1916 // The argument is the second byte of the two-byte opcode. | 1882 // The argument is the second byte of the two-byte opcode. |
1917 // Returns NULL if the instruction is not handled here. | 1883 // Returns NULL if the instruction is not handled here. |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2524 for (int i = 6 - static_cast<int>(pc - prev_pc); i >= 0; i--) { | 2490 for (int i = 6 - static_cast<int>(pc - prev_pc); i >= 0; i--) { |
2525 fprintf(f, " "); | 2491 fprintf(f, " "); |
2526 } | 2492 } |
2527 fprintf(f, " %s\n", buffer.start()); | 2493 fprintf(f, " %s\n", buffer.start()); |
2528 } | 2494 } |
2529 } | 2495 } |
2530 | 2496 |
2531 } // namespace disasm | 2497 } // namespace disasm |
2532 | 2498 |
2533 #endif // V8_TARGET_ARCH_X64 | 2499 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |