| 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 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 869 const char* mnem = conditional_code_suffix[cond]; | 869 const char* mnem = conditional_code_suffix[cond]; |
| 870 AppendToBuffer("set%s%c ", mnem, operand_size_code()); | 870 AppendToBuffer("set%s%c ", mnem, operand_size_code()); |
| 871 PrintRightByteOperand(data + 2); | 871 PrintRightByteOperand(data + 2); |
| 872 return 3; // includes 0x0F | 872 return 3; // includes 0x0F |
| 873 } | 873 } |
| 874 | 874 |
| 875 | 875 |
| 876 int DisassemblerX64::AVXInstruction(byte* data) { | 876 int DisassemblerX64::AVXInstruction(byte* data) { |
| 877 byte opcode = *data; | 877 byte opcode = *data; |
| 878 byte* current = data + 1; | 878 byte* current = data + 1; |
| 879 if (vex_0f() && opcode == 0x2e) { | 879 if (vex_66() && vex_0f38()) { |
| 880 int mod, regop, rm; | |
| 881 get_modrm(*current, &mod, ®op, &rm); | |
| 882 AppendToBuffer("vucomis%c %s,", vex_66() ? 'd' : 's', | |
| 883 NameOfXMMRegister(regop)); | |
| 884 current += PrintRightXMMOperand(current); | |
| 885 } else if (vex_66() && vex_0f38()) { | |
| 886 int mod, regop, rm, vvvv = vex_vreg(); | 880 int mod, regop, rm, vvvv = vex_vreg(); |
| 887 get_modrm(*current, &mod, ®op, &rm); | 881 get_modrm(*current, &mod, ®op, &rm); |
| 888 switch (opcode) { | 882 switch (opcode) { |
| 889 case 0x99: | 883 case 0x99: |
| 890 AppendToBuffer("vfmadd132s%c %s,%s,", float_size_code(), | 884 AppendToBuffer("vfmadd132s%c %s,%s,", float_size_code(), |
| 891 NameOfXMMRegister(regop), NameOfXMMRegister(vvvv)); | 885 NameOfXMMRegister(regop), NameOfXMMRegister(vvvv)); |
| 892 current += PrintRightXMMOperand(current); | 886 current += PrintRightXMMOperand(current); |
| 893 break; | 887 break; |
| 894 case 0xa9: | 888 case 0xa9: |
| 895 AppendToBuffer("vfmadd213s%c %s,%s,", float_size_code(), | 889 AppendToBuffer("vfmadd213s%c %s,%s,", float_size_code(), |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1130 AppendToBuffer(",%d", *current & 0x3f); | 1124 AppendToBuffer(",%d", *current & 0x3f); |
| 1131 break; | 1125 break; |
| 1132 default: | 1126 default: |
| 1133 UnimplementedInstruction(); | 1127 UnimplementedInstruction(); |
| 1134 } | 1128 } |
| 1135 current += 1; | 1129 current += 1; |
| 1136 break; | 1130 break; |
| 1137 default: | 1131 default: |
| 1138 UnimplementedInstruction(); | 1132 UnimplementedInstruction(); |
| 1139 } | 1133 } |
| 1134 } else if (vex_none() && vex_0f()) { |
| 1135 int mod, regop, rm, vvvv = vex_vreg(); |
| 1136 get_modrm(*current, &mod, ®op, &rm); |
| 1137 switch (opcode) { |
| 1138 case 0x2e: |
| 1139 AppendToBuffer("vucomiss %s,", NameOfXMMRegister(regop)); |
| 1140 current += PrintRightXMMOperand(current); |
| 1141 break; |
| 1142 case 0x54: |
| 1143 AppendToBuffer("vandps %s,%s,", NameOfXMMRegister(regop), |
| 1144 NameOfXMMRegister(vvvv)); |
| 1145 current += PrintRightXMMOperand(current); |
| 1146 break; |
| 1147 case 0x57: |
| 1148 AppendToBuffer("vxorps %s,%s,", NameOfXMMRegister(regop), |
| 1149 NameOfXMMRegister(vvvv)); |
| 1150 current += PrintRightXMMOperand(current); |
| 1151 break; |
| 1152 default: |
| 1153 UnimplementedInstruction(); |
| 1154 } |
| 1155 } else if (vex_66() && vex_0f()) { |
| 1156 int mod, regop, rm, vvvv = vex_vreg(); |
| 1157 get_modrm(*current, &mod, ®op, &rm); |
| 1158 switch (opcode) { |
| 1159 case 0x2e: |
| 1160 AppendToBuffer("vucomisd %s,", NameOfXMMRegister(regop)); |
| 1161 current += PrintRightXMMOperand(current); |
| 1162 break; |
| 1163 case 0x54: |
| 1164 AppendToBuffer("vandpd %s,%s,", NameOfXMMRegister(regop), |
| 1165 NameOfXMMRegister(vvvv)); |
| 1166 current += PrintRightXMMOperand(current); |
| 1167 break; |
| 1168 case 0x57: |
| 1169 AppendToBuffer("vxorpd %s,%s,", NameOfXMMRegister(regop), |
| 1170 NameOfXMMRegister(vvvv)); |
| 1171 current += PrintRightXMMOperand(current); |
| 1172 break; |
| 1173 default: |
| 1174 UnimplementedInstruction(); |
| 1175 } |
| 1176 |
| 1140 } else { | 1177 } else { |
| 1141 UnimplementedInstruction(); | 1178 UnimplementedInstruction(); |
| 1142 } | 1179 } |
| 1143 | 1180 |
| 1144 return static_cast<int>(current - data); | 1181 return static_cast<int>(current - data); |
| 1145 } | 1182 } |
| 1146 | 1183 |
| 1147 | 1184 |
| 1148 // Returns number of bytes used, including *data. | 1185 // Returns number of bytes used, including *data. |
| 1149 int DisassemblerX64::FPUInstruction(byte* data) { | 1186 int DisassemblerX64::FPUInstruction(byte* data) { |
| (...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2316 for (int i = 6 - static_cast<int>(pc - prev_pc); i >= 0; i--) { | 2353 for (int i = 6 - static_cast<int>(pc - prev_pc); i >= 0; i--) { |
| 2317 fprintf(f, " "); | 2354 fprintf(f, " "); |
| 2318 } | 2355 } |
| 2319 fprintf(f, " %s\n", buffer.start()); | 2356 fprintf(f, " %s\n", buffer.start()); |
| 2320 } | 2357 } |
| 2321 } | 2358 } |
| 2322 | 2359 |
| 2323 } // namespace disasm | 2360 } // namespace disasm |
| 2324 | 2361 |
| 2325 #endif // V8_TARGET_ARCH_X64 | 2362 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |