| OLD | NEW |
| 1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 {0x3B, "cmp", REG_OPER_OP_ORDER}, | 58 {0x3B, "cmp", REG_OPER_OP_ORDER}, |
| 59 {0x8D, "lea", REG_OPER_OP_ORDER}, | 59 {0x8D, "lea", REG_OPER_OP_ORDER}, |
| 60 {0x09, "or", OPER_REG_OP_ORDER}, | 60 {0x09, "or", OPER_REG_OP_ORDER}, |
| 61 {0x0B, "or", REG_OPER_OP_ORDER}, | 61 {0x0B, "or", REG_OPER_OP_ORDER}, |
| 62 {0x1B, "sbb", REG_OPER_OP_ORDER}, | 62 {0x1B, "sbb", REG_OPER_OP_ORDER}, |
| 63 {0x29, "sub", OPER_REG_OP_ORDER}, | 63 {0x29, "sub", OPER_REG_OP_ORDER}, |
| 64 {0x2B, "sub", REG_OPER_OP_ORDER}, | 64 {0x2B, "sub", REG_OPER_OP_ORDER}, |
| 65 {0x85, "test", REG_OPER_OP_ORDER}, | 65 {0x85, "test", REG_OPER_OP_ORDER}, |
| 66 {0x31, "xor", OPER_REG_OP_ORDER}, | 66 {0x31, "xor", OPER_REG_OP_ORDER}, |
| 67 {0x33, "xor", REG_OPER_OP_ORDER}, | 67 {0x33, "xor", REG_OPER_OP_ORDER}, |
| 68 {0x87, "xchg", REG_OPER_OP_ORDER}, |
| 68 {0x8A, "mov_b", REG_OPER_OP_ORDER}, | 69 {0x8A, "mov_b", REG_OPER_OP_ORDER}, |
| 69 {0x8B, "mov", REG_OPER_OP_ORDER}, | 70 {0x8B, "mov", REG_OPER_OP_ORDER}, |
| 70 {-1, "", UNSET_OP_ORDER} | 71 {-1, "", UNSET_OP_ORDER} |
| 71 }; | 72 }; |
| 72 | 73 |
| 73 | 74 |
| 74 static ByteMnemonic zero_operands_instr[] = { | 75 static ByteMnemonic zero_operands_instr[] = { |
| 75 {0xC3, "ret", UNSET_OP_ORDER}, | 76 {0xC3, "ret", UNSET_OP_ORDER}, |
| 76 {0xC9, "leave", UNSET_OP_ORDER}, | 77 {0xC9, "leave", UNSET_OP_ORDER}, |
| 77 {0x90, "nop", UNSET_OP_ORDER}, | 78 {0x90, "nop", UNSET_OP_ORDER}, |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 void InstructionTable::Init() { | 171 void InstructionTable::Init() { |
| 171 CopyTable(two_operands_instr, TWO_OPERANDS_INSTR); | 172 CopyTable(two_operands_instr, TWO_OPERANDS_INSTR); |
| 172 CopyTable(zero_operands_instr, ZERO_OPERANDS_INSTR); | 173 CopyTable(zero_operands_instr, ZERO_OPERANDS_INSTR); |
| 173 CopyTable(call_jump_instr, CALL_JUMP_INSTR); | 174 CopyTable(call_jump_instr, CALL_JUMP_INSTR); |
| 174 CopyTable(short_immediate_instr, SHORT_IMMEDIATE_INSTR); | 175 CopyTable(short_immediate_instr, SHORT_IMMEDIATE_INSTR); |
| 175 AddJumpConditionalShort(); | 176 AddJumpConditionalShort(); |
| 176 SetTableRange(REGISTER_INSTR, 0x40, 0x47, "inc"); | 177 SetTableRange(REGISTER_INSTR, 0x40, 0x47, "inc"); |
| 177 SetTableRange(REGISTER_INSTR, 0x48, 0x4F, "dec"); | 178 SetTableRange(REGISTER_INSTR, 0x48, 0x4F, "dec"); |
| 178 SetTableRange(REGISTER_INSTR, 0x50, 0x57, "push"); | 179 SetTableRange(REGISTER_INSTR, 0x50, 0x57, "push"); |
| 179 SetTableRange(REGISTER_INSTR, 0x58, 0x5F, "pop"); | 180 SetTableRange(REGISTER_INSTR, 0x58, 0x5F, "pop"); |
| 181 SetTableRange(REGISTER_INSTR, 0x91, 0x97, "xchg eax,"); // 0x90 is nop. |
| 180 SetTableRange(MOVE_REG_INSTR, 0xB8, 0xBF, "mov"); | 182 SetTableRange(MOVE_REG_INSTR, 0xB8, 0xBF, "mov"); |
| 181 } | 183 } |
| 182 | 184 |
| 183 | 185 |
| 184 void InstructionTable::CopyTable(ByteMnemonic bm[], InstructionType type) { | 186 void InstructionTable::CopyTable(ByteMnemonic bm[], InstructionType type) { |
| 185 for (int i = 0; bm[i].b >= 0; i++) { | 187 for (int i = 0; bm[i].b >= 0; i++) { |
| 186 InstructionDesc* id = &instructions_[bm[i].b]; | 188 InstructionDesc* id = &instructions_[bm[i].b]; |
| 187 id->mnem = bm[i].mnem; | 189 id->mnem = bm[i].mnem; |
| 188 id->op_order_ = bm[i].op_order_; | 190 id->op_order_ = bm[i].op_order_; |
| 189 assert(id->type == NO_INSTR); // Information already entered | 191 assert(id->type == NO_INSTR); // Information already entered |
| (...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1129 } | 1131 } |
| 1130 for (int i = 6 - (pc - prev_pc); i >= 0; i--) { | 1132 for (int i = 6 - (pc - prev_pc); i >= 0; i--) { |
| 1131 fprintf(f, " "); | 1133 fprintf(f, " "); |
| 1132 } | 1134 } |
| 1133 fprintf(f, " %s\n", buffer.start()); | 1135 fprintf(f, " %s\n", buffer.start()); |
| 1134 } | 1136 } |
| 1135 } | 1137 } |
| 1136 | 1138 |
| 1137 | 1139 |
| 1138 } // namespace disasm | 1140 } // namespace disasm |
| OLD | NEW |