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

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

Issue 1221683005: Add lock prefix and cmpxchg to X64 disassembler. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 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
« 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_X64) 8 #if defined(TARGET_ARCH_X64)
9 #include "platform/utils.h" 9 #include "platform/utils.h"
10 #include "vm/allocation.h" 10 #include "vm/allocation.h"
(...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after
1082 while (true) { 1082 while (true) {
1083 current = **data; 1083 current = **data;
1084 if (current == OPERAND_SIZE_OVERRIDE_PREFIX) { // Group 3 prefix. 1084 if (current == OPERAND_SIZE_OVERRIDE_PREFIX) { // Group 3 prefix.
1085 operand_size_ = current; 1085 operand_size_ = current;
1086 } else if ((current & 0xF0) == 0x40) { // REX prefix. 1086 } else if ((current & 0xF0) == 0x40) { // REX prefix.
1087 setRex(current); 1087 setRex(current);
1088 // TODO(srdjan): Should we enable printing of REX.W? 1088 // TODO(srdjan): Should we enable printing of REX.W?
1089 // if (rex_w()) AppendToBuffer("REX.W "); 1089 // if (rex_w()) AppendToBuffer("REX.W ");
1090 } else if ((current & 0xFE) == 0xF2) { // Group 1 prefix (0xF2 or 0xF3). 1090 } else if ((current & 0xFE) == 0xF2) { // Group 1 prefix (0xF2 or 0xF3).
1091 group_1_prefix_ = current; 1091 group_1_prefix_ = current;
1092 } else if (current == 0xF0) {
1093 AppendToBuffer("lock ");
1092 } else { // Not a prefix - an opcode. 1094 } else { // Not a prefix - an opcode.
1093 break; 1095 break;
1094 } 1096 }
1095 (*data)++; 1097 (*data)++;
1096 } 1098 }
1097 1099
1098 const InstructionDesc& idesc = instruction_table.Get(current); 1100 const InstructionDesc& idesc = instruction_table.Get(current);
1099 byte_size_operand_ = idesc.byte_size_operation; 1101 byte_size_operand_ = idesc.byte_size_operation;
1100 1102
1101 switch (idesc.type) { 1103 switch (idesc.type) {
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
1508 AppendToBuffer("shufps %s, ", NameOfXMMRegister(regop)); 1510 AppendToBuffer("shufps %s, ", NameOfXMMRegister(regop));
1509 } 1511 }
1510 current += PrintRightXMMOperand(current); 1512 current += PrintRightXMMOperand(current);
1511 AppendToBuffer(" [%x]", *current); 1513 AppendToBuffer(" [%x]", *current);
1512 current++; 1514 current++;
1513 } else if ((opcode & 0xF0) == 0x80) { 1515 } else if ((opcode & 0xF0) == 0x80) {
1514 // Jcc: Conditional jump (branch). 1516 // Jcc: Conditional jump (branch).
1515 current = data + JumpConditional(data); 1517 current = data + JumpConditional(data);
1516 1518
1517 } else if (opcode == 0xBE || opcode == 0xBF || opcode == 0xB6 || 1519 } else if (opcode == 0xBE || opcode == 0xBF || opcode == 0xB6 ||
1518 opcode == 0xB7 || opcode == 0xAF) { 1520 opcode == 0xB7 || opcode == 0xAF || opcode == 0xB0 ||
1519 // Size-extending moves, IMUL. 1521 opcode == 0xB1) {
1522 // Size-extending moves, IMUL, cmpxchg.
1520 current += PrintOperands(mnemonic, REG_OPER_OP_ORDER, current); 1523 current += PrintOperands(mnemonic, REG_OPER_OP_ORDER, current);
1521 1524
1522 } else if ((opcode & 0xF0) == 0x90) { 1525 } else if ((opcode & 0xF0) == 0x90) {
1523 // SETcc: Set byte on condition. Needs pointer to beginning of instruction. 1526 // SETcc: Set byte on condition. Needs pointer to beginning of instruction.
1524 current = data + SetCC(data); 1527 current = data + SetCC(data);
1525 1528
1526 } else if (((opcode & 0xFE) == 0xA4) || ((opcode & 0xFE) == 0xAC) || 1529 } else if (((opcode & 0xFE) == 0xA4) || ((opcode & 0xFE) == 0xAC) ||
1527 (opcode == 0xAB) || (opcode == 0xA3) || (opcode == 0xBD)) { 1530 (opcode == 0xAB) || (opcode == 0xA3) || (opcode == 0xBD)) {
1528 // SHLD, SHRD (double-prec. shift), BTS (bit test and set), BT (bit test). 1531 // SHLD, SHRD (double-prec. shift), BTS (bit test and set), BT (bit test).
1529 AppendToBuffer("%s%c ", mnemonic, operand_size_code()); 1532 AppendToBuffer("%s%c ", mnemonic, operand_size_code());
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1574 case 0xA4: 1577 case 0xA4:
1575 case 0xA5: 1578 case 0xA5:
1576 return "shld"; 1579 return "shld";
1577 case 0xAB: 1580 case 0xAB:
1578 return "bts"; 1581 return "bts";
1579 case 0xAC: 1582 case 0xAC:
1580 case 0xAD: 1583 case 0xAD:
1581 return "shrd"; 1584 return "shrd";
1582 case 0xAF: 1585 case 0xAF:
1583 return "imul"; 1586 return "imul";
1587 case 0xB0:
1588 case 0xB1:
1589 return "cmpxchg";
1584 case 0xB6: 1590 case 0xB6:
1585 return "movzxb"; 1591 return "movzxb";
1586 case 0xB7: 1592 case 0xB7:
1587 return "movzxw"; 1593 return "movzxw";
1588 case 0xBE: 1594 case 0xBE:
1589 return "movsxb"; 1595 return "movsxb";
1590 case 0xBD: 1596 case 0xBD:
1591 return "bsr"; 1597 return "bsr";
1592 case 0xBF: 1598 case 0xBF:
1593 return "movsxw"; 1599 return "movsxw";
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
1946 } 1952 }
1947 hex_buffer[hex_index] = '\0'; 1953 hex_buffer[hex_index] = '\0';
1948 if (out_instr_len) { 1954 if (out_instr_len) {
1949 *out_instr_len = instruction_length; 1955 *out_instr_len = instruction_length;
1950 } 1956 }
1951 } 1957 }
1952 1958
1953 } // namespace dart 1959 } // namespace dart
1954 1960
1955 #endif // defined TARGET_ARCH_X64 1961 #endif // defined TARGET_ARCH_X64
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