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

Side by Side Diff: src/x87/disasm-x87.cc

Issue 1947843002: X87: [Atomics] Fix disassembly for ia32 xchg_b and xchg_w. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 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 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 #if V8_TARGET_ARCH_X87 9 #if V8_TARGET_ARCH_X87
10 10
(...skipping 12 matching lines...) Expand all
23 //------------------------------------------------------------------ 23 //------------------------------------------------------------------
24 // Tables 24 // Tables
25 //------------------------------------------------------------------ 25 //------------------------------------------------------------------
26 struct ByteMnemonic { 26 struct ByteMnemonic {
27 int b; // -1 terminates, otherwise must be in range (0..255) 27 int b; // -1 terminates, otherwise must be in range (0..255)
28 const char* mnem; 28 const char* mnem;
29 OperandOrder op_order_; 29 OperandOrder op_order_;
30 }; 30 };
31 31
32 static const ByteMnemonic two_operands_instr[] = { 32 static const ByteMnemonic two_operands_instr[] = {
33 {0x01, "add", OPER_REG_OP_ORDER}, {0x03, "add", REG_OPER_OP_ORDER}, 33 {0x01, "add", OPER_REG_OP_ORDER}, {0x03, "add", REG_OPER_OP_ORDER},
34 {0x09, "or", OPER_REG_OP_ORDER}, {0x0B, "or", REG_OPER_OP_ORDER}, 34 {0x09, "or", OPER_REG_OP_ORDER}, {0x0B, "or", REG_OPER_OP_ORDER},
35 {0x13, "adc", REG_OPER_OP_ORDER}, {0x1B, "sbb", REG_OPER_OP_ORDER}, 35 {0x13, "adc", REG_OPER_OP_ORDER}, {0x1B, "sbb", REG_OPER_OP_ORDER},
36 {0x21, "and", OPER_REG_OP_ORDER}, {0x23, "and", REG_OPER_OP_ORDER}, 36 {0x21, "and", OPER_REG_OP_ORDER}, {0x23, "and", REG_OPER_OP_ORDER},
37 {0x29, "sub", OPER_REG_OP_ORDER}, {0x2A, "subb", REG_OPER_OP_ORDER}, 37 {0x29, "sub", OPER_REG_OP_ORDER}, {0x2A, "subb", REG_OPER_OP_ORDER},
38 {0x2B, "sub", REG_OPER_OP_ORDER}, {0x31, "xor", OPER_REG_OP_ORDER}, 38 {0x2B, "sub", REG_OPER_OP_ORDER}, {0x31, "xor", OPER_REG_OP_ORDER},
39 {0x33, "xor", REG_OPER_OP_ORDER}, {0x38, "cmpb", OPER_REG_OP_ORDER}, 39 {0x33, "xor", REG_OPER_OP_ORDER}, {0x38, "cmpb", OPER_REG_OP_ORDER},
40 {0x39, "cmp", OPER_REG_OP_ORDER}, {0x3A, "cmpb", REG_OPER_OP_ORDER}, 40 {0x39, "cmp", OPER_REG_OP_ORDER}, {0x3A, "cmpb", REG_OPER_OP_ORDER},
41 {0x3B, "cmp", REG_OPER_OP_ORDER}, {0x84, "test_b", REG_OPER_OP_ORDER}, 41 {0x3B, "cmp", REG_OPER_OP_ORDER}, {0x84, "test_b", REG_OPER_OP_ORDER},
42 {0x85, "test", REG_OPER_OP_ORDER}, {0x87, "xchg", REG_OPER_OP_ORDER}, 42 {0x85, "test", REG_OPER_OP_ORDER}, {0x86, "xchg_b", REG_OPER_OP_ORDER},
43 {0x8A, "mov_b", REG_OPER_OP_ORDER}, {0x8B, "mov", REG_OPER_OP_ORDER}, 43 {0x87, "xchg", REG_OPER_OP_ORDER}, {0x8A, "mov_b", REG_OPER_OP_ORDER},
44 {0x8D, "lea", REG_OPER_OP_ORDER}, {-1, "", UNSET_OP_ORDER}}; 44 {0x8B, "mov", REG_OPER_OP_ORDER}, {0x8D, "lea", REG_OPER_OP_ORDER},
45 {-1, "", UNSET_OP_ORDER}};
45 46
46 static const ByteMnemonic zero_operands_instr[] = { 47 static const ByteMnemonic zero_operands_instr[] = {
47 {0xC3, "ret", UNSET_OP_ORDER}, 48 {0xC3, "ret", UNSET_OP_ORDER},
48 {0xC9, "leave", UNSET_OP_ORDER}, 49 {0xC9, "leave", UNSET_OP_ORDER},
49 {0x90, "nop", UNSET_OP_ORDER}, 50 {0x90, "nop", UNSET_OP_ORDER},
50 {0xF4, "hlt", UNSET_OP_ORDER}, 51 {0xF4, "hlt", UNSET_OP_ORDER},
51 {0xCC, "int3", UNSET_OP_ORDER}, 52 {0xCC, "int3", UNSET_OP_ORDER},
52 {0x60, "pushad", UNSET_OP_ORDER}, 53 {0x60, "pushad", UNSET_OP_ORDER},
53 {0x61, "popad", UNSET_OP_ORDER}, 54 {0x61, "popad", UNSET_OP_ORDER},
54 {0x9C, "pushfd", UNSET_OP_ORDER}, 55 {0x9C, "pushfd", UNSET_OP_ORDER},
(...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1260 1261
1261 case 0x66: // prefix 1262 case 0x66: // prefix
1262 while (*data == 0x66) data++; 1263 while (*data == 0x66) data++;
1263 if (*data == 0xf && data[1] == 0x1f) { 1264 if (*data == 0xf && data[1] == 0x1f) {
1264 AppendToBuffer("nop"); // 0x66 prefix 1265 AppendToBuffer("nop"); // 0x66 prefix
1265 } else if (*data == 0x90) { 1266 } else if (*data == 0x90) {
1266 AppendToBuffer("nop"); // 0x66 prefix 1267 AppendToBuffer("nop"); // 0x66 prefix
1267 } else if (*data == 0x8B) { 1268 } else if (*data == 0x8B) {
1268 data++; 1269 data++;
1269 data += PrintOperands("mov_w", REG_OPER_OP_ORDER, data); 1270 data += PrintOperands("mov_w", REG_OPER_OP_ORDER, data);
1271 } else if (*data == 0x87) {
1272 data++;
1273 int mod, regop, rm;
1274 get_modrm(*data, &mod, &regop, &rm);
1275 AppendToBuffer("xchg_w ");
1276 data += PrintRightOperand(data);
1277 AppendToBuffer(",%s", NameOfCPURegister(regop));
1270 } else if (*data == 0x89) { 1278 } else if (*data == 0x89) {
1271 data++; 1279 data++;
1272 int mod, regop, rm; 1280 int mod, regop, rm;
1273 get_modrm(*data, &mod, &regop, &rm); 1281 get_modrm(*data, &mod, &regop, &rm);
1274 AppendToBuffer("mov_w "); 1282 AppendToBuffer("mov_w ");
1275 data += PrintRightOperand(data); 1283 data += PrintRightOperand(data);
1276 AppendToBuffer(",%s", NameOfCPURegister(regop)); 1284 AppendToBuffer(",%s", NameOfCPURegister(regop));
1277 } else if (*data == 0xC7) { 1285 } else if (*data == 0xC7) {
1278 data++; 1286 data++;
1279 AppendToBuffer("%s ", "mov_w"); 1287 AppendToBuffer("%s ", "mov_w");
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
1817 fprintf(f, " "); 1825 fprintf(f, " ");
1818 } 1826 }
1819 fprintf(f, " %s\n", buffer.start()); 1827 fprintf(f, " %s\n", buffer.start());
1820 } 1828 }
1821 } 1829 }
1822 1830
1823 1831
1824 } // namespace disasm 1832 } // namespace disasm
1825 1833
1826 #endif // V8_TARGET_ARCH_X87 1834 #endif // V8_TARGET_ARCH_X87
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