Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2008 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 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 810 AppendToBuffer("%s", mnem); | 810 AppendToBuffer("%s", mnem); |
| 811 } | 811 } |
| 812 return 2; | 812 return 2; |
| 813 } | 813 } |
| 814 | 814 |
| 815 | 815 |
| 816 // Mnemonics for instructions 0xF0 byte. | 816 // Mnemonics for instructions 0xF0 byte. |
| 817 // Returns NULL if the instruction is not handled here. | 817 // Returns NULL if the instruction is not handled here. |
| 818 static const char* F0Mnem(byte f0byte) { | 818 static const char* F0Mnem(byte f0byte) { |
| 819 switch (f0byte) { | 819 switch (f0byte) { |
| 820 case 0x18: return "prefetch"; | |
|
Erik Corry
2010/06/04 07:07:40
What about the other instructions? Can they alrea
Lasse Reichstein
2010/06/04 11:52:13
movntdq[a] can't, but they aren't used yet either.
| |
| 820 case 0xA2: return "cpuid"; | 821 case 0xA2: return "cpuid"; |
| 821 case 0x31: return "rdtsc"; | 822 case 0x31: return "rdtsc"; |
| 822 case 0xBE: return "movsx_b"; | 823 case 0xBE: return "movsx_b"; |
| 823 case 0xBF: return "movsx_w"; | 824 case 0xBF: return "movsx_w"; |
| 824 case 0xB6: return "movzx_b"; | 825 case 0xB6: return "movzx_b"; |
| 825 case 0xB7: return "movzx_w"; | 826 case 0xB7: return "movzx_w"; |
| 826 case 0xAF: return "imul"; | 827 case 0xAF: return "imul"; |
| 827 case 0xA5: return "shld"; | 828 case 0xA5: return "shld"; |
| 828 case 0xAD: return "shrd"; | 829 case 0xAD: return "shrd"; |
| 829 case 0xAB: return "bts"; | 830 case 0xAB: return "bts"; |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 935 break; | 936 break; |
| 936 | 937 |
| 937 case 0x81: // fall through | 938 case 0x81: // fall through |
| 938 case 0x83: // 0x81 with sign extension bit set | 939 case 0x83: // 0x81 with sign extension bit set |
| 939 data += PrintImmediateOp(data); | 940 data += PrintImmediateOp(data); |
| 940 break; | 941 break; |
| 941 | 942 |
| 942 case 0x0F: | 943 case 0x0F: |
| 943 { byte f0byte = *(data+1); | 944 { byte f0byte = *(data+1); |
| 944 const char* f0mnem = F0Mnem(f0byte); | 945 const char* f0mnem = F0Mnem(f0byte); |
| 945 if (f0byte == 0xA2 || f0byte == 0x31) { | 946 if (f0byte == 0x18) { |
| 947 int mod, regop, rm; | |
| 948 get_modrm(*data, &mod, ®op, &rm); | |
| 949 const char* suffix[] = {"nta", "1", "2", "3"}; | |
| 950 AppendToBuffer("%s%s ", f0mnem, suffix[regop & 0x03]); | |
| 951 data += PrintRightOperand(data); | |
| 952 } else if (f0byte == 0xA2 || f0byte == 0x31) { | |
| 946 AppendToBuffer("%s", f0mnem); | 953 AppendToBuffer("%s", f0mnem); |
| 947 data += 2; | 954 data += 2; |
| 948 } else if ((f0byte & 0xF0) == 0x80) { | 955 } else if ((f0byte & 0xF0) == 0x80) { |
| 949 data += JumpConditional(data, branch_hint); | 956 data += JumpConditional(data, branch_hint); |
| 950 } else if (f0byte == 0xBE || f0byte == 0xBF || f0byte == 0xB6 || | 957 } else if (f0byte == 0xBE || f0byte == 0xBF || f0byte == 0xB6 || |
| 951 f0byte == 0xB7 || f0byte == 0xAF) { | 958 f0byte == 0xB7 || f0byte == 0xAF) { |
| 952 data += 2; | 959 data += 2; |
| 953 data += PrintOperands(f0mnem, REG_OPER_OP_ORDER, data); | 960 data += PrintOperands(f0mnem, REG_OPER_OP_ORDER, data); |
| 954 } else if ((f0byte & 0xF0) == 0x90) { | 961 } else if ((f0byte & 0xF0) == 0x90) { |
| 955 data += SetCC(data); | 962 data += SetCC(data); |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1437 fprintf(f, " "); | 1444 fprintf(f, " "); |
| 1438 } | 1445 } |
| 1439 fprintf(f, " %s\n", buffer.start()); | 1446 fprintf(f, " %s\n", buffer.start()); |
| 1440 } | 1447 } |
| 1441 } | 1448 } |
| 1442 | 1449 |
| 1443 | 1450 |
| 1444 } // namespace disasm | 1451 } // namespace disasm |
| 1445 | 1452 |
| 1446 #endif // V8_TARGET_ARCH_IA32 | 1453 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |