| 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 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 byte modrm = *(data+1); | 547 byte modrm = *(data+1); |
| 548 int mod, regop, rm; | 548 int mod, regop, rm; |
| 549 get_modrm(modrm, &mod, ®op, &rm); | 549 get_modrm(modrm, &mod, ®op, &rm); |
| 550 if (mod == 3 && regop != 0) { | 550 if (mod == 3 && regop != 0) { |
| 551 const char* mnem = NULL; | 551 const char* mnem = NULL; |
| 552 switch (regop) { | 552 switch (regop) { |
| 553 case 2: mnem = "not"; break; | 553 case 2: mnem = "not"; break; |
| 554 case 3: mnem = "neg"; break; | 554 case 3: mnem = "neg"; break; |
| 555 case 4: mnem = "mul"; break; | 555 case 4: mnem = "mul"; break; |
| 556 case 5: mnem = "imul"; break; | 556 case 5: mnem = "imul"; break; |
| 557 case 6: mnem = "div"; break; |
| 557 case 7: mnem = "idiv"; break; | 558 case 7: mnem = "idiv"; break; |
| 558 default: UnimplementedInstruction(); | 559 default: UnimplementedInstruction(); |
| 559 } | 560 } |
| 560 AppendToBuffer("%s %s", mnem, NameOfCPURegister(rm)); | 561 AppendToBuffer("%s %s", mnem, NameOfCPURegister(rm)); |
| 561 return 2; | 562 return 2; |
| 562 } else if (mod == 3 && regop == eax) { | 563 } else if (mod == 3 && regop == eax) { |
| 563 int32_t imm = *reinterpret_cast<int32_t*>(data+2); | 564 int32_t imm = *reinterpret_cast<int32_t*>(data+2); |
| 564 AppendToBuffer("test %s,0x%x", NameOfCPURegister(rm), imm); | 565 AppendToBuffer("test %s,0x%x", NameOfCPURegister(rm), imm); |
| 565 return 6; | 566 return 6; |
| 566 } else if (regop == eax) { | 567 } else if (regop == eax) { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 if (op == 0xD1) { | 599 if (op == 0xD1) { |
| 599 imm8 = 1; | 600 imm8 = 1; |
| 600 } else if (op == 0xC1) { | 601 } else if (op == 0xC1) { |
| 601 imm8 = *(data+2); | 602 imm8 = *(data+2); |
| 602 num_bytes = 3; | 603 num_bytes = 3; |
| 603 } else if (op == 0xD3) { | 604 } else if (op == 0xD3) { |
| 604 // Shift/rotate by cl. | 605 // Shift/rotate by cl. |
| 605 } | 606 } |
| 606 ASSERT_NE(NULL, mnem); | 607 ASSERT_NE(NULL, mnem); |
| 607 AppendToBuffer("%s %s,", mnem, NameOfCPURegister(rm)); | 608 AppendToBuffer("%s %s,", mnem, NameOfCPURegister(rm)); |
| 608 if (imm8 > 0) { | 609 if (imm8 >= 0) { |
| 609 AppendToBuffer("%d", imm8); | 610 AppendToBuffer("%d", imm8); |
| 610 } else { | 611 } else { |
| 611 AppendToBuffer("cl"); | 612 AppendToBuffer("cl"); |
| 612 } | 613 } |
| 613 } else { | 614 } else { |
| 614 UnimplementedInstruction(); | 615 UnimplementedInstruction(); |
| 615 } | 616 } |
| 616 return num_bytes; | 617 return num_bytes; |
| 617 } | 618 } |
| 618 | 619 |
| (...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1717 fprintf(f, " "); | 1718 fprintf(f, " "); |
| 1718 } | 1719 } |
| 1719 fprintf(f, " %s\n", buffer.start()); | 1720 fprintf(f, " %s\n", buffer.start()); |
| 1720 } | 1721 } |
| 1721 } | 1722 } |
| 1722 | 1723 |
| 1723 | 1724 |
| 1724 } // namespace disasm | 1725 } // namespace disasm |
| 1725 | 1726 |
| 1726 #endif // V8_TARGET_ARCH_IA32 | 1727 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |