OLD | NEW |
1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2008 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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 *scale = (data >> 6) & 3; | 324 *scale = (data >> 6) & 3; |
325 *index = (data >> 3) & 7; | 325 *index = (data >> 3) & 7; |
326 *base = data & 7; | 326 *base = data & 7; |
327 } | 327 } |
328 | 328 |
329 typedef const char* (DisassemblerIA32::*RegisterNameMapping)(int reg) const; | 329 typedef const char* (DisassemblerIA32::*RegisterNameMapping)(int reg) const; |
330 | 330 |
331 int PrintRightOperandHelper(byte* modrmp, RegisterNameMapping register_name); | 331 int PrintRightOperandHelper(byte* modrmp, RegisterNameMapping register_name); |
332 int PrintRightOperand(byte* modrmp); | 332 int PrintRightOperand(byte* modrmp); |
333 int PrintRightByteOperand(byte* modrmp); | 333 int PrintRightByteOperand(byte* modrmp); |
| 334 int PrintRightXMMOperand(byte* modrmp); |
334 int PrintOperands(const char* mnem, OperandOrder op_order, byte* data); | 335 int PrintOperands(const char* mnem, OperandOrder op_order, byte* data); |
335 int PrintImmediateOp(byte* data); | 336 int PrintImmediateOp(byte* data); |
336 int F7Instruction(byte* data); | 337 int F7Instruction(byte* data); |
337 int D1D3C1Instruction(byte* data); | 338 int D1D3C1Instruction(byte* data); |
338 int JumpShort(byte* data); | 339 int JumpShort(byte* data); |
339 int JumpConditional(byte* data, const char* comment); | 340 int JumpConditional(byte* data, const char* comment); |
340 int JumpConditionalShort(byte* data, const char* comment); | 341 int JumpConditionalShort(byte* data, const char* comment); |
341 int SetCC(byte* data); | 342 int SetCC(byte* data); |
342 int CMov(byte* data); | 343 int CMov(byte* data); |
343 int FPUInstruction(byte* data); | 344 int FPUInstruction(byte* data); |
(...skipping 16 matching lines...) Expand all Loading... |
360 v8::internal::Vector<char> buf = tmp_buffer_ + tmp_buffer_pos_; | 361 v8::internal::Vector<char> buf = tmp_buffer_ + tmp_buffer_pos_; |
361 va_list args; | 362 va_list args; |
362 va_start(args, format); | 363 va_start(args, format); |
363 int result = v8::internal::OS::VSNPrintF(buf, format, args); | 364 int result = v8::internal::OS::VSNPrintF(buf, format, args); |
364 va_end(args); | 365 va_end(args); |
365 tmp_buffer_pos_ += result; | 366 tmp_buffer_pos_ += result; |
366 } | 367 } |
367 | 368 |
368 int DisassemblerIA32::PrintRightOperandHelper( | 369 int DisassemblerIA32::PrintRightOperandHelper( |
369 byte* modrmp, | 370 byte* modrmp, |
370 RegisterNameMapping register_name) { | 371 RegisterNameMapping direct_register_name) { |
371 int mod, regop, rm; | 372 int mod, regop, rm; |
372 get_modrm(*modrmp, &mod, ®op, &rm); | 373 get_modrm(*modrmp, &mod, ®op, &rm); |
| 374 RegisterNameMapping register_name = (mod == 3) ? direct_register_name : |
| 375 &DisassemblerIA32::NameOfCPURegister; |
373 switch (mod) { | 376 switch (mod) { |
374 case 0: | 377 case 0: |
375 if (rm == ebp) { | 378 if (rm == ebp) { |
376 int32_t disp = *reinterpret_cast<int32_t*>(modrmp+1); | 379 int32_t disp = *reinterpret_cast<int32_t*>(modrmp+1); |
377 AppendToBuffer("[0x%x]", disp); | 380 AppendToBuffer("[0x%x]", disp); |
378 return 5; | 381 return 5; |
379 } else if (rm == esp) { | 382 } else if (rm == esp) { |
380 byte sib = *(modrmp + 1); | 383 byte sib = *(modrmp + 1); |
381 int scale, index, base; | 384 int scale, index, base; |
382 get_sib(sib, &scale, &index, &base); | 385 get_sib(sib, &scale, &index, &base); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 return PrintRightOperandHelper(modrmp, &DisassemblerIA32::NameOfCPURegister); | 450 return PrintRightOperandHelper(modrmp, &DisassemblerIA32::NameOfCPURegister); |
448 } | 451 } |
449 | 452 |
450 | 453 |
451 int DisassemblerIA32::PrintRightByteOperand(byte* modrmp) { | 454 int DisassemblerIA32::PrintRightByteOperand(byte* modrmp) { |
452 return PrintRightOperandHelper(modrmp, | 455 return PrintRightOperandHelper(modrmp, |
453 &DisassemblerIA32::NameOfByteCPURegister); | 456 &DisassemblerIA32::NameOfByteCPURegister); |
454 } | 457 } |
455 | 458 |
456 | 459 |
| 460 int DisassemblerIA32::PrintRightXMMOperand(byte* modrmp) { |
| 461 return PrintRightOperandHelper(modrmp, |
| 462 &DisassemblerIA32::NameOfXMMRegister); |
| 463 } |
| 464 |
| 465 |
457 // Returns number of bytes used including the current *data. | 466 // Returns number of bytes used including the current *data. |
458 // Writes instruction's mnemonic, left and right operands to 'tmp_buffer_'. | 467 // Writes instruction's mnemonic, left and right operands to 'tmp_buffer_'. |
459 int DisassemblerIA32::PrintOperands(const char* mnem, | 468 int DisassemblerIA32::PrintOperands(const char* mnem, |
460 OperandOrder op_order, | 469 OperandOrder op_order, |
461 byte* data) { | 470 byte* data) { |
462 byte modrm = *data; | 471 byte modrm = *data; |
463 int mod, regop, rm; | 472 int mod, regop, rm; |
464 get_modrm(modrm, &mod, ®op, &rm); | 473 get_modrm(modrm, &mod, ®op, &rm); |
465 int advance = 0; | 474 int advance = 0; |
466 switch (op_order) { | 475 switch (op_order) { |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
930 data += 2 + (*data == 0x6B ? 1 : 4); | 939 data += 2 + (*data == 0x6B ? 1 : 4); |
931 } | 940 } |
932 break; | 941 break; |
933 | 942 |
934 case 0xF6: | 943 case 0xF6: |
935 { data++; | 944 { data++; |
936 int mod, regop, rm; | 945 int mod, regop, rm; |
937 get_modrm(*data, &mod, ®op, &rm); | 946 get_modrm(*data, &mod, ®op, &rm); |
938 if (regop == eax) { | 947 if (regop == eax) { |
939 AppendToBuffer("test_b "); | 948 AppendToBuffer("test_b "); |
940 data += PrintRightOperand(data); | 949 data += PrintRightByteOperand(data); |
941 int32_t imm = *data; | 950 int32_t imm = *data; |
942 AppendToBuffer(",0x%x", imm); | 951 AppendToBuffer(",0x%x", imm); |
943 data++; | 952 data++; |
944 } else { | 953 } else { |
945 UnimplementedInstruction(); | 954 UnimplementedInstruction(); |
946 } | 955 } |
947 } | 956 } |
948 break; | 957 break; |
949 | 958 |
950 case 0x81: // fall through | 959 case 0x81: // fall through |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1028 } | 1037 } |
1029 AppendToBuffer("%s ", mnem); | 1038 AppendToBuffer("%s ", mnem); |
1030 data += PrintRightOperand(data); | 1039 data += PrintRightOperand(data); |
1031 } | 1040 } |
1032 break; | 1041 break; |
1033 | 1042 |
1034 case 0xC7: // imm32, fall through | 1043 case 0xC7: // imm32, fall through |
1035 case 0xC6: // imm8 | 1044 case 0xC6: // imm8 |
1036 { bool is_byte = *data == 0xC6; | 1045 { bool is_byte = *data == 0xC6; |
1037 data++; | 1046 data++; |
1038 AppendToBuffer("%s ", is_byte ? "mov_b" : "mov"); | 1047 if (is_byte) { |
1039 data += PrintRightOperand(data); | 1048 AppendToBuffer("%s ", "mov_b"); |
1040 int32_t imm = is_byte ? *data : *reinterpret_cast<int32_t*>(data); | 1049 data += PrintRightByteOperand(data); |
1041 AppendToBuffer(",0x%x", imm); | 1050 int32_t imm = *data; |
1042 data += is_byte ? 1 : 4; | 1051 AppendToBuffer(",0x%x", imm); |
| 1052 data++; |
| 1053 } else { |
| 1054 AppendToBuffer("%s ", "mov"); |
| 1055 data += PrintRightOperand(data); |
| 1056 int32_t imm = *reinterpret_cast<int32_t*>(data); |
| 1057 AppendToBuffer(",0x%x", imm); |
| 1058 data += 4; |
| 1059 } |
1043 } | 1060 } |
1044 break; | 1061 break; |
1045 | 1062 |
1046 case 0x80: | 1063 case 0x80: |
1047 { data++; | 1064 { data++; |
1048 int mod, regop, rm; | 1065 int mod, regop, rm; |
1049 get_modrm(*data, &mod, ®op, &rm); | 1066 get_modrm(*data, &mod, ®op, &rm); |
1050 const char* mnem = NULL; | 1067 const char* mnem = NULL; |
1051 switch (regop) { | 1068 switch (regop) { |
1052 case 5: mnem = "subb"; break; | 1069 case 5: mnem = "subb"; break; |
1053 case 7: mnem = "cmpb"; break; | 1070 case 7: mnem = "cmpb"; break; |
1054 default: UnimplementedInstruction(); | 1071 default: UnimplementedInstruction(); |
1055 } | 1072 } |
1056 AppendToBuffer("%s ", mnem); | 1073 AppendToBuffer("%s ", mnem); |
1057 data += PrintRightOperand(data); | 1074 data += PrintRightByteOperand(data); |
1058 int32_t imm = *data; | 1075 int32_t imm = *data; |
1059 AppendToBuffer(",0x%x", imm); | 1076 AppendToBuffer(",0x%x", imm); |
1060 data++; | 1077 data++; |
1061 } | 1078 } |
1062 break; | 1079 break; |
1063 | 1080 |
1064 case 0x88: // 8bit, fall through | 1081 case 0x88: // 8bit, fall through |
1065 case 0x89: // 32bit | 1082 case 0x89: // 32bit |
1066 { bool is_byte = *data == 0x88; | 1083 { bool is_byte = *data == 0x88; |
1067 int mod, regop, rm; | 1084 int mod, regop, rm; |
1068 data++; | 1085 data++; |
1069 get_modrm(*data, &mod, ®op, &rm); | 1086 get_modrm(*data, &mod, ®op, &rm); |
1070 AppendToBuffer("%s ", is_byte ? "mov_b" : "mov"); | 1087 if (is_byte) { |
1071 data += PrintRightOperand(data); | 1088 AppendToBuffer("%s ", "mov_b"); |
1072 AppendToBuffer(",%s", NameOfCPURegister(regop)); | 1089 data += PrintRightByteOperand(data); |
| 1090 AppendToBuffer(",%s", NameOfByteCPURegister(regop)); |
| 1091 } else { |
| 1092 AppendToBuffer("%s ", "mov"); |
| 1093 data += PrintRightOperand(data); |
| 1094 AppendToBuffer(",%s", NameOfCPURegister(regop)); |
| 1095 } |
1073 } | 1096 } |
1074 break; | 1097 break; |
1075 | 1098 |
1076 case 0x66: // prefix | 1099 case 0x66: // prefix |
1077 data++; | 1100 data++; |
1078 if (*data == 0x8B) { | 1101 if (*data == 0x8B) { |
1079 data++; | 1102 data++; |
1080 data += PrintOperands("mov_w", REG_OPER_OP_ORDER, data); | 1103 data += PrintOperands("mov_w", REG_OPER_OP_ORDER, data); |
1081 } else if (*data == 0x89) { | 1104 } else if (*data == 0x89) { |
1082 data++; | 1105 data++; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1174 data++; | 1197 data++; |
1175 int mod, regop, rm; | 1198 int mod, regop, rm; |
1176 get_modrm(*data, &mod, ®op, &rm); | 1199 get_modrm(*data, &mod, ®op, &rm); |
1177 AppendToBuffer("movd %s,", NameOfXMMRegister(regop)); | 1200 AppendToBuffer("movd %s,", NameOfXMMRegister(regop)); |
1178 data += PrintRightOperand(data); | 1201 data += PrintRightOperand(data); |
1179 } else if (*data == 0x6F) { | 1202 } else if (*data == 0x6F) { |
1180 data++; | 1203 data++; |
1181 int mod, regop, rm; | 1204 int mod, regop, rm; |
1182 get_modrm(*data, &mod, ®op, &rm); | 1205 get_modrm(*data, &mod, ®op, &rm); |
1183 AppendToBuffer("movdqa %s,", NameOfXMMRegister(regop)); | 1206 AppendToBuffer("movdqa %s,", NameOfXMMRegister(regop)); |
1184 data += PrintRightOperand(data); | 1207 data += PrintRightXMMOperand(data); |
1185 } else if (*data == 0x70) { | 1208 } else if (*data == 0x70) { |
1186 data++; | 1209 data++; |
1187 int mod, regop, rm; | 1210 int mod, regop, rm; |
1188 get_modrm(*data, &mod, ®op, &rm); | 1211 get_modrm(*data, &mod, ®op, &rm); |
1189 int8_t imm8 = static_cast<int8_t>(data[1]); | 1212 int8_t imm8 = static_cast<int8_t>(data[1]); |
1190 AppendToBuffer("pshufd %s,%s,%d", | 1213 AppendToBuffer("pshufd %s,%s,%d", |
1191 NameOfXMMRegister(regop), | 1214 NameOfXMMRegister(regop), |
1192 NameOfXMMRegister(rm), | 1215 NameOfXMMRegister(rm), |
1193 static_cast<int>(imm8)); | 1216 static_cast<int>(imm8)); |
1194 data += 2; | 1217 data += 2; |
(...skipping 22 matching lines...) Expand all Loading... |
1217 get_modrm(*data, &mod, ®op, &rm); | 1240 get_modrm(*data, &mod, ®op, &rm); |
1218 AppendToBuffer("psrlq %s,%s", | 1241 AppendToBuffer("psrlq %s,%s", |
1219 NameOfXMMRegister(regop), | 1242 NameOfXMMRegister(regop), |
1220 NameOfXMMRegister(rm)); | 1243 NameOfXMMRegister(rm)); |
1221 data++; | 1244 data++; |
1222 } else if (*data == 0x7F) { | 1245 } else if (*data == 0x7F) { |
1223 AppendToBuffer("movdqa "); | 1246 AppendToBuffer("movdqa "); |
1224 data++; | 1247 data++; |
1225 int mod, regop, rm; | 1248 int mod, regop, rm; |
1226 get_modrm(*data, &mod, ®op, &rm); | 1249 get_modrm(*data, &mod, ®op, &rm); |
1227 data += PrintRightOperand(data); | 1250 data += PrintRightXMMOperand(data); |
1228 AppendToBuffer(",%s", NameOfXMMRegister(regop)); | 1251 AppendToBuffer(",%s", NameOfXMMRegister(regop)); |
1229 } else if (*data == 0x7E) { | 1252 } else if (*data == 0x7E) { |
1230 data++; | 1253 data++; |
1231 int mod, regop, rm; | 1254 int mod, regop, rm; |
1232 get_modrm(*data, &mod, ®op, &rm); | 1255 get_modrm(*data, &mod, ®op, &rm); |
1233 AppendToBuffer("movd "); | 1256 AppendToBuffer("movd "); |
1234 data += PrintRightOperand(data); | 1257 data += PrintRightOperand(data); |
1235 AppendToBuffer(",%s", NameOfXMMRegister(regop)); | 1258 AppendToBuffer(",%s", NameOfXMMRegister(regop)); |
1236 } else if (*data == 0xDB) { | 1259 } else if (*data == 0xDB) { |
1237 data++; | 1260 data++; |
1238 int mod, regop, rm; | 1261 int mod, regop, rm; |
1239 get_modrm(*data, &mod, ®op, &rm); | 1262 get_modrm(*data, &mod, ®op, &rm); |
1240 AppendToBuffer("pand %s,%s", | 1263 AppendToBuffer("pand %s,%s", |
1241 NameOfXMMRegister(regop), | 1264 NameOfXMMRegister(regop), |
1242 NameOfXMMRegister(rm)); | 1265 NameOfXMMRegister(rm)); |
1243 data++; | 1266 data++; |
1244 } else if (*data == 0xE7) { | 1267 } else if (*data == 0xE7) { |
1245 AppendToBuffer("movntdq "); | |
1246 data++; | 1268 data++; |
1247 int mod, regop, rm; | 1269 int mod, regop, rm; |
1248 get_modrm(*data, &mod, ®op, &rm); | 1270 get_modrm(*data, &mod, ®op, &rm); |
1249 data += PrintRightOperand(data); | 1271 if (mod == 3) { |
1250 AppendToBuffer(",%s", NameOfXMMRegister(regop)); | 1272 AppendToBuffer("movntdq "); |
| 1273 data += PrintRightOperand(data); |
| 1274 AppendToBuffer(",%s", NameOfXMMRegister(regop)); |
| 1275 } else { |
| 1276 UnimplementedInstruction(); |
| 1277 } |
1251 } else if (*data == 0xEF) { | 1278 } else if (*data == 0xEF) { |
1252 data++; | 1279 data++; |
1253 int mod, regop, rm; | 1280 int mod, regop, rm; |
1254 get_modrm(*data, &mod, ®op, &rm); | 1281 get_modrm(*data, &mod, ®op, &rm); |
1255 AppendToBuffer("pxor %s,%s", | 1282 AppendToBuffer("pxor %s,%s", |
1256 NameOfXMMRegister(regop), | 1283 NameOfXMMRegister(regop), |
1257 NameOfXMMRegister(rm)); | 1284 NameOfXMMRegister(rm)); |
1258 data++; | 1285 data++; |
1259 } else if (*data == 0xEB) { | 1286 } else if (*data == 0xEB) { |
1260 data++; | 1287 data++; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1331 break; | 1358 break; |
1332 | 1359 |
1333 case 0xF2: | 1360 case 0xF2: |
1334 if (*(data+1) == 0x0F) { | 1361 if (*(data+1) == 0x0F) { |
1335 byte b2 = *(data+2); | 1362 byte b2 = *(data+2); |
1336 if (b2 == 0x11) { | 1363 if (b2 == 0x11) { |
1337 AppendToBuffer("movsd "); | 1364 AppendToBuffer("movsd "); |
1338 data += 3; | 1365 data += 3; |
1339 int mod, regop, rm; | 1366 int mod, regop, rm; |
1340 get_modrm(*data, &mod, ®op, &rm); | 1367 get_modrm(*data, &mod, ®op, &rm); |
1341 data += PrintRightOperand(data); | 1368 data += PrintRightXMMOperand(data); |
1342 AppendToBuffer(",%s", NameOfXMMRegister(regop)); | 1369 AppendToBuffer(",%s", NameOfXMMRegister(regop)); |
1343 } else if (b2 == 0x10) { | 1370 } else if (b2 == 0x10) { |
1344 data += 3; | 1371 data += 3; |
1345 int mod, regop, rm; | 1372 int mod, regop, rm; |
1346 get_modrm(*data, &mod, ®op, &rm); | 1373 get_modrm(*data, &mod, ®op, &rm); |
1347 AppendToBuffer("movsd %s,", NameOfXMMRegister(regop)); | 1374 AppendToBuffer("movsd %s,", NameOfXMMRegister(regop)); |
1348 data += PrintRightOperand(data); | 1375 data += PrintRightXMMOperand(data); |
1349 } else { | 1376 } else { |
1350 const char* mnem = "?"; | 1377 const char* mnem = "?"; |
1351 switch (b2) { | 1378 switch (b2) { |
1352 case 0x2A: mnem = "cvtsi2sd"; break; | 1379 case 0x2A: mnem = "cvtsi2sd"; break; |
1353 case 0x2C: mnem = "cvttsd2si"; break; | 1380 case 0x2C: mnem = "cvttsd2si"; break; |
1354 case 0x51: mnem = "sqrtsd"; break; | 1381 case 0x51: mnem = "sqrtsd"; break; |
1355 case 0x58: mnem = "addsd"; break; | 1382 case 0x58: mnem = "addsd"; break; |
1356 case 0x59: mnem = "mulsd"; break; | 1383 case 0x59: mnem = "mulsd"; break; |
1357 case 0x5C: mnem = "subsd"; break; | 1384 case 0x5C: mnem = "subsd"; break; |
1358 case 0x5E: mnem = "divsd"; break; | 1385 case 0x5E: mnem = "divsd"; break; |
1359 } | 1386 } |
1360 data += 3; | 1387 data += 3; |
1361 int mod, regop, rm; | 1388 int mod, regop, rm; |
1362 get_modrm(*data, &mod, ®op, &rm); | 1389 get_modrm(*data, &mod, ®op, &rm); |
1363 if (b2 == 0x2A) { | 1390 if (b2 == 0x2A) { |
1364 if (mod != 0x3) { | 1391 AppendToBuffer("%s %s,", mnem, NameOfXMMRegister(regop)); |
1365 AppendToBuffer("%s %s,", mnem, NameOfXMMRegister(regop)); | 1392 data += PrintRightOperand(data); |
1366 data += PrintRightOperand(data); | |
1367 } else { | |
1368 AppendToBuffer("%s %s,%s", | |
1369 mnem, | |
1370 NameOfXMMRegister(regop), | |
1371 NameOfCPURegister(rm)); | |
1372 data++; | |
1373 } | |
1374 } else if (b2 == 0x2C) { | 1393 } else if (b2 == 0x2C) { |
1375 if (mod != 0x3) { | 1394 AppendToBuffer("%s %s,", mnem, NameOfCPURegister(regop)); |
1376 AppendToBuffer("%s %s,", mnem, NameOfCPURegister(regop)); | 1395 data += PrintRightXMMOperand(data); |
1377 data += PrintRightOperand(data); | |
1378 } else { | |
1379 AppendToBuffer("%s %s,%s", | |
1380 mnem, | |
1381 NameOfCPURegister(regop), | |
1382 NameOfXMMRegister(rm)); | |
1383 data++; | |
1384 } | |
1385 } else if (b2 == 0xC2) { | 1396 } else if (b2 == 0xC2) { |
1386 // Intel manual 2A, Table 3-18. | 1397 // Intel manual 2A, Table 3-18. |
1387 const char* const pseudo_op[] = { | 1398 const char* const pseudo_op[] = { |
1388 "cmpeqsd", | 1399 "cmpeqsd", |
1389 "cmpltsd", | 1400 "cmpltsd", |
1390 "cmplesd", | 1401 "cmplesd", |
1391 "cmpunordsd", | 1402 "cmpunordsd", |
1392 "cmpneqsd", | 1403 "cmpneqsd", |
1393 "cmpnltsd", | 1404 "cmpnltsd", |
1394 "cmpnlesd", | 1405 "cmpnlesd", |
1395 "cmpordsd" | 1406 "cmpordsd" |
1396 }; | 1407 }; |
1397 AppendToBuffer("%s %s,%s", | 1408 AppendToBuffer("%s %s,%s", |
1398 pseudo_op[data[1]], | 1409 pseudo_op[data[1]], |
1399 NameOfXMMRegister(regop), | 1410 NameOfXMMRegister(regop), |
1400 NameOfXMMRegister(rm)); | 1411 NameOfXMMRegister(rm)); |
1401 data += 2; | 1412 data += 2; |
1402 } else { | 1413 } else { |
1403 if (mod != 0x3) { | 1414 AppendToBuffer("%s %s,", mnem, NameOfXMMRegister(regop)); |
1404 AppendToBuffer("%s %s,", mnem, NameOfXMMRegister(regop)); | 1415 data += PrintRightXMMOperand(data); |
1405 data += PrintRightOperand(data); | |
1406 } else { | |
1407 AppendToBuffer("%s %s,%s", | |
1408 mnem, | |
1409 NameOfXMMRegister(regop), | |
1410 NameOfXMMRegister(rm)); | |
1411 data++; | |
1412 } | |
1413 } | 1416 } |
1414 } | 1417 } |
1415 } else { | 1418 } else { |
1416 UnimplementedInstruction(); | 1419 UnimplementedInstruction(); |
1417 } | 1420 } |
1418 break; | 1421 break; |
1419 | 1422 |
1420 case 0xF3: | 1423 case 0xF3: |
1421 if (*(data+1) == 0x0F) { | 1424 if (*(data+1) == 0x0F) { |
1422 if (*(data+2) == 0x2C) { | 1425 if (*(data+2) == 0x2C) { |
1423 data += 3; | 1426 data += 3; |
1424 data += PrintOperands("cvttss2si", REG_OPER_OP_ORDER, data); | 1427 int mod, regop, rm; |
| 1428 get_modrm(*data, &mod, ®op, &rm); |
| 1429 AppendToBuffer("cvttss2si %s,", NameOfCPURegister(regop)); |
| 1430 data += PrintRightXMMOperand(data); |
1425 } else if (*(data+2) == 0x5A) { | 1431 } else if (*(data+2) == 0x5A) { |
1426 data += 3; | 1432 data += 3; |
1427 int mod, regop, rm; | 1433 int mod, regop, rm; |
1428 get_modrm(*data, &mod, ®op, &rm); | 1434 get_modrm(*data, &mod, ®op, &rm); |
1429 AppendToBuffer("cvtss2sd %s,%s", | 1435 AppendToBuffer("cvtss2sd %s,", NameOfXMMRegister(regop)); |
1430 NameOfXMMRegister(regop), | 1436 data += PrintRightXMMOperand(data); |
1431 NameOfXMMRegister(rm)); | |
1432 data++; | |
1433 } else if (*(data+2) == 0x6F) { | 1437 } else if (*(data+2) == 0x6F) { |
1434 data += 3; | 1438 data += 3; |
1435 int mod, regop, rm; | 1439 int mod, regop, rm; |
1436 get_modrm(*data, &mod, ®op, &rm); | 1440 get_modrm(*data, &mod, ®op, &rm); |
1437 AppendToBuffer("movdqu %s,", NameOfXMMRegister(regop)); | 1441 AppendToBuffer("movdqu %s,", NameOfXMMRegister(regop)); |
1438 data += PrintRightOperand(data); | 1442 data += PrintRightXMMOperand(data); |
1439 } else if (*(data+2) == 0x7F) { | 1443 } else if (*(data+2) == 0x7F) { |
1440 AppendToBuffer("movdqu "); | 1444 AppendToBuffer("movdqu "); |
1441 data += 3; | 1445 data += 3; |
1442 int mod, regop, rm; | 1446 int mod, regop, rm; |
1443 get_modrm(*data, &mod, ®op, &rm); | 1447 get_modrm(*data, &mod, ®op, &rm); |
1444 data += PrintRightOperand(data); | 1448 data += PrintRightXMMOperand(data); |
1445 AppendToBuffer(",%s", NameOfXMMRegister(regop)); | 1449 AppendToBuffer(",%s", NameOfXMMRegister(regop)); |
1446 } else { | 1450 } else { |
1447 UnimplementedInstruction(); | 1451 UnimplementedInstruction(); |
1448 } | 1452 } |
1449 } else if (*(data+1) == 0xA5) { | 1453 } else if (*(data+1) == 0xA5) { |
1450 data += 2; | 1454 data += 2; |
1451 AppendToBuffer("rep_movs"); | 1455 AppendToBuffer("rep_movs"); |
1452 } else if (*(data+1) == 0xAB) { | 1456 } else if (*(data+1) == 0xAB) { |
1453 data += 2; | 1457 data += 2; |
1454 AppendToBuffer("rep_stos"); | 1458 AppendToBuffer("rep_stos"); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1588 fprintf(f, " "); | 1592 fprintf(f, " "); |
1589 } | 1593 } |
1590 fprintf(f, " %s\n", buffer.start()); | 1594 fprintf(f, " %s\n", buffer.start()); |
1591 } | 1595 } |
1592 } | 1596 } |
1593 | 1597 |
1594 | 1598 |
1595 } // namespace disasm | 1599 } // namespace disasm |
1596 | 1600 |
1597 #endif // V8_TARGET_ARCH_IA32 | 1601 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |