Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Side by Side Diff: runtime/vm/disassembler_ia32.cc

Issue 148383018: Fix movups disassembly on IA32 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/disassembler.h" 5 #include "vm/disassembler.h"
6 6
7 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. 7 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
8 #if defined(TARGET_ARCH_IA32) 8 #if defined(TARGET_ARCH_IA32)
9 #include "platform/utils.h" 9 #include "platform/utils.h"
10 #include "vm/allocation.h" 10 #include "vm/allocation.h"
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 // Handle special encodings. 349 // Handle special encodings.
350 int JumpShort(uint8_t* data); 350 int JumpShort(uint8_t* data);
351 int JumpConditional(uint8_t* data, const char* comment); 351 int JumpConditional(uint8_t* data, const char* comment);
352 int JumpConditionalShort(uint8_t* data, const char* comment); 352 int JumpConditionalShort(uint8_t* data, const char* comment);
353 int SetCC(uint8_t* data); 353 int SetCC(uint8_t* data);
354 int CMov(uint8_t* data); 354 int CMov(uint8_t* data);
355 int D1D3C1Instruction(uint8_t* data); 355 int D1D3C1Instruction(uint8_t* data);
356 uint8_t* F3Instruction(uint8_t* data); 356 uint8_t* F3Instruction(uint8_t* data);
357 int F7Instruction(uint8_t* data); 357 int F7Instruction(uint8_t* data);
358 int FPUInstruction(uint8_t* data); 358 int FPUInstruction(uint8_t* data);
359 uint8_t* SSEInstruction(uint8_t prefix, uint8_t primary, uint8_t* data);
359 int BitwisePDInstruction(uint8_t* data); 360 int BitwisePDInstruction(uint8_t* data);
360 int Packed660F38Instruction(uint8_t* data); 361 int Packed660F38Instruction(uint8_t* data);
361 int DecodeEnter(uint8_t* data); 362 int DecodeEnter(uint8_t* data);
362 void CheckPrintStop(uint8_t* data); 363 void CheckPrintStop(uint8_t* data);
363 364
364 // Disassembler helper functions. 365 // Disassembler helper functions.
365 static void GetModRm(uint8_t data, int* mod, int* regop, int* rm) { 366 static void GetModRm(uint8_t data, int* mod, int* regop, int* rm) {
366 *mod = (data >> 6) & 3; 367 *mod = (data >> 6) & 3;
367 *regop = (data & 0x38) >> 3; 368 *regop = (data & 0x38) >> 3;
368 *rm = data & 7; 369 *rm = data & 7;
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
1121 } else if (b1 == 0xDA && b2 == 0xE9) { 1122 } else if (b1 == 0xDA && b2 == 0xE9) {
1122 const char* mnem = "fucompp"; 1123 const char* mnem = "fucompp";
1123 Print(mnem); 1124 Print(mnem);
1124 return 2; 1125 return 2;
1125 } 1126 }
1126 Print("Unknown FP instruction"); 1127 Print("Unknown FP instruction");
1127 return 2; 1128 return 2;
1128 } 1129 }
1129 1130
1130 1131
1132 uint8_t* X86Decoder::SSEInstruction(uint8_t prefix, uint8_t primary,
1133 uint8_t* data) {
1134 ASSERT(prefix == 0x0F);
1135 int mod, regop, rm;
1136 if (primary == 0x10) {
1137 GetModRm(*data, &mod, &regop, &rm);
1138 Print("movups ");
1139 PrintXmmRegister(regop);
1140 Print(",");
1141 data += PrintRightOperand(data);
1142 } else if (primary == 0x11) {
1143 int mod, regop, rm;
1144 GetModRm(*data, &mod, &regop, &rm);
1145 Print("movups ");
1146 data += PrintRightXmmOperand(data);
1147 Print(",");
1148 PrintXmmRegister(regop);
1149 } else if (IsTwoXmmRegInstruction(primary)) {
1150 const char* f0mnem = F0Mnem(primary);
1151 int mod, regop, rm;
1152 GetModRm(*data, &mod, &regop, &rm);
1153 Print(f0mnem);
1154 Print(" ");
1155 PrintXmmRegister(regop);
1156 Print(",");
1157 data += PrintRightXmmOperand(data);
1158 }
1159 return data;
1160 }
1161
1162
1131 int X86Decoder::BitwisePDInstruction(uint8_t* data) { 1163 int X86Decoder::BitwisePDInstruction(uint8_t* data) {
1132 const char* mnem = (*data == 0x57) 1164 const char* mnem = (*data == 0x57)
1133 ? "xorpd" 1165 ? "xorpd"
1134 : (*data == 0x56) 1166 : (*data == 0x56)
1135 ? "orpd" 1167 ? "orpd"
1136 : "andpd"; 1168 : "andpd";
1137 int mod, regop, rm; 1169 int mod, regop, rm;
1138 GetModRm(*(data+1), &mod, &regop, &rm); 1170 GetModRm(*(data+1), &mod, &regop, &rm);
1139 Print(mnem); 1171 Print(mnem);
1140 Print(" "); 1172 Print(" ");
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
1389 Print(" "); 1421 Print(" ");
1390 data += PrintRightOperand(data); 1422 data += PrintRightOperand(data);
1391 if (f0byte == 0xAB) { 1423 if (f0byte == 0xAB) {
1392 Print(","); 1424 Print(",");
1393 PrintCPURegister(regop); 1425 PrintCPURegister(regop);
1394 } else { 1426 } else {
1395 Print(","); 1427 Print(",");
1396 PrintCPURegister(regop); 1428 PrintCPURegister(regop);
1397 Print(",cl"); 1429 Print(",cl");
1398 } 1430 }
1399 } else if (f0byte == 0x10) { 1431 } else if ((f0byte == 0x10) || (f0byte == 0x11) ||
1400 int mod, regop, rm; 1432 IsTwoXmmRegInstruction(f0byte)) {
1401 GetModRm(*data, &mod, &regop, &rm); 1433 data = SSEInstruction(0x0F, f0byte, data);
1402 Print("movups ");
1403 PrintXmmRegister(regop);
1404 Print(",");
1405 data += PrintRightOperand(data);
1406 } else if (IsTwoXmmRegInstruction(f0byte)) {
1407 int mod, regop, rm;
1408 GetModRm(*data, &mod, &regop, &rm);
1409 Print(f0mnem);
1410 Print(" ");
1411 PrintXmmRegister(regop);
1412 Print(",");
1413 data += PrintRightXmmOperand(data);
1414 } else if (f0byte == 0x50) { 1434 } else if (f0byte == 0x50) {
1415 Print("movmskps "); 1435 Print("movmskps ");
1416 int mod, regop, rm; 1436 int mod, regop, rm;
1417 GetModRm(*data, &mod, &regop, &rm); 1437 GetModRm(*data, &mod, &regop, &rm);
1418 PrintCPURegister(regop); 1438 PrintCPURegister(regop);
1419 Print(","); 1439 Print(",");
1420 data += PrintRightXmmOperand(data); 1440 data += PrintRightXmmOperand(data);
1421 } else if (f0byte == 0xC2 || f0byte == 0xC6) { 1441 } else if (f0byte == 0xC2 || f0byte == 0xC6) {
1422 if (f0byte == 0xC2) 1442 if (f0byte == 0xC2)
1423 Print("cmpps "); 1443 Print("cmpps ");
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
1841 pc); 1861 pc);
1842 pc += instruction_length; 1862 pc += instruction_length;
1843 } 1863 }
1844 1864
1845 return; 1865 return;
1846 } 1866 }
1847 1867
1848 } // namespace dart 1868 } // namespace dart
1849 1869
1850 #endif // defined TARGET_ARCH_IA32 1870 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698