OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/disassembler.h" | 5 #include "vm/disassembler.h" |
6 | 6 |
7 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. | 7 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
8 #if defined(TARGET_ARCH_X64) | 8 #if defined(TARGET_ARCH_X64) |
9 #include "platform/utils.h" | 9 #include "platform/utils.h" |
10 #include "vm/allocation.h" | 10 #include "vm/allocation.h" |
(...skipping 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1387 current += 4; | 1387 current += 4; |
1388 } // else no immediate displacement. | 1388 } // else no immediate displacement. |
1389 AppendToBuffer("nop"); | 1389 AppendToBuffer("nop"); |
1390 | 1390 |
1391 } else if (opcode == 0x28) { | 1391 } else if (opcode == 0x28) { |
1392 // movaps xmm, xmm/m128 | 1392 // movaps xmm, xmm/m128 |
1393 int mod, regop, rm; | 1393 int mod, regop, rm; |
1394 get_modrm(*current, &mod, ®op, &rm); | 1394 get_modrm(*current, &mod, ®op, &rm); |
1395 AppendToBuffer("movaps %s, ", NameOfXMMRegister(regop)); | 1395 AppendToBuffer("movaps %s, ", NameOfXMMRegister(regop)); |
1396 current += PrintRightXMMOperand(current); | 1396 current += PrintRightXMMOperand(current); |
1397 | |
1398 } else if (opcode == 0x29) { | 1397 } else if (opcode == 0x29) { |
1399 // movaps xmm/m128, xmm | 1398 // movaps xmm/m128, xmm |
1400 int mod, regop, rm; | 1399 int mod, regop, rm; |
1401 get_modrm(*current, &mod, ®op, &rm); | 1400 get_modrm(*current, &mod, ®op, &rm); |
1402 AppendToBuffer("movaps "); | 1401 AppendToBuffer("movaps "); |
1403 current += PrintRightXMMOperand(current); | 1402 current += PrintRightXMMOperand(current); |
1404 AppendToBuffer(", %s", NameOfXMMRegister(regop)); | 1403 AppendToBuffer(", %s", NameOfXMMRegister(regop)); |
1405 | 1404 } else if (opcode == 0x11) { |
| 1405 // movups xmm/m128, xmm |
| 1406 int mod, regop, rm; |
| 1407 get_modrm(*current, &mod, ®op, &rm); |
| 1408 AppendToBuffer("movups "); |
| 1409 current += PrintRightXMMOperand(current); |
| 1410 AppendToBuffer(", %s", NameOfXMMRegister(regop)); |
| 1411 } else if (opcode == 0x10) { |
| 1412 // movups xmm, xmm/m128 |
| 1413 int mod, regop, rm; |
| 1414 get_modrm(*current, &mod, ®op, &rm); |
| 1415 AppendToBuffer("movups %s, ", NameOfXMMRegister(regop)); |
| 1416 current += PrintRightXMMOperand(current); |
1406 } else if (opcode == 0xA2 || opcode == 0x31) { | 1417 } else if (opcode == 0xA2 || opcode == 0x31) { |
1407 // RDTSC or CPUID | 1418 // RDTSC or CPUID |
1408 AppendToBuffer("%s", mnemonic); | 1419 AppendToBuffer("%s", mnemonic); |
1409 | 1420 |
1410 } else if ((opcode & 0xF0) == 0x40) { | 1421 } else if ((opcode & 0xF0) == 0x40) { |
1411 // CMOVcc: conditional move. | 1422 // CMOVcc: conditional move. |
1412 int condition = opcode & 0x0F; | 1423 int condition = opcode & 0x0F; |
1413 const InstructionDesc& idesc = cmov_instructions[condition]; | 1424 const InstructionDesc& idesc = cmov_instructions[condition]; |
1414 byte_size_operand_ = idesc.byte_size_operation; | 1425 byte_size_operand_ = idesc.byte_size_operation; |
1415 current += PrintOperands(idesc.mnem, idesc.op_order_, current); | 1426 current += PrintOperands(idesc.mnem, idesc.op_order_, current); |
1416 | 1427 |
1417 } else if (opcode == 0x57) { | 1428 } else if (opcode == 0x51 || opcode == 0x52 || opcode == 0x53 || |
1418 // xorps xmm, xmm/m128 | 1429 opcode == 0x54 || opcode == 0x56 || opcode == 0x57 || |
| 1430 opcode == 0x58 || opcode == 0x59 || opcode == 0x5C || |
| 1431 opcode == 0x5D || opcode == 0x5E || opcode == 0x5F) { |
| 1432 const char* mnemonic = NULL; |
| 1433 switch (opcode) { |
| 1434 case 0x51: mnemonic = "sqrtps"; break; |
| 1435 case 0x52: mnemonic = "rsqrtps"; break; |
| 1436 case 0x53: mnemonic = "rcpps"; break; |
| 1437 case 0x54: mnemonic = "andps"; break; |
| 1438 case 0x56: mnemonic = "orps"; break; |
| 1439 case 0x57: mnemonic = "xorps"; break; |
| 1440 case 0x58: mnemonic = "addps"; break; |
| 1441 case 0x59: mnemonic = "mulps"; break; |
| 1442 case 0x5C: mnemonic = "subps"; break; |
| 1443 case 0x5D: mnemonic = "minps"; break; |
| 1444 case 0x5E: mnemonic = "divps"; break; |
| 1445 case 0x5F: mnemonic = "maxps"; break; |
| 1446 default: UNREACHABLE(); |
| 1447 } |
1419 int mod, regop, rm; | 1448 int mod, regop, rm; |
1420 get_modrm(*current, &mod, ®op, &rm); | 1449 get_modrm(*current, &mod, ®op, &rm); |
1421 AppendToBuffer("xorps %s, ", NameOfXMMRegister(regop)); | 1450 AppendToBuffer("%s %s, ", mnemonic, NameOfXMMRegister(regop)); |
1422 current += PrintRightXMMOperand(current); | 1451 current += PrintRightXMMOperand(current); |
1423 | 1452 } else if (opcode == 0xC2 || opcode == 0xC6) { |
| 1453 int mod, regop, rm; |
| 1454 get_modrm(*current, &mod, ®op, &rm); |
| 1455 if (opcode == 0xC2) { |
| 1456 AppendToBuffer("cmpps %s, ", NameOfXMMRegister(regop)); |
| 1457 } else { |
| 1458 ASSERT(opcode == 0xC6); |
| 1459 AppendToBuffer("shufps %s, ", NameOfXMMRegister(regop)); |
| 1460 } |
| 1461 current += PrintRightXMMOperand(current); |
| 1462 AppendToBuffer(" [%x]", *current); |
| 1463 current++; |
1424 } else if ((opcode & 0xF0) == 0x80) { | 1464 } else if ((opcode & 0xF0) == 0x80) { |
1425 // Jcc: Conditional jump (branch). | 1465 // Jcc: Conditional jump (branch). |
1426 current = data + JumpConditional(data); | 1466 current = data + JumpConditional(data); |
1427 | 1467 |
1428 } else if (opcode == 0xBE || opcode == 0xBF || opcode == 0xB6 || | 1468 } else if (opcode == 0xBE || opcode == 0xBF || opcode == 0xB6 || |
1429 opcode == 0xB7 || opcode == 0xAF) { | 1469 opcode == 0xB7 || opcode == 0xAF) { |
1430 // Size-extending moves, IMUL. | 1470 // Size-extending moves, IMUL. |
1431 current += PrintOperands(mnemonic, REG_OPER_OP_ORDER, current); | 1471 current += PrintOperands(mnemonic, REG_OPER_OP_ORDER, current); |
1432 | 1472 |
1433 } else if ((opcode & 0xF0) == 0x90) { | 1473 } else if ((opcode & 0xF0) == 0x90) { |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1873 human_buffer, | 1913 human_buffer, |
1874 sizeof(human_buffer), | 1914 sizeof(human_buffer), |
1875 pc); | 1915 pc); |
1876 pc += instruction_length; | 1916 pc += instruction_length; |
1877 } | 1917 } |
1878 } | 1918 } |
1879 | 1919 |
1880 } // namespace dart | 1920 } // namespace dart |
1881 | 1921 |
1882 #endif // defined TARGET_ARCH_X64 | 1922 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |