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

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

Issue 1947673002: [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_IA32 9 #if V8_TARGET_ARCH_IA32
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 1545 matching lines...) Expand 10 before | Expand all | Expand 10 after
1600 1601
1601 case 0x66: // prefix 1602 case 0x66: // prefix
1602 while (*data == 0x66) data++; 1603 while (*data == 0x66) data++;
1603 if (*data == 0xf && data[1] == 0x1f) { 1604 if (*data == 0xf && data[1] == 0x1f) {
1604 AppendToBuffer("nop"); // 0x66 prefix 1605 AppendToBuffer("nop"); // 0x66 prefix
1605 } else if (*data == 0x90) { 1606 } else if (*data == 0x90) {
1606 AppendToBuffer("nop"); // 0x66 prefix 1607 AppendToBuffer("nop"); // 0x66 prefix
1607 } else if (*data == 0x8B) { 1608 } else if (*data == 0x8B) {
1608 data++; 1609 data++;
1609 data += PrintOperands("mov_w", REG_OPER_OP_ORDER, data); 1610 data += PrintOperands("mov_w", REG_OPER_OP_ORDER, data);
1611 } else if (*data == 0x87) {
1612 data++;
1613 int mod, regop, rm;
1614 get_modrm(*data, &mod, &regop, &rm);
1615 AppendToBuffer("xchg_w ");
1616 data += PrintRightOperand(data);
1617 AppendToBuffer(",%s", NameOfCPURegister(regop));
1610 } else if (*data == 0x89) { 1618 } else if (*data == 0x89) {
1611 data++; 1619 data++;
1612 int mod, regop, rm; 1620 int mod, regop, rm;
1613 get_modrm(*data, &mod, &regop, &rm); 1621 get_modrm(*data, &mod, &regop, &rm);
1614 AppendToBuffer("mov_w "); 1622 AppendToBuffer("mov_w ");
1615 data += PrintRightOperand(data); 1623 data += PrintRightOperand(data);
1616 AppendToBuffer(",%s", NameOfCPURegister(regop)); 1624 AppendToBuffer(",%s", NameOfCPURegister(regop));
1617 } else if (*data == 0xC7) { 1625 } else if (*data == 0xC7) {
1618 data++; 1626 data++;
1619 AppendToBuffer("%s ", "mov_w"); 1627 AppendToBuffer("%s ", "mov_w");
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
2279 fprintf(f, " "); 2287 fprintf(f, " ");
2280 } 2288 }
2281 fprintf(f, " %s\n", buffer.start()); 2289 fprintf(f, " %s\n", buffer.start());
2282 } 2290 }
2283 } 2291 }
2284 2292
2285 2293
2286 } // namespace disasm 2294 } // namespace disasm
2287 2295
2288 #endif // V8_TARGET_ARCH_IA32 2296 #endif // V8_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