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 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1026 // roundsd xmm, xmm/m64, imm8 | 1026 // roundsd xmm, xmm/m64, imm8 |
1027 AppendToBuffer("roundsd %s, ", NameOfCPURegister(regop)); | 1027 AppendToBuffer("roundsd %s, ", NameOfCPURegister(regop)); |
1028 current += PrintRightOperand(current); | 1028 current += PrintRightOperand(current); |
1029 AppendToBuffer(", %d", (*current) & 3); | 1029 AppendToBuffer(", %d", (*current) & 3); |
1030 current += 1; | 1030 current += 1; |
1031 } else { | 1031 } else { |
1032 UnimplementedInstruction(); | 1032 UnimplementedInstruction(); |
1033 } | 1033 } |
1034 } else { | 1034 } else { |
1035 get_modrm(*current, &mod, ®op, &rm); | 1035 get_modrm(*current, &mod, ®op, &rm); |
1036 if (opcode == 0x6E) { | 1036 if (opcode == 0x28) { |
| 1037 AppendToBuffer("movapd %s, ", NameOfXMMRegister(regop)); |
| 1038 current += PrintRightXMMOperand(current); |
| 1039 } else if (opcode == 0x29) { |
| 1040 AppendToBuffer("movapd "); |
| 1041 current += PrintRightXMMOperand(current); |
| 1042 AppendToBuffer(", %s", NameOfXMMRegister(regop)); |
| 1043 } else if (opcode == 0x6E) { |
1037 AppendToBuffer("mov%c %s,", | 1044 AppendToBuffer("mov%c %s,", |
1038 rex_w() ? 'q' : 'd', | 1045 rex_w() ? 'q' : 'd', |
1039 NameOfXMMRegister(regop)); | 1046 NameOfXMMRegister(regop)); |
1040 current += PrintRightOperand(current); | 1047 current += PrintRightOperand(current); |
1041 } else if (opcode == 0x6F) { | 1048 } else if (opcode == 0x6F) { |
1042 AppendToBuffer("movdqa %s,", | 1049 AppendToBuffer("movdqa %s,", |
1043 NameOfXMMRegister(regop)); | 1050 NameOfXMMRegister(regop)); |
1044 current += PrintRightXMMOperand(current); | 1051 current += PrintRightXMMOperand(current); |
1045 } else if (opcode == 0x7E) { | 1052 } else if (opcode == 0x7E) { |
1046 AppendToBuffer("mov%c ", | 1053 AppendToBuffer("mov%c ", |
1047 rex_w() ? 'q' : 'd'); | 1054 rex_w() ? 'q' : 'd'); |
1048 current += PrintRightOperand(current); | 1055 current += PrintRightOperand(current); |
1049 AppendToBuffer(", %s", NameOfXMMRegister(regop)); | 1056 AppendToBuffer(", %s", NameOfXMMRegister(regop)); |
1050 } else if (opcode == 0x7F) { | 1057 } else if (opcode == 0x7F) { |
1051 AppendToBuffer("movdqa "); | 1058 AppendToBuffer("movdqa "); |
1052 current += PrintRightXMMOperand(current); | 1059 current += PrintRightXMMOperand(current); |
1053 AppendToBuffer(", %s", NameOfXMMRegister(regop)); | 1060 AppendToBuffer(", %s", NameOfXMMRegister(regop)); |
| 1061 } else if (opcode == 0xD6) { |
| 1062 AppendToBuffer("movq "); |
| 1063 current += PrintRightXMMOperand(current); |
| 1064 AppendToBuffer(", %s", NameOfXMMRegister(regop)); |
1054 } else { | 1065 } else { |
1055 const char* mnemonic = "?"; | 1066 const char* mnemonic = "?"; |
1056 if (opcode == 0x50) { | 1067 if (opcode == 0x50) { |
1057 mnemonic = "movmskpd"; | 1068 mnemonic = "movmskpd"; |
1058 } else if (opcode == 0x54) { | 1069 } else if (opcode == 0x54) { |
1059 mnemonic = "andpd"; | 1070 mnemonic = "andpd"; |
1060 } else if (opcode == 0x56) { | 1071 } else if (opcode == 0x56) { |
1061 mnemonic = "orpd"; | 1072 mnemonic = "orpd"; |
1062 } else if (opcode == 0x57) { | 1073 } else if (opcode == 0x57) { |
1063 mnemonic = "xorpd"; | 1074 mnemonic = "xorpd"; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1145 AppendToBuffer("cvttss2si%c %s,", | 1156 AppendToBuffer("cvttss2si%c %s,", |
1146 operand_size_code(), NameOfCPURegister(regop)); | 1157 operand_size_code(), NameOfCPURegister(regop)); |
1147 current += PrintRightXMMOperand(current); | 1158 current += PrintRightXMMOperand(current); |
1148 } else if (opcode == 0x5A) { | 1159 } else if (opcode == 0x5A) { |
1149 // CVTSS2SD: | 1160 // CVTSS2SD: |
1150 // Convert scalar single-precision FP to scalar double-precision FP. | 1161 // Convert scalar single-precision FP to scalar double-precision FP. |
1151 int mod, regop, rm; | 1162 int mod, regop, rm; |
1152 get_modrm(*current, &mod, ®op, &rm); | 1163 get_modrm(*current, &mod, ®op, &rm); |
1153 AppendToBuffer("cvtss2sd %s,", NameOfXMMRegister(regop)); | 1164 AppendToBuffer("cvtss2sd %s,", NameOfXMMRegister(regop)); |
1154 current += PrintRightXMMOperand(current); | 1165 current += PrintRightXMMOperand(current); |
| 1166 } else if (opcode == 0x7E) { |
| 1167 int mod, regop, rm; |
| 1168 get_modrm(*current, &mod, ®op, &rm); |
| 1169 AppendToBuffer("movq %s, ", NameOfXMMRegister(regop)); |
| 1170 current += PrintRightXMMOperand(current); |
1155 } else { | 1171 } else { |
1156 UnimplementedInstruction(); | 1172 UnimplementedInstruction(); |
1157 } | 1173 } |
1158 } else if (opcode == 0x1F) { | 1174 } else if (opcode == 0x1F) { |
1159 // NOP | 1175 // NOP |
1160 int mod, regop, rm; | 1176 int mod, regop, rm; |
1161 get_modrm(*current, &mod, ®op, &rm); | 1177 get_modrm(*current, &mod, ®op, &rm); |
1162 current++; | 1178 current++; |
1163 if (regop == 4) { // SIB byte present. | 1179 if (regop == 4) { // SIB byte present. |
1164 current++; | 1180 current++; |
1165 } | 1181 } |
1166 if (mod == 1) { // Byte displacement. | 1182 if (mod == 1) { // Byte displacement. |
1167 current += 1; | 1183 current += 1; |
1168 } else if (mod == 2) { // 32-bit displacement. | 1184 } else if (mod == 2) { // 32-bit displacement. |
1169 current += 4; | 1185 current += 4; |
1170 } // else no immediate displacement. | 1186 } // else no immediate displacement. |
1171 AppendToBuffer("nop"); | 1187 AppendToBuffer("nop"); |
| 1188 |
| 1189 } else if (opcode == 28) { |
| 1190 // movaps xmm, xmm/m128 |
| 1191 int mod, regop, rm; |
| 1192 get_modrm(*current, &mod, ®op, &rm); |
| 1193 AppendToBuffer("movaps %s, ", NameOfXMMRegister(regop)); |
| 1194 current += PrintRightXMMOperand(current); |
| 1195 |
| 1196 } else if (opcode == 29) { |
| 1197 // movaps xmm/m128, xmm |
| 1198 int mod, regop, rm; |
| 1199 get_modrm(*current, &mod, ®op, &rm); |
| 1200 AppendToBuffer("movaps"); |
| 1201 current += PrintRightXMMOperand(current); |
| 1202 AppendToBuffer(", %s", NameOfXMMRegister(regop)); |
| 1203 |
1172 } else if (opcode == 0xA2 || opcode == 0x31) { | 1204 } else if (opcode == 0xA2 || opcode == 0x31) { |
1173 // RDTSC or CPUID | 1205 // RDTSC or CPUID |
1174 AppendToBuffer("%s", mnemonic); | 1206 AppendToBuffer("%s", mnemonic); |
1175 | 1207 |
1176 } else if ((opcode & 0xF0) == 0x40) { | 1208 } else if ((opcode & 0xF0) == 0x40) { |
1177 // CMOVcc: conditional move. | 1209 // CMOVcc: conditional move. |
1178 int condition = opcode & 0x0F; | 1210 int condition = opcode & 0x0F; |
1179 const InstructionDesc& idesc = cmov_instructions[condition]; | 1211 const InstructionDesc& idesc = cmov_instructions[condition]; |
1180 byte_size_operand_ = idesc.byte_size_operation; | 1212 byte_size_operand_ = idesc.byte_size_operation; |
1181 current += PrintOperands(idesc.mnem, idesc.op_order_, current); | 1213 current += PrintOperands(idesc.mnem, idesc.op_order_, current); |
1182 | 1214 |
| 1215 } else if (opcode == 57) { |
| 1216 // xoprps xmm, xmm/m128 |
| 1217 int mod, regop, rm; |
| 1218 get_modrm(*current, &mod, ®op, &rm); |
| 1219 AppendToBuffer("xorps %s, ", NameOfXMMRegister(regop)); |
| 1220 current += PrintRightXMMOperand(current); |
| 1221 |
1183 } else if ((opcode & 0xF0) == 0x80) { | 1222 } else if ((opcode & 0xF0) == 0x80) { |
1184 // Jcc: Conditional jump (branch). | 1223 // Jcc: Conditional jump (branch). |
1185 current = data + JumpConditional(data); | 1224 current = data + JumpConditional(data); |
1186 | 1225 |
1187 } else if (opcode == 0xBE || opcode == 0xBF || opcode == 0xB6 || | 1226 } else if (opcode == 0xBE || opcode == 0xBF || opcode == 0xB6 || |
1188 opcode == 0xB7 || opcode == 0xAF) { | 1227 opcode == 0xB7 || opcode == 0xAF) { |
1189 // Size-extending moves, IMUL. | 1228 // Size-extending moves, IMUL. |
1190 current += PrintOperands(mnemonic, REG_OPER_OP_ORDER, current); | 1229 current += PrintOperands(mnemonic, REG_OPER_OP_ORDER, current); |
1191 | 1230 |
1192 } else if ((opcode & 0xF0) == 0x90) { | 1231 } else if ((opcode & 0xF0) == 0x90) { |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1784 for (int i = 6 - static_cast<int>(pc - prev_pc); i >= 0; i--) { | 1823 for (int i = 6 - static_cast<int>(pc - prev_pc); i >= 0; i--) { |
1785 fprintf(f, " "); | 1824 fprintf(f, " "); |
1786 } | 1825 } |
1787 fprintf(f, " %s\n", buffer.start()); | 1826 fprintf(f, " %s\n", buffer.start()); |
1788 } | 1827 } |
1789 } | 1828 } |
1790 | 1829 |
1791 } // namespace disasm | 1830 } // namespace disasm |
1792 | 1831 |
1793 #endif // V8_TARGET_ARCH_X64 | 1832 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |