| 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 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 case 0xE8: mnem = "fld1"; break; | 927 case 0xE8: mnem = "fld1"; break; |
| 928 case 0xEB: mnem = "fldpi"; break; | 928 case 0xEB: mnem = "fldpi"; break; |
| 929 case 0xED: mnem = "fldln2"; break; | 929 case 0xED: mnem = "fldln2"; break; |
| 930 case 0xEE: mnem = "fldz"; break; | 930 case 0xEE: mnem = "fldz"; break; |
| 931 case 0xF0: mnem = "f2xm1"; break; | 931 case 0xF0: mnem = "f2xm1"; break; |
| 932 case 0xF1: mnem = "fyl2x"; break; | 932 case 0xF1: mnem = "fyl2x"; break; |
| 933 case 0xF2: mnem = "fptan"; break; | 933 case 0xF2: mnem = "fptan"; break; |
| 934 case 0xF5: mnem = "fprem1"; break; | 934 case 0xF5: mnem = "fprem1"; break; |
| 935 case 0xF7: mnem = "fincstp"; break; | 935 case 0xF7: mnem = "fincstp"; break; |
| 936 case 0xF8: mnem = "fprem"; break; | 936 case 0xF8: mnem = "fprem"; break; |
| 937 case 0xFC: mnem = "frndint"; break; |
| 937 case 0xFD: mnem = "fscale"; break; | 938 case 0xFD: mnem = "fscale"; break; |
| 938 case 0xFE: mnem = "fsin"; break; | 939 case 0xFE: mnem = "fsin"; break; |
| 939 case 0xFF: mnem = "fcos"; break; | 940 case 0xFF: mnem = "fcos"; break; |
| 940 default: UnimplementedInstruction(); | 941 default: UnimplementedInstruction(); |
| 941 } | 942 } |
| 942 } | 943 } |
| 943 break; | 944 break; |
| 944 | 945 |
| 945 case 0xDA: | 946 case 0xDA: |
| 946 if (modrm_byte == 0xE9) { | 947 if (modrm_byte == 0xE9) { |
| 947 mnem = "fucompp"; | 948 mnem = "fucompp"; |
| 948 } else { | 949 } else { |
| 949 UnimplementedInstruction(); | 950 UnimplementedInstruction(); |
| 950 } | 951 } |
| 951 break; | 952 break; |
| 952 | 953 |
| 953 case 0xDB: | 954 case 0xDB: |
| 954 if ((modrm_byte & 0xF8) == 0xE8) { | 955 if ((modrm_byte & 0xF8) == 0xE8) { |
| 955 mnem = "fucomi"; | 956 mnem = "fucomi"; |
| 956 has_register = true; | 957 has_register = true; |
| 957 } else if (modrm_byte == 0xE2) { | 958 } else if (modrm_byte == 0xE2) { |
| 958 mnem = "fclex"; | 959 mnem = "fclex"; |
| 960 } else if (modrm_byte == 0xE3) { |
| 961 mnem = "fninit"; |
| 959 } else { | 962 } else { |
| 960 UnimplementedInstruction(); | 963 UnimplementedInstruction(); |
| 961 } | 964 } |
| 962 break; | 965 break; |
| 963 | 966 |
| 964 case 0xDC: | 967 case 0xDC: |
| 965 has_register = true; | 968 has_register = true; |
| 966 switch (modrm_byte & 0xF8) { | 969 switch (modrm_byte & 0xF8) { |
| 967 case 0xC0: mnem = "fadd"; break; | 970 case 0xC0: mnem = "fadd"; break; |
| 968 case 0xE8: mnem = "fsub"; break; | 971 case 0xE8: mnem = "fsub"; break; |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1316 // SHLD, SHRD (double-precision shift), BTS (bit set). | 1319 // SHLD, SHRD (double-precision shift), BTS (bit set). |
| 1317 AppendToBuffer("%s ", mnemonic); | 1320 AppendToBuffer("%s ", mnemonic); |
| 1318 int mod, regop, rm; | 1321 int mod, regop, rm; |
| 1319 get_modrm(*current, &mod, ®op, &rm); | 1322 get_modrm(*current, &mod, ®op, &rm); |
| 1320 current += PrintRightOperand(current); | 1323 current += PrintRightOperand(current); |
| 1321 if (opcode == 0xAB) { | 1324 if (opcode == 0xAB) { |
| 1322 AppendToBuffer(",%s", NameOfCPURegister(regop)); | 1325 AppendToBuffer(",%s", NameOfCPURegister(regop)); |
| 1323 } else { | 1326 } else { |
| 1324 AppendToBuffer(",%s,cl", NameOfCPURegister(regop)); | 1327 AppendToBuffer(",%s,cl", NameOfCPURegister(regop)); |
| 1325 } | 1328 } |
| 1329 } else if (opcode == 0xBD) { |
| 1330 AppendToBuffer("%s%c ", mnemonic, operand_size_code()); |
| 1331 int mod, regop, rm; |
| 1332 get_modrm(*current, &mod, ®op, &rm); |
| 1333 AppendToBuffer("%s,", NameOfCPURegister(regop)); |
| 1334 current += PrintRightOperand(current); |
| 1326 } else { | 1335 } else { |
| 1327 UnimplementedInstruction(); | 1336 UnimplementedInstruction(); |
| 1328 } | 1337 } |
| 1329 return static_cast<int>(current - data); | 1338 return static_cast<int>(current - data); |
| 1330 } | 1339 } |
| 1331 | 1340 |
| 1332 | 1341 |
| 1333 // Mnemonics for two-byte opcode instructions starting with 0x0F. | 1342 // Mnemonics for two-byte opcode instructions starting with 0x0F. |
| 1334 // The argument is the second byte of the two-byte opcode. | 1343 // The argument is the second byte of the two-byte opcode. |
| 1335 // Returns NULL if the instruction is not handled here. | 1344 // Returns NULL if the instruction is not handled here. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1358 case 0xAB: | 1367 case 0xAB: |
| 1359 return "bts"; | 1368 return "bts"; |
| 1360 case 0xAD: | 1369 case 0xAD: |
| 1361 return "shrd"; | 1370 return "shrd"; |
| 1362 case 0xAF: | 1371 case 0xAF: |
| 1363 return "imul"; | 1372 return "imul"; |
| 1364 case 0xB6: | 1373 case 0xB6: |
| 1365 return "movzxb"; | 1374 return "movzxb"; |
| 1366 case 0xB7: | 1375 case 0xB7: |
| 1367 return "movzxw"; | 1376 return "movzxw"; |
| 1377 case 0xBD: |
| 1378 return "bsr"; |
| 1368 case 0xBE: | 1379 case 0xBE: |
| 1369 return "movsxb"; | 1380 return "movsxb"; |
| 1370 case 0xBF: | 1381 case 0xBF: |
| 1371 return "movsxw"; | 1382 return "movsxw"; |
| 1372 default: | 1383 default: |
| 1373 return NULL; | 1384 return NULL; |
| 1374 } | 1385 } |
| 1375 } | 1386 } |
| 1376 | 1387 |
| 1377 | 1388 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1441 data++; | 1452 data++; |
| 1442 break; | 1453 break; |
| 1443 case MOVE_REG_INSTR: { | 1454 case MOVE_REG_INSTR: { |
| 1444 byte* addr = NULL; | 1455 byte* addr = NULL; |
| 1445 switch (operand_size()) { | 1456 switch (operand_size()) { |
| 1446 case OPERAND_WORD_SIZE: | 1457 case OPERAND_WORD_SIZE: |
| 1447 addr = reinterpret_cast<byte*>(*reinterpret_cast<int16_t*>(data + 1)); | 1458 addr = reinterpret_cast<byte*>(*reinterpret_cast<int16_t*>(data + 1)); |
| 1448 data += 3; | 1459 data += 3; |
| 1449 break; | 1460 break; |
| 1450 case OPERAND_DOUBLEWORD_SIZE: | 1461 case OPERAND_DOUBLEWORD_SIZE: |
| 1451 addr = reinterpret_cast<byte*>(*reinterpret_cast<int32_t*>(data + 1)); | 1462 addr = |
| 1463 reinterpret_cast<byte*>(*reinterpret_cast<uint32_t*>(data + 1)); |
| 1452 data += 5; | 1464 data += 5; |
| 1453 break; | 1465 break; |
| 1454 case OPERAND_QUADWORD_SIZE: | 1466 case OPERAND_QUADWORD_SIZE: |
| 1455 addr = reinterpret_cast<byte*>(*reinterpret_cast<int64_t*>(data + 1)); | 1467 addr = reinterpret_cast<byte*>(*reinterpret_cast<int64_t*>(data + 1)); |
| 1456 data += 9; | 1468 data += 9; |
| 1457 break; | 1469 break; |
| 1458 default: | 1470 default: |
| 1459 UNREACHABLE(); | 1471 UNREACHABLE(); |
| 1460 } | 1472 } |
| 1461 AppendToBuffer("mov%c %s,%s", | 1473 AppendToBuffer("mov%c %s,%s", |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1916 for (int i = 6 - static_cast<int>(pc - prev_pc); i >= 0; i--) { | 1928 for (int i = 6 - static_cast<int>(pc - prev_pc); i >= 0; i--) { |
| 1917 fprintf(f, " "); | 1929 fprintf(f, " "); |
| 1918 } | 1930 } |
| 1919 fprintf(f, " %s\n", buffer.start()); | 1931 fprintf(f, " %s\n", buffer.start()); |
| 1920 } | 1932 } |
| 1921 } | 1933 } |
| 1922 | 1934 |
| 1923 } // namespace disasm | 1935 } // namespace disasm |
| 1924 | 1936 |
| 1925 #endif // V8_TARGET_ARCH_X64 | 1937 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |