OLD | NEW |
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 11 matching lines...) Expand all Loading... |
22 //------------------------------------------------------------------ | 22 //------------------------------------------------------------------ |
23 // Tables | 23 // Tables |
24 //------------------------------------------------------------------ | 24 //------------------------------------------------------------------ |
25 struct ByteMnemonic { | 25 struct ByteMnemonic { |
26 int b; // -1 terminates, otherwise must be in range (0..255) | 26 int b; // -1 terminates, otherwise must be in range (0..255) |
27 const char* mnem; | 27 const char* mnem; |
28 OperandOrder op_order_; | 28 OperandOrder op_order_; |
29 }; | 29 }; |
30 | 30 |
31 static const ByteMnemonic two_operands_instr[] = { | 31 static const ByteMnemonic two_operands_instr[] = { |
32 {0x01, "add", OPER_REG_OP_ORDER}, | 32 {0x01, "add", OPER_REG_OP_ORDER}, {0x03, "add", REG_OPER_OP_ORDER}, |
33 {0x03, "add", REG_OPER_OP_ORDER}, | 33 {0x09, "or", OPER_REG_OP_ORDER}, {0x0B, "or", REG_OPER_OP_ORDER}, |
34 {0x09, "or", OPER_REG_OP_ORDER}, | 34 {0x13, "adc", REG_OPER_OP_ORDER}, {0x1B, "sbb", REG_OPER_OP_ORDER}, |
35 {0x0B, "or", REG_OPER_OP_ORDER}, | 35 {0x21, "and", OPER_REG_OP_ORDER}, {0x23, "and", REG_OPER_OP_ORDER}, |
36 {0x1B, "sbb", REG_OPER_OP_ORDER}, | 36 {0x29, "sub", OPER_REG_OP_ORDER}, {0x2A, "subb", REG_OPER_OP_ORDER}, |
37 {0x21, "and", OPER_REG_OP_ORDER}, | 37 {0x2B, "sub", REG_OPER_OP_ORDER}, {0x31, "xor", OPER_REG_OP_ORDER}, |
38 {0x23, "and", REG_OPER_OP_ORDER}, | 38 {0x33, "xor", REG_OPER_OP_ORDER}, {0x38, "cmpb", OPER_REG_OP_ORDER}, |
39 {0x29, "sub", OPER_REG_OP_ORDER}, | 39 {0x39, "cmp", OPER_REG_OP_ORDER}, {0x3A, "cmpb", REG_OPER_OP_ORDER}, |
40 {0x2A, "subb", REG_OPER_OP_ORDER}, | 40 {0x3B, "cmp", REG_OPER_OP_ORDER}, {0x84, "test_b", REG_OPER_OP_ORDER}, |
41 {0x2B, "sub", REG_OPER_OP_ORDER}, | 41 {0x85, "test", REG_OPER_OP_ORDER}, {0x87, "xchg", REG_OPER_OP_ORDER}, |
42 {0x31, "xor", OPER_REG_OP_ORDER}, | 42 {0x8A, "mov_b", REG_OPER_OP_ORDER}, {0x8B, "mov", REG_OPER_OP_ORDER}, |
43 {0x33, "xor", REG_OPER_OP_ORDER}, | 43 {0x8D, "lea", REG_OPER_OP_ORDER}, {-1, "", UNSET_OP_ORDER}}; |
44 {0x38, "cmpb", OPER_REG_OP_ORDER}, | |
45 {0x39, "cmp", OPER_REG_OP_ORDER}, | |
46 {0x3A, "cmpb", REG_OPER_OP_ORDER}, | |
47 {0x3B, "cmp", REG_OPER_OP_ORDER}, | |
48 {0x84, "test_b", REG_OPER_OP_ORDER}, | |
49 {0x85, "test", REG_OPER_OP_ORDER}, | |
50 {0x87, "xchg", REG_OPER_OP_ORDER}, | |
51 {0x8A, "mov_b", REG_OPER_OP_ORDER}, | |
52 {0x8B, "mov", REG_OPER_OP_ORDER}, | |
53 {0x8D, "lea", REG_OPER_OP_ORDER}, | |
54 {-1, "", UNSET_OP_ORDER}}; | |
55 | 44 |
56 static const ByteMnemonic zero_operands_instr[] = { | 45 static const ByteMnemonic zero_operands_instr[] = { |
57 {0xC3, "ret", UNSET_OP_ORDER}, | 46 {0xC3, "ret", UNSET_OP_ORDER}, |
58 {0xC9, "leave", UNSET_OP_ORDER}, | 47 {0xC9, "leave", UNSET_OP_ORDER}, |
59 {0x90, "nop", UNSET_OP_ORDER}, | 48 {0x90, "nop", UNSET_OP_ORDER}, |
60 {0xF4, "hlt", UNSET_OP_ORDER}, | 49 {0xF4, "hlt", UNSET_OP_ORDER}, |
61 {0xCC, "int3", UNSET_OP_ORDER}, | 50 {0xCC, "int3", UNSET_OP_ORDER}, |
62 {0x60, "pushad", UNSET_OP_ORDER}, | 51 {0x60, "pushad", UNSET_OP_ORDER}, |
63 {0x61, "popad", UNSET_OP_ORDER}, | 52 {0x61, "popad", UNSET_OP_ORDER}, |
64 {0x9C, "pushfd", UNSET_OP_ORDER}, | 53 {0x9C, "pushfd", UNSET_OP_ORDER}, |
(...skipping 2218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2283 fprintf(f, " "); | 2272 fprintf(f, " "); |
2284 } | 2273 } |
2285 fprintf(f, " %s\n", buffer.start()); | 2274 fprintf(f, " %s\n", buffer.start()); |
2286 } | 2275 } |
2287 } | 2276 } |
2288 | 2277 |
2289 | 2278 |
2290 } // namespace disasm | 2279 } // namespace disasm |
2291 | 2280 |
2292 #endif // V8_TARGET_ARCH_IA32 | 2281 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |