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 #include "src/v8.h" | 9 #include "src/v8.h" |
10 | 10 |
(...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1028 AppendToBuffer("%s", mnem); | 1028 AppendToBuffer("%s", mnem); |
1029 } | 1029 } |
1030 return 2; | 1030 return 2; |
1031 } | 1031 } |
1032 | 1032 |
1033 | 1033 |
1034 // Mnemonics for instructions 0xF0 byte. | 1034 // Mnemonics for instructions 0xF0 byte. |
1035 // Returns NULL if the instruction is not handled here. | 1035 // Returns NULL if the instruction is not handled here. |
1036 static const char* F0Mnem(byte f0byte) { | 1036 static const char* F0Mnem(byte f0byte) { |
1037 switch (f0byte) { | 1037 switch (f0byte) { |
| 1038 case 0x0B: |
| 1039 return "ud2"; |
1038 case 0x18: return "prefetch"; | 1040 case 0x18: return "prefetch"; |
1039 case 0xA2: return "cpuid"; | 1041 case 0xA2: return "cpuid"; |
1040 case 0xBE: return "movsx_b"; | 1042 case 0xBE: return "movsx_b"; |
1041 case 0xBF: return "movsx_w"; | 1043 case 0xBF: return "movsx_w"; |
1042 case 0xB6: return "movzx_b"; | 1044 case 0xB6: return "movzx_b"; |
1043 case 0xB7: return "movzx_w"; | 1045 case 0xB7: return "movzx_w"; |
1044 case 0xAF: return "imul"; | 1046 case 0xAF: return "imul"; |
1045 case 0xA5: return "shld"; | 1047 case 0xA5: return "shld"; |
1046 case 0xAD: return "shrd"; | 1048 case 0xAD: return "shrd"; |
1047 case 0xAC: return "shrd"; // 3-operand version. | 1049 case 0xAC: return "shrd"; // 3-operand version. |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1208 data += 5; | 1210 data += 5; |
1209 } else if (f0byte == 0x1F && data[2] == 0x80 && data[3] == 0 && | 1211 } else if (f0byte == 0x1F && data[2] == 0x80 && data[3] == 0 && |
1210 data[4] == 0 && data[5] == 0 && data[6] == 0) { | 1212 data[4] == 0 && data[5] == 0 && data[6] == 0) { |
1211 AppendToBuffer("nop"); // 7 byte nop. | 1213 AppendToBuffer("nop"); // 7 byte nop. |
1212 data += 7; | 1214 data += 7; |
1213 } else if (f0byte == 0x1F && data[2] == 0x84 && data[3] == 0 && | 1215 } else if (f0byte == 0x1F && data[2] == 0x84 && data[3] == 0 && |
1214 data[4] == 0 && data[5] == 0 && data[6] == 0 && | 1216 data[4] == 0 && data[5] == 0 && data[6] == 0 && |
1215 data[7] == 0) { | 1217 data[7] == 0) { |
1216 AppendToBuffer("nop"); // 8 byte nop. | 1218 AppendToBuffer("nop"); // 8 byte nop. |
1217 data += 8; | 1219 data += 8; |
1218 } else if (f0byte == 0xA2 || f0byte == 0x31) { | 1220 } else if (f0byte == 0x0B || f0byte == 0xA2 || f0byte == 0x31) { |
1219 AppendToBuffer("%s", f0mnem); | 1221 AppendToBuffer("%s", f0mnem); |
1220 data += 2; | 1222 data += 2; |
1221 } else if (f0byte == 0x28) { | 1223 } else if (f0byte == 0x28) { |
1222 data += 2; | 1224 data += 2; |
1223 int mod, regop, rm; | 1225 int mod, regop, rm; |
1224 get_modrm(*data, &mod, ®op, &rm); | 1226 get_modrm(*data, &mod, ®op, &rm); |
1225 AppendToBuffer("movaps %s,%s", | 1227 AppendToBuffer("movaps %s,%s", |
1226 NameOfXMMRegister(regop), | 1228 NameOfXMMRegister(regop), |
1227 NameOfXMMRegister(rm)); | 1229 NameOfXMMRegister(rm)); |
1228 data++; | 1230 data++; |
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1988 fprintf(f, " "); | 1990 fprintf(f, " "); |
1989 } | 1991 } |
1990 fprintf(f, " %s\n", buffer.start()); | 1992 fprintf(f, " %s\n", buffer.start()); |
1991 } | 1993 } |
1992 } | 1994 } |
1993 | 1995 |
1994 | 1996 |
1995 } // namespace disasm | 1997 } // namespace disasm |
1996 | 1998 |
1997 #endif // V8_TARGET_ARCH_IA32 | 1999 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |