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 1504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1515 | 1515 |
1516 } else if (opcode == 0xBE || opcode == 0xBF || opcode == 0xB6 || | 1516 } else if (opcode == 0xBE || opcode == 0xBF || opcode == 0xB6 || |
1517 opcode == 0xB7 || opcode == 0xAF) { | 1517 opcode == 0xB7 || opcode == 0xAF) { |
1518 // Size-extending moves, IMUL. | 1518 // Size-extending moves, IMUL. |
1519 current += PrintOperands(mnemonic, REG_OPER_OP_ORDER, current); | 1519 current += PrintOperands(mnemonic, REG_OPER_OP_ORDER, current); |
1520 | 1520 |
1521 } else if ((opcode & 0xF0) == 0x90) { | 1521 } else if ((opcode & 0xF0) == 0x90) { |
1522 // SETcc: Set byte on condition. Needs pointer to beginning of instruction. | 1522 // SETcc: Set byte on condition. Needs pointer to beginning of instruction. |
1523 current = data + SetCC(data); | 1523 current = data + SetCC(data); |
1524 | 1524 |
1525 } else if ((opcode & 0xFE) == 0xA4 || (opcode & 0xFE) == 0xAC || | 1525 } else if (((opcode & 0xFE) == 0xA4) || ((opcode & 0xFE) == 0xAC) || |
1526 opcode == 0xAB || opcode == 0xA3) { | 1526 (opcode == 0xAB) || (opcode == 0xA3) || (opcode == 0xBD)) { |
1527 // SHLD, SHRD (double-prec. shift), BTS (bit test and set), BT (bit test). | 1527 // SHLD, SHRD (double-prec. shift), BTS (bit test and set), BT (bit test). |
1528 AppendToBuffer("%s%c ", mnemonic, operand_size_code()); | 1528 AppendToBuffer("%s%c ", mnemonic, operand_size_code()); |
1529 int mod, regop, rm; | 1529 int mod, regop, rm; |
1530 get_modrm(*current, &mod, ®op, &rm); | 1530 get_modrm(*current, &mod, ®op, &rm); |
1531 current += PrintRightOperand(current); | 1531 current += PrintRightOperand(current); |
1532 AppendToBuffer(",%s", NameOfCPURegister(regop)); | 1532 AppendToBuffer(",%s", NameOfCPURegister(regop)); |
1533 if (opcode == 0xAB || opcode == 0xA3) { | 1533 if ((opcode == 0xAB) || (opcode == 0xA3) || (opcode == 0xBD)) { |
1534 // Done. | 1534 // Done. |
1535 } else if (opcode == 0xA5 || opcode == 0xAD) { | 1535 } else if ((opcode == 0xA5) || (opcode == 0xAD)) { |
1536 AppendToBuffer(",cl"); | 1536 AppendToBuffer(",cl"); |
1537 } else { | 1537 } else { |
1538 AppendToBuffer(","); | 1538 AppendToBuffer(","); |
1539 current += PrintImmediate(current, BYTE_SIZE); | 1539 current += PrintImmediate(current, BYTE_SIZE); |
1540 } | 1540 } |
1541 } else { | 1541 } else { |
1542 UnimplementedInstruction(); | 1542 UnimplementedInstruction(); |
1543 } | 1543 } |
1544 return static_cast<int>(current - data); | 1544 return static_cast<int>(current - data); |
1545 } | 1545 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1579 case 0xAD: | 1579 case 0xAD: |
1580 return "shrd"; | 1580 return "shrd"; |
1581 case 0xAF: | 1581 case 0xAF: |
1582 return "imul"; | 1582 return "imul"; |
1583 case 0xB6: | 1583 case 0xB6: |
1584 return "movzxb"; | 1584 return "movzxb"; |
1585 case 0xB7: | 1585 case 0xB7: |
1586 return "movzxw"; | 1586 return "movzxw"; |
1587 case 0xBE: | 1587 case 0xBE: |
1588 return "movsxb"; | 1588 return "movsxb"; |
| 1589 case 0xBD: |
| 1590 return "bsr"; |
1589 case 0xBF: | 1591 case 0xBF: |
1590 return "movsxw"; | 1592 return "movsxw"; |
1591 case 0x12: | 1593 case 0x12: |
1592 return "movhlps"; | 1594 return "movhlps"; |
1593 case 0x16: | 1595 case 0x16: |
1594 return "movlhps"; | 1596 return "movlhps"; |
1595 default: | 1597 default: |
1596 return NULL; | 1598 return NULL; |
1597 } | 1599 } |
1598 } | 1600 } |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1943 } | 1945 } |
1944 hex_buffer[hex_index] = '\0'; | 1946 hex_buffer[hex_index] = '\0'; |
1945 if (out_instr_len) { | 1947 if (out_instr_len) { |
1946 *out_instr_len = instruction_length; | 1948 *out_instr_len = instruction_length; |
1947 } | 1949 } |
1948 } | 1950 } |
1949 | 1951 |
1950 } // namespace dart | 1952 } // namespace dart |
1951 | 1953 |
1952 #endif // defined TARGET_ARCH_X64 | 1954 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |