| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <assert.h> | 5 #include <assert.h> |
| 6 #include <stdarg.h> | 6 #include <stdarg.h> |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 | 8 |
| 9 #if V8_TARGET_ARCH_IA32 | 9 #if V8_TARGET_ARCH_IA32 |
| 10 | 10 |
| (...skipping 1604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1615 data += PrintRightOperand(data); | 1615 data += PrintRightOperand(data); |
| 1616 AppendToBuffer(",%s", NameOfCPURegister(regop)); | 1616 AppendToBuffer(",%s", NameOfCPURegister(regop)); |
| 1617 } | 1617 } |
| 1618 } | 1618 } |
| 1619 break; | 1619 break; |
| 1620 | 1620 |
| 1621 case 0x66: // prefix | 1621 case 0x66: // prefix |
| 1622 while (*data == 0x66) data++; | 1622 while (*data == 0x66) data++; |
| 1623 if (*data == 0xf && data[1] == 0x1f) { | 1623 if (*data == 0xf && data[1] == 0x1f) { |
| 1624 AppendToBuffer("nop"); // 0x66 prefix | 1624 AppendToBuffer("nop"); // 0x66 prefix |
| 1625 } else if (*data == 0x39) { | 1625 } else if (*data == 0x90) { |
| 1626 AppendToBuffer("nop"); // 0x66 prefix |
| 1627 } else if (*data == 0x8B) { |
| 1626 data++; | 1628 data++; |
| 1627 data += PrintOperands("cmpw", OPER_REG_OP_ORDER, data); | 1629 data += PrintOperands("mov_w", REG_OPER_OP_ORDER, data); |
| 1628 } else if (*data == 0x3B) { | |
| 1629 data++; | |
| 1630 data += PrintOperands("cmpw", REG_OPER_OP_ORDER, data); | |
| 1631 } else if (*data == 0x81) { | |
| 1632 data++; | |
| 1633 AppendToBuffer("cmpw "); | |
| 1634 data += PrintRightOperand(data); | |
| 1635 int imm = *reinterpret_cast<int16_t*>(data); | |
| 1636 AppendToBuffer(",0x%x", imm); | |
| 1637 data += 2; | |
| 1638 } else if (*data == 0x87) { | 1630 } else if (*data == 0x87) { |
| 1639 data++; | 1631 data++; |
| 1640 int mod, regop, rm; | 1632 int mod, regop, rm; |
| 1641 get_modrm(*data, &mod, ®op, &rm); | 1633 get_modrm(*data, &mod, ®op, &rm); |
| 1642 AppendToBuffer("xchg_w %s,", NameOfCPURegister(regop)); | 1634 AppendToBuffer("xchg_w %s,", NameOfCPURegister(regop)); |
| 1643 data += PrintRightOperand(data); | 1635 data += PrintRightOperand(data); |
| 1644 } else if (*data == 0x89) { | 1636 } else if (*data == 0x89) { |
| 1645 data++; | 1637 data++; |
| 1646 int mod, regop, rm; | 1638 int mod, regop, rm; |
| 1647 get_modrm(*data, &mod, ®op, &rm); | 1639 get_modrm(*data, &mod, ®op, &rm); |
| 1648 AppendToBuffer("mov_w "); | 1640 AppendToBuffer("mov_w "); |
| 1649 data += PrintRightOperand(data); | 1641 data += PrintRightOperand(data); |
| 1650 AppendToBuffer(",%s", NameOfCPURegister(regop)); | 1642 AppendToBuffer(",%s", NameOfCPURegister(regop)); |
| 1651 } else if (*data == 0x8B) { | |
| 1652 data++; | |
| 1653 data += PrintOperands("mov_w", REG_OPER_OP_ORDER, data); | |
| 1654 } else if (*data == 0x90) { | |
| 1655 AppendToBuffer("nop"); // 0x66 prefix | |
| 1656 } else if (*data == 0xC7) { | 1643 } else if (*data == 0xC7) { |
| 1657 data++; | 1644 data++; |
| 1658 AppendToBuffer("%s ", "mov_w"); | 1645 AppendToBuffer("%s ", "mov_w"); |
| 1659 data += PrintRightOperand(data); | 1646 data += PrintRightOperand(data); |
| 1660 int imm = *reinterpret_cast<int16_t*>(data); | 1647 int imm = *reinterpret_cast<int16_t*>(data); |
| 1661 AppendToBuffer(",0x%x", imm); | 1648 AppendToBuffer(",0x%x", imm); |
| 1662 data += 2; | 1649 data += 2; |
| 1663 } else if (*data == 0xF7) { | 1650 } else if (*data == 0xF7) { |
| 1664 data++; | 1651 data++; |
| 1665 AppendToBuffer("%s ", "test_w"); | 1652 AppendToBuffer("%s ", "test_w"); |
| (...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2321 fprintf(f, " "); | 2308 fprintf(f, " "); |
| 2322 } | 2309 } |
| 2323 fprintf(f, " %s\n", buffer.start()); | 2310 fprintf(f, " %s\n", buffer.start()); |
| 2324 } | 2311 } |
| 2325 } | 2312 } |
| 2326 | 2313 |
| 2327 | 2314 |
| 2328 } // namespace disasm | 2315 } // namespace disasm |
| 2329 | 2316 |
| 2330 #endif // V8_TARGET_ARCH_IA32 | 2317 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |