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 10 matching lines...) Expand all Loading... |
21 | 21 |
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 | |
32 static const ByteMnemonic two_operands_instr[] = { | 31 static const ByteMnemonic two_operands_instr[] = { |
33 {0x01, "add", OPER_REG_OP_ORDER}, | 32 {0x01, "add", OPER_REG_OP_ORDER}, |
34 {0x03, "add", REG_OPER_OP_ORDER}, | 33 {0x03, "add", REG_OPER_OP_ORDER}, |
35 {0x09, "or", OPER_REG_OP_ORDER}, | 34 {0x09, "or", OPER_REG_OP_ORDER}, |
36 {0x0B, "or", REG_OPER_OP_ORDER}, | 35 {0x0B, "or", REG_OPER_OP_ORDER}, |
37 {0x1B, "sbb", REG_OPER_OP_ORDER}, | 36 {0x1B, "sbb", REG_OPER_OP_ORDER}, |
38 {0x21, "and", OPER_REG_OP_ORDER}, | 37 {0x21, "and", OPER_REG_OP_ORDER}, |
39 {0x23, "and", REG_OPER_OP_ORDER}, | 38 {0x23, "and", REG_OPER_OP_ORDER}, |
40 {0x29, "sub", OPER_REG_OP_ORDER}, | 39 {0x29, "sub", OPER_REG_OP_ORDER}, |
41 {0x2A, "subb", REG_OPER_OP_ORDER}, | 40 {0x2A, "subb", REG_OPER_OP_ORDER}, |
42 {0x2B, "sub", REG_OPER_OP_ORDER}, | 41 {0x2B, "sub", REG_OPER_OP_ORDER}, |
43 {0x31, "xor", OPER_REG_OP_ORDER}, | 42 {0x31, "xor", OPER_REG_OP_ORDER}, |
44 {0x33, "xor", REG_OPER_OP_ORDER}, | 43 {0x33, "xor", REG_OPER_OP_ORDER}, |
45 {0x38, "cmpb", OPER_REG_OP_ORDER}, | 44 {0x38, "cmpb", OPER_REG_OP_ORDER}, |
46 {0x3A, "cmpb", REG_OPER_OP_ORDER}, | 45 {0x39, "cmp", OPER_REG_OP_ORDER}, |
47 {0x3B, "cmp", REG_OPER_OP_ORDER}, | 46 {0x3A, "cmpb", REG_OPER_OP_ORDER}, |
48 {0x84, "test_b", REG_OPER_OP_ORDER}, | 47 {0x3B, "cmp", REG_OPER_OP_ORDER}, |
49 {0x85, "test", REG_OPER_OP_ORDER}, | 48 {0x84, "test_b", REG_OPER_OP_ORDER}, |
50 {0x87, "xchg", REG_OPER_OP_ORDER}, | 49 {0x85, "test", REG_OPER_OP_ORDER}, |
51 {0x8A, "mov_b", REG_OPER_OP_ORDER}, | 50 {0x87, "xchg", REG_OPER_OP_ORDER}, |
52 {0x8B, "mov", REG_OPER_OP_ORDER}, | 51 {0x8A, "mov_b", REG_OPER_OP_ORDER}, |
53 {0x8D, "lea", REG_OPER_OP_ORDER}, | 52 {0x8B, "mov", REG_OPER_OP_ORDER}, |
54 {-1, "", UNSET_OP_ORDER} | 53 {0x8D, "lea", REG_OPER_OP_ORDER}, |
55 }; | 54 {-1, "", UNSET_OP_ORDER}}; |
56 | |
57 | 55 |
58 static const ByteMnemonic zero_operands_instr[] = { | 56 static const ByteMnemonic zero_operands_instr[] = { |
59 {0xC3, "ret", UNSET_OP_ORDER}, | 57 {0xC3, "ret", UNSET_OP_ORDER}, |
60 {0xC9, "leave", UNSET_OP_ORDER}, | 58 {0xC9, "leave", UNSET_OP_ORDER}, |
61 {0x90, "nop", UNSET_OP_ORDER}, | 59 {0x90, "nop", UNSET_OP_ORDER}, |
62 {0xF4, "hlt", UNSET_OP_ORDER}, | 60 {0xF4, "hlt", UNSET_OP_ORDER}, |
63 {0xCC, "int3", UNSET_OP_ORDER}, | 61 {0xCC, "int3", UNSET_OP_ORDER}, |
64 {0x60, "pushad", UNSET_OP_ORDER}, | 62 {0x60, "pushad", UNSET_OP_ORDER}, |
65 {0x61, "popad", UNSET_OP_ORDER}, | 63 {0x61, "popad", UNSET_OP_ORDER}, |
66 {0x9C, "pushfd", UNSET_OP_ORDER}, | 64 {0x9C, "pushfd", UNSET_OP_ORDER}, |
(...skipping 2194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2261 fprintf(f, " "); | 2259 fprintf(f, " "); |
2262 } | 2260 } |
2263 fprintf(f, " %s\n", buffer.start()); | 2261 fprintf(f, " %s\n", buffer.start()); |
2264 } | 2262 } |
2265 } | 2263 } |
2266 | 2264 |
2267 | 2265 |
2268 } // namespace disasm | 2266 } // namespace disasm |
2269 | 2267 |
2270 #endif // V8_TARGET_ARCH_IA32 | 2268 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |