| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1146 get_modrm(*current, &mod, ®op, &rm); | 1146 get_modrm(*current, &mod, ®op, &rm); |
| 1147 AppendToBuffer("cvtsd2si%c %s,", | 1147 AppendToBuffer("cvtsd2si%c %s,", |
| 1148 operand_size_code(), NameOfCPURegister(regop)); | 1148 operand_size_code(), NameOfCPURegister(regop)); |
| 1149 current += PrintRightXMMOperand(current); | 1149 current += PrintRightXMMOperand(current); |
| 1150 } else if ((opcode & 0xF8) == 0x58 || opcode == 0x51) { | 1150 } else if ((opcode & 0xF8) == 0x58 || opcode == 0x51) { |
| 1151 // XMM arithmetic. Mnemonic was retrieved at the start of this function. | 1151 // XMM arithmetic. Mnemonic was retrieved at the start of this function. |
| 1152 int mod, regop, rm; | 1152 int mod, regop, rm; |
| 1153 get_modrm(*current, &mod, ®op, &rm); | 1153 get_modrm(*current, &mod, ®op, &rm); |
| 1154 AppendToBuffer("%s %s,", mnemonic, NameOfXMMRegister(regop)); | 1154 AppendToBuffer("%s %s,", mnemonic, NameOfXMMRegister(regop)); |
| 1155 current += PrintRightXMMOperand(current); | 1155 current += PrintRightXMMOperand(current); |
| 1156 } else if (opcode == 0xC2) { |
| 1157 // Intel manual 2A, Table 3-18. |
| 1158 int mod, regop, rm; |
| 1159 get_modrm(*current, &mod, ®op, &rm); |
| 1160 const char* const pseudo_op[] = { |
| 1161 "cmpeqsd", |
| 1162 "cmpltsd", |
| 1163 "cmplesd", |
| 1164 "cmpunordsd", |
| 1165 "cmpneqsd", |
| 1166 "cmpnltsd", |
| 1167 "cmpnlesd", |
| 1168 "cmpordsd" |
| 1169 }; |
| 1170 AppendToBuffer("%s %s,%s", |
| 1171 pseudo_op[current[1]], |
| 1172 NameOfXMMRegister(regop), |
| 1173 NameOfXMMRegister(rm)); |
| 1174 current += 2; |
| 1156 } else { | 1175 } else { |
| 1157 UnimplementedInstruction(); | 1176 UnimplementedInstruction(); |
| 1158 } | 1177 } |
| 1159 } else if (group_1_prefix_ == 0xF3) { | 1178 } else if (group_1_prefix_ == 0xF3) { |
| 1160 // Instructions with prefix 0xF3. | 1179 // Instructions with prefix 0xF3. |
| 1161 if (opcode == 0x11 || opcode == 0x10) { | 1180 if (opcode == 0x11 || opcode == 0x10) { |
| 1162 // MOVSS: Move scalar double-precision fp to/from/between XMM registers. | 1181 // MOVSS: Move scalar double-precision fp to/from/between XMM registers. |
| 1163 AppendToBuffer("movss "); | 1182 AppendToBuffer("movss "); |
| 1164 int mod, regop, rm; | 1183 int mod, regop, rm; |
| 1165 get_modrm(*current, &mod, ®op, &rm); | 1184 get_modrm(*current, &mod, ®op, &rm); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1222 current += PrintRightXMMOperand(current); | 1241 current += PrintRightXMMOperand(current); |
| 1223 | 1242 |
| 1224 } else if (opcode == 0x29) { | 1243 } else if (opcode == 0x29) { |
| 1225 // movaps xmm/m128, xmm | 1244 // movaps xmm/m128, xmm |
| 1226 int mod, regop, rm; | 1245 int mod, regop, rm; |
| 1227 get_modrm(*current, &mod, ®op, &rm); | 1246 get_modrm(*current, &mod, ®op, &rm); |
| 1228 AppendToBuffer("movaps "); | 1247 AppendToBuffer("movaps "); |
| 1229 current += PrintRightXMMOperand(current); | 1248 current += PrintRightXMMOperand(current); |
| 1230 AppendToBuffer(", %s", NameOfXMMRegister(regop)); | 1249 AppendToBuffer(", %s", NameOfXMMRegister(regop)); |
| 1231 | 1250 |
| 1232 } else if (opcode == 0xA2 || opcode == 0x31) { | 1251 } else if (opcode == 0xA2) { |
| 1233 // RDTSC or CPUID | 1252 // CPUID |
| 1234 AppendToBuffer("%s", mnemonic); | 1253 AppendToBuffer("%s", mnemonic); |
| 1235 | 1254 |
| 1236 } else if ((opcode & 0xF0) == 0x40) { | 1255 } else if ((opcode & 0xF0) == 0x40) { |
| 1237 // CMOVcc: conditional move. | 1256 // CMOVcc: conditional move. |
| 1238 int condition = opcode & 0x0F; | 1257 int condition = opcode & 0x0F; |
| 1239 const InstructionDesc& idesc = cmov_instructions[condition]; | 1258 const InstructionDesc& idesc = cmov_instructions[condition]; |
| 1240 byte_size_operand_ = idesc.byte_size_operation; | 1259 byte_size_operand_ = idesc.byte_size_operation; |
| 1241 current += PrintOperands(idesc.mnem, idesc.op_order_, current); | 1260 current += PrintOperands(idesc.mnem, idesc.op_order_, current); |
| 1242 | 1261 |
| 1243 } else if (opcode == 0x57) { | 1262 } else if (opcode == 0x57) { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1287 | 1306 |
| 1288 // Mnemonics for two-byte opcode instructions starting with 0x0F. | 1307 // Mnemonics for two-byte opcode instructions starting with 0x0F. |
| 1289 // The argument is the second byte of the two-byte opcode. | 1308 // The argument is the second byte of the two-byte opcode. |
| 1290 // Returns NULL if the instruction is not handled here. | 1309 // Returns NULL if the instruction is not handled here. |
| 1291 const char* DisassemblerX64::TwoByteMnemonic(byte opcode) { | 1310 const char* DisassemblerX64::TwoByteMnemonic(byte opcode) { |
| 1292 switch (opcode) { | 1311 switch (opcode) { |
| 1293 case 0x1F: | 1312 case 0x1F: |
| 1294 return "nop"; | 1313 return "nop"; |
| 1295 case 0x2A: // F2/F3 prefix. | 1314 case 0x2A: // F2/F3 prefix. |
| 1296 return "cvtsi2s"; | 1315 return "cvtsi2s"; |
| 1297 case 0x31: | |
| 1298 return "rdtsc"; | |
| 1299 case 0x51: // F2 prefix. | 1316 case 0x51: // F2 prefix. |
| 1300 return "sqrtsd"; | 1317 return "sqrtsd"; |
| 1301 case 0x58: // F2 prefix. | 1318 case 0x58: // F2 prefix. |
| 1302 return "addsd"; | 1319 return "addsd"; |
| 1303 case 0x59: // F2 prefix. | 1320 case 0x59: // F2 prefix. |
| 1304 return "mulsd"; | 1321 return "mulsd"; |
| 1305 case 0x5C: // F2 prefix. | 1322 case 0x5C: // F2 prefix. |
| 1306 return "subsd"; | 1323 return "subsd"; |
| 1307 case 0x5E: // F2 prefix. | 1324 case 0x5E: // F2 prefix. |
| 1308 return "divsd"; | 1325 return "divsd"; |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1865 for (int i = 6 - static_cast<int>(pc - prev_pc); i >= 0; i--) { | 1882 for (int i = 6 - static_cast<int>(pc - prev_pc); i >= 0; i--) { |
| 1866 fprintf(f, " "); | 1883 fprintf(f, " "); |
| 1867 } | 1884 } |
| 1868 fprintf(f, " %s\n", buffer.start()); | 1885 fprintf(f, " %s\n", buffer.start()); |
| 1869 } | 1886 } |
| 1870 } | 1887 } |
| 1871 | 1888 |
| 1872 } // namespace disasm | 1889 } // namespace disasm |
| 1873 | 1890 |
| 1874 #endif // V8_TARGET_ARCH_X64 | 1891 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |