OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1050 current += PrintRightOperand(current); | 1050 current += PrintRightOperand(current); |
1051 AppendToBuffer(",%s", NameOfXMMRegister(regop)); | 1051 AppendToBuffer(",%s", NameOfXMMRegister(regop)); |
1052 } else { | 1052 } else { |
1053 AppendToBuffer("%s,", NameOfXMMRegister(regop)); | 1053 AppendToBuffer("%s,", NameOfXMMRegister(regop)); |
1054 current += PrintRightOperand(current); | 1054 current += PrintRightOperand(current); |
1055 } | 1055 } |
1056 } else if (opcode == 0x2A) { | 1056 } else if (opcode == 0x2A) { |
1057 // CVTSI2SD: integer to XMM double conversion. | 1057 // CVTSI2SD: integer to XMM double conversion. |
1058 int mod, regop, rm; | 1058 int mod, regop, rm; |
1059 get_modrm(*current, &mod, ®op, &rm); | 1059 get_modrm(*current, &mod, ®op, &rm); |
1060 AppendToBuffer("%s %s,", mnemonic, NameOfXMMRegister(regop)); | 1060 AppendToBuffer("%sd %s,", mnemonic, NameOfXMMRegister(regop)); |
1061 current += PrintRightOperand(current); | 1061 current += PrintRightOperand(current); |
1062 } else if ((opcode & 0xF8) == 0x58 || opcode == 0x51) { | 1062 } else if ((opcode & 0xF8) == 0x58 || opcode == 0x51) { |
1063 // XMM arithmetic. Mnemonic was retrieved at the start of this function. | 1063 // XMM arithmetic. Mnemonic was retrieved at the start of this function. |
1064 int mod, regop, rm; | 1064 int mod, regop, rm; |
1065 get_modrm(*current, &mod, ®op, &rm); | 1065 get_modrm(*current, &mod, ®op, &rm); |
1066 AppendToBuffer("%s %s,", mnemonic, NameOfXMMRegister(regop)); | 1066 AppendToBuffer("%s %s,", mnemonic, NameOfXMMRegister(regop)); |
1067 current += PrintRightXMMOperand(current); | 1067 current += PrintRightXMMOperand(current); |
1068 } else { | 1068 } else { |
1069 UnimplementedInstruction(); | 1069 UnimplementedInstruction(); |
1070 } | 1070 } |
1071 } else if (group_1_prefix_ == 0xF3) { | 1071 } else if (group_1_prefix_ == 0xF3) { |
1072 // Instructions with prefix 0xF3. | 1072 // Instructions with prefix 0xF3. |
1073 if (opcode == 0x2C) { | 1073 if (opcode == 0x11 || opcode == 0x10) { |
| 1074 // MOVSS: Move scalar double-precision fp to/from/between XMM registers. |
| 1075 AppendToBuffer("movss "); |
| 1076 int mod, regop, rm; |
| 1077 get_modrm(*current, &mod, ®op, &rm); |
| 1078 if (opcode == 0x11) { |
| 1079 current += PrintRightOperand(current); |
| 1080 AppendToBuffer(",%s", NameOfXMMRegister(regop)); |
| 1081 } else { |
| 1082 AppendToBuffer("%s,", NameOfXMMRegister(regop)); |
| 1083 current += PrintRightOperand(current); |
| 1084 } |
| 1085 } else if (opcode == 0x2A) { |
| 1086 // CVTSI2SS: integer to XMM single conversion. |
| 1087 int mod, regop, rm; |
| 1088 get_modrm(*current, &mod, ®op, &rm); |
| 1089 AppendToBuffer("%ss %s,", mnemonic, NameOfXMMRegister(regop)); |
| 1090 current += PrintRightOperand(current); |
| 1091 } else if (opcode == 0x2C) { |
1074 // CVTTSS2SI: Convert scalar single-precision FP to dword integer. | 1092 // CVTTSS2SI: Convert scalar single-precision FP to dword integer. |
1075 // Assert that mod is not 3, so source is memory, not an XMM register. | 1093 // Assert that mod is not 3, so source is memory, not an XMM register. |
1076 ASSERT_NE(0xC0, *current & 0xC0); | 1094 ASSERT_NE(0xC0, *current & 0xC0); |
1077 current += PrintOperands("cvttss2si", REG_OPER_OP_ORDER, current); | 1095 current += PrintOperands("cvttss2si", REG_OPER_OP_ORDER, current); |
1078 } else if (opcode == 0x5A) { | 1096 } else if (opcode == 0x5A) { |
1079 int mod, regop, rm; | 1097 int mod, regop, rm; |
1080 get_modrm(*current, &mod, ®op, &rm); | 1098 get_modrm(*current, &mod, ®op, &rm); |
1081 AppendToBuffer("cvtss2sd %s,", NameOfXMMRegister(regop)); | 1099 AppendToBuffer("cvtss2sd %s,", NameOfXMMRegister(regop)); |
1082 current += PrintRightXMMOperand(current); | 1100 current += PrintRightXMMOperand(current); |
1083 } else { | 1101 } else { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1139 } | 1157 } |
1140 | 1158 |
1141 | 1159 |
1142 // Mnemonics for two-byte opcode instructions starting with 0x0F. | 1160 // Mnemonics for two-byte opcode instructions starting with 0x0F. |
1143 // The argument is the second byte of the two-byte opcode. | 1161 // The argument is the second byte of the two-byte opcode. |
1144 // Returns NULL if the instruction is not handled here. | 1162 // Returns NULL if the instruction is not handled here. |
1145 const char* DisassemblerX64::TwoByteMnemonic(byte opcode) { | 1163 const char* DisassemblerX64::TwoByteMnemonic(byte opcode) { |
1146 switch (opcode) { | 1164 switch (opcode) { |
1147 case 0x1F: | 1165 case 0x1F: |
1148 return "nop"; | 1166 return "nop"; |
1149 case 0x2A: // F2 prefix. | 1167 case 0x2A: // F2/F3 prefix. |
1150 return "cvtsi2sd"; | 1168 return "cvtsi2s"; |
1151 case 0x31: | 1169 case 0x31: |
1152 return "rdtsc"; | 1170 return "rdtsc"; |
1153 case 0x51: // F2 prefix. | 1171 case 0x51: // F2 prefix. |
1154 return "sqrtsd"; | 1172 return "sqrtsd"; |
1155 case 0x58: // F2 prefix. | 1173 case 0x58: // F2 prefix. |
1156 return "addsd"; | 1174 return "addsd"; |
1157 case 0x59: // F2 prefix. | 1175 case 0x59: // F2 prefix. |
1158 return "mulsd"; | 1176 return "mulsd"; |
1159 case 0x5C: // F2 prefix. | 1177 case 0x5C: // F2 prefix. |
1160 return "subsd"; | 1178 return "subsd"; |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1669 for (int i = 6 - static_cast<int>(pc - prev_pc); i >= 0; i--) { | 1687 for (int i = 6 - static_cast<int>(pc - prev_pc); i >= 0; i--) { |
1670 fprintf(f, " "); | 1688 fprintf(f, " "); |
1671 } | 1689 } |
1672 fprintf(f, " %s\n", buffer.start()); | 1690 fprintf(f, " %s\n", buffer.start()); |
1673 } | 1691 } |
1674 } | 1692 } |
1675 | 1693 |
1676 } // namespace disasm | 1694 } // namespace disasm |
1677 | 1695 |
1678 #endif // V8_TARGET_ARCH_X64 | 1696 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |