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 |
11 #include "src/base/compiler-specific.h" | |
12 #include "src/disasm.h" | 11 #include "src/disasm.h" |
13 | 12 |
14 namespace disasm { | 13 namespace disasm { |
15 | 14 |
16 enum OperandOrder { | 15 enum OperandOrder { |
17 UNSET_OP_ORDER = 0, | 16 UNSET_OP_ORDER = 0, |
18 REG_OPER_OP_ORDER, | 17 REG_OPER_OP_ORDER, |
19 OPER_REG_OP_ORDER | 18 OPER_REG_OP_ORDER |
20 }; | 19 }; |
21 | 20 |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 int D1D3C1Instruction(byte* data); | 382 int D1D3C1Instruction(byte* data); |
384 int JumpShort(byte* data); | 383 int JumpShort(byte* data); |
385 int JumpConditional(byte* data, const char* comment); | 384 int JumpConditional(byte* data, const char* comment); |
386 int JumpConditionalShort(byte* data, const char* comment); | 385 int JumpConditionalShort(byte* data, const char* comment); |
387 int SetCC(byte* data); | 386 int SetCC(byte* data); |
388 int CMov(byte* data); | 387 int CMov(byte* data); |
389 int FPUInstruction(byte* data); | 388 int FPUInstruction(byte* data); |
390 int MemoryFPUInstruction(int escape_opcode, int regop, byte* modrm_start); | 389 int MemoryFPUInstruction(int escape_opcode, int regop, byte* modrm_start); |
391 int RegisterFPUInstruction(int escape_opcode, byte modrm_byte); | 390 int RegisterFPUInstruction(int escape_opcode, byte modrm_byte); |
392 int AVXInstruction(byte* data); | 391 int AVXInstruction(byte* data); |
393 PRINTF_FORMAT(2, 3) void AppendToBuffer(const char* format, ...); | 392 void AppendToBuffer(const char* format, ...); |
| 393 |
394 | 394 |
395 void UnimplementedInstruction() { | 395 void UnimplementedInstruction() { |
396 if (abort_on_unimplemented_) { | 396 if (abort_on_unimplemented_) { |
397 UNIMPLEMENTED(); | 397 UNIMPLEMENTED(); |
398 } else { | 398 } else { |
399 AppendToBuffer("'Unimplemented Instruction'"); | 399 AppendToBuffer("'Unimplemented Instruction'"); |
400 } | 400 } |
401 } | 401 } |
402 }; | 402 }; |
403 | 403 |
(...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1267 | 1267 |
1268 bool processed = true; // Will be set to false if the current instruction | 1268 bool processed = true; // Will be set to false if the current instruction |
1269 // is not in 'instructions' table. | 1269 // is not in 'instructions' table. |
1270 // Decode AVX instructions. | 1270 // Decode AVX instructions. |
1271 if (vex_byte0_ != 0) { | 1271 if (vex_byte0_ != 0) { |
1272 data += AVXInstruction(data); | 1272 data += AVXInstruction(data); |
1273 } else { | 1273 } else { |
1274 const InstructionDesc& idesc = instruction_table_->Get(*data); | 1274 const InstructionDesc& idesc = instruction_table_->Get(*data); |
1275 switch (idesc.type) { | 1275 switch (idesc.type) { |
1276 case ZERO_OPERANDS_INSTR: | 1276 case ZERO_OPERANDS_INSTR: |
1277 AppendToBuffer("%s", idesc.mnem); | 1277 AppendToBuffer(idesc.mnem); |
1278 data++; | 1278 data++; |
1279 break; | 1279 break; |
1280 | 1280 |
1281 case TWO_OPERANDS_INSTR: | 1281 case TWO_OPERANDS_INSTR: |
1282 data++; | 1282 data++; |
1283 data += PrintOperands(idesc.mnem, idesc.op_order_, data); | 1283 data += PrintOperands(idesc.mnem, idesc.op_order_, data); |
1284 break; | 1284 break; |
1285 | 1285 |
1286 case JUMP_CONDITIONAL_SHORT_INSTR: | 1286 case JUMP_CONDITIONAL_SHORT_INSTR: |
1287 data += JumpConditionalShort(data, branch_hint); | 1287 data += JumpConditionalShort(data, branch_hint); |
(...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2279 fprintf(f, " "); | 2279 fprintf(f, " "); |
2280 } | 2280 } |
2281 fprintf(f, " %s\n", buffer.start()); | 2281 fprintf(f, " %s\n", buffer.start()); |
2282 } | 2282 } |
2283 } | 2283 } |
2284 | 2284 |
2285 | 2285 |
2286 } // namespace disasm | 2286 } // namespace disasm |
2287 | 2287 |
2288 #endif // V8_TARGET_ARCH_IA32 | 2288 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |