| 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 1585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1596 data += PrintRightOperand(data); | 1596 data += PrintRightOperand(data); |
| 1597 AppendToBuffer(",%s", NameOfCPURegister(regop)); | 1597 AppendToBuffer(",%s", NameOfCPURegister(regop)); |
| 1598 } | 1598 } |
| 1599 } | 1599 } |
| 1600 break; | 1600 break; |
| 1601 | 1601 |
| 1602 case 0x66: // prefix | 1602 case 0x66: // prefix |
| 1603 while (*data == 0x66) data++; | 1603 while (*data == 0x66) data++; |
| 1604 if (*data == 0xf && data[1] == 0x1f) { | 1604 if (*data == 0xf && data[1] == 0x1f) { |
| 1605 AppendToBuffer("nop"); // 0x66 prefix | 1605 AppendToBuffer("nop"); // 0x66 prefix |
| 1606 } else if (*data == 0x90) { | 1606 } else if (*data == 0x39) { |
| 1607 AppendToBuffer("nop"); // 0x66 prefix | |
| 1608 } else if (*data == 0x8B) { | |
| 1609 data++; | 1607 data++; |
| 1610 data += PrintOperands("mov_w", REG_OPER_OP_ORDER, data); | 1608 data += PrintOperands("cmpw", OPER_REG_OP_ORDER, data); |
| 1609 } else if (*data == 0x3B) { |
| 1610 data++; |
| 1611 data += PrintOperands("cmpw", REG_OPER_OP_ORDER, data); |
| 1612 } else if (*data == 0x81) { |
| 1613 data++; |
| 1614 AppendToBuffer("cmpw "); |
| 1615 data += PrintRightOperand(data); |
| 1616 int imm = *reinterpret_cast<int16_t*>(data); |
| 1617 AppendToBuffer(",0x%x", imm); |
| 1618 data += 2; |
| 1611 } else if (*data == 0x87) { | 1619 } else if (*data == 0x87) { |
| 1612 data++; | 1620 data++; |
| 1613 int mod, regop, rm; | 1621 int mod, regop, rm; |
| 1614 get_modrm(*data, &mod, ®op, &rm); | 1622 get_modrm(*data, &mod, ®op, &rm); |
| 1615 AppendToBuffer("xchg_w "); | 1623 AppendToBuffer("xchg_w "); |
| 1616 data += PrintRightOperand(data); | 1624 data += PrintRightOperand(data); |
| 1617 AppendToBuffer(",%s", NameOfCPURegister(regop)); | 1625 AppendToBuffer(",%s", NameOfCPURegister(regop)); |
| 1618 } else if (*data == 0x89) { | 1626 } else if (*data == 0x89) { |
| 1619 data++; | 1627 data++; |
| 1620 int mod, regop, rm; | 1628 int mod, regop, rm; |
| 1621 get_modrm(*data, &mod, ®op, &rm); | 1629 get_modrm(*data, &mod, ®op, &rm); |
| 1622 AppendToBuffer("mov_w "); | 1630 AppendToBuffer("mov_w "); |
| 1623 data += PrintRightOperand(data); | 1631 data += PrintRightOperand(data); |
| 1624 AppendToBuffer(",%s", NameOfCPURegister(regop)); | 1632 AppendToBuffer(",%s", NameOfCPURegister(regop)); |
| 1633 } else if (*data == 0x8B) { |
| 1634 data++; |
| 1635 data += PrintOperands("mov_w", REG_OPER_OP_ORDER, data); |
| 1636 } else if (*data == 0x90) { |
| 1637 AppendToBuffer("nop"); // 0x66 prefix |
| 1625 } else if (*data == 0xC7) { | 1638 } else if (*data == 0xC7) { |
| 1626 data++; | 1639 data++; |
| 1627 AppendToBuffer("%s ", "mov_w"); | 1640 AppendToBuffer("%s ", "mov_w"); |
| 1628 data += PrintRightOperand(data); | 1641 data += PrintRightOperand(data); |
| 1629 int imm = *reinterpret_cast<int16_t*>(data); | 1642 int imm = *reinterpret_cast<int16_t*>(data); |
| 1630 AppendToBuffer(",0x%x", imm); | 1643 AppendToBuffer(",0x%x", imm); |
| 1631 data += 2; | 1644 data += 2; |
| 1632 } else if (*data == 0xF7) { | 1645 } else if (*data == 0xF7) { |
| 1633 data++; | 1646 data++; |
| 1634 AppendToBuffer("%s ", "test_w"); | 1647 AppendToBuffer("%s ", "test_w"); |
| (...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2287 fprintf(f, " "); | 2300 fprintf(f, " "); |
| 2288 } | 2301 } |
| 2289 fprintf(f, " %s\n", buffer.start()); | 2302 fprintf(f, " %s\n", buffer.start()); |
| 2290 } | 2303 } |
| 2291 } | 2304 } |
| 2292 | 2305 |
| 2293 | 2306 |
| 2294 } // namespace disasm | 2307 } // namespace disasm |
| 2295 | 2308 |
| 2296 #endif // V8_TARGET_ARCH_IA32 | 2309 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |