/* OpenIDA - Outil d'analyse de fichiers binaires * instruction.h - prototypes pour la gestion des instructions de l'architecture x86 * * Copyright (C) 2008 Cyrille Bagard * * This file is part of OpenIDA. * * OpenIDA is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * OpenIDA is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Foobar. If not, see . */ #ifndef _ARCH_X86_INSTRUCTION_H #define _ARCH_X86_INSTRUCTION_H #include "../instruction.h" #include "../instruction-int.h" /* Définition d'une instruction x86 */ typedef struct _asm_x86_instr asm_x86_instr; /* Enumération de tous les opcodes */ typedef enum _X86Opcodes { X86_OP_XOR_REG1632, /* xor ([0x66] 0x31) */ X86_OP_INC_E_AX, /* inc ([0x66] 0x40) */ X86_OP_INC_E_CX, /* inc ([0x66] 0x41) */ X86_OP_INC_E_DX, /* inc ([0x66] 0x42) */ X86_OP_INC_E_BX, /* inc ([0x66] 0x43) */ X86_OP_INC_E_SP, /* inc ([0x66] 0x44) */ X86_OP_INC_E_BP, /* inc ([0x66] 0x45) */ X86_OP_INC_E_SI, /* inc ([0x66] 0x46) */ X86_OP_INC_E_DI, /* inc ([0x66] 0x47) */ X86_OP_DEC_E_AX, /* dec ([0x66] 0x48) */ X86_OP_DEC_E_CX, /* dec ([0x66] 0x49) */ X86_OP_DEC_E_DX, /* dec ([0x66] 0x4a) */ X86_OP_DEC_E_BX, /* dec ([0x66] 0x4b) */ X86_OP_DEC_E_SP, /* dec ([0x66] 0x4c) */ X86_OP_DEC_E_BP, /* dec ([0x66] 0x4d) */ X86_OP_DEC_E_SI, /* dec ([0x66] 0x4e) */ X86_OP_DEC_E_DI, /* dec ([0x66] 0x4f) */ X86_OP_PUSH_E_AX, /* push ([0x66] 0x50) */ X86_OP_PUSH_E_CX, /* push ([0x66] 0x51) */ X86_OP_PUSH_E_DX, /* push ([0x66] 0x52) */ X86_OP_PUSH_E_BX, /* push ([0x66] 0x53) */ X86_OP_PUSH_E_SP, /* push ([0x66] 0x54) */ X86_OP_PUSH_E_BP, /* push ([0x66] 0x55) */ X86_OP_PUSH_E_SI, /* push ([0x66] 0x56) */ X86_OP_PUSH_E_DI, /* push ([0x66] 0x57) */ X86_OP_POP_E_AX, /* pop ([0x66] 0x58) */ X86_OP_POP_E_CX, /* pop ([0x66] 0x59) */ X86_OP_POP_E_DX, /* pop ([0x66] 0x5a) */ X86_OP_POP_E_BX, /* pop ([0x66] 0x5b) */ X86_OP_POP_E_SP, /* pop ([0x66] 0x5c) */ X86_OP_POP_E_BP, /* pop ([0x66] 0x5d) */ X86_OP_POP_E_SI, /* pop ([0x66] 0x5e) */ X86_OP_POP_E_DI, /* pop ([0x66] 0x5f) */ X86_OP_PUSH_IMM1632, /* push ([0x66] 0x68) */ X86_OP_MOV_REG1632, /* mov ([0x66] 0x89) */ X86_OP_ADD8_REG1632, /* add ([0x66] 0x83) */ X86_OP_OR8_REG1632, /* or ([0x66] 0x83) */ X86_OP_ADC8_REG1632, /* adc ([0x66] 0x83) */ X86_OP_SBB8_REG1632, /* sbb ([0x66] 0x83) */ X86_OP_AND8_REG1632, /* and ([0x66] 0x83) */ X86_OP_SUB8_REG1632, /* sub ([0x66] 0x83) */ X86_OP_XOR8_REG1632, /* xor ([0x66] 0x83) */ X86_OP_TEST_RM8, /* test ([0x66] 0x84) */ X86_OP_TEST_RM1632, /* test ([0x66] 0x85) */ X86_OP_MOV_FROM_CONTENT1632, /* mov ([0x66] 0x8b) */ X86_OP_LEA, /* lea ([0x66] 0x8d) */ /* 66 ? */ X86_OP_NOP, /* nop (0x90) */ X86_OP_TEST_AL, /* test ([0x66] 0xa8) */ X86_OP_TEST_E_AX, /* test ([0x66] 0xa9) */ X86_OP_MOV_E_AX, /* mov ([0x66] 0xb8) */ X86_OP_MOV_E_CX, /* mov ([0x66] 0xb9) */ X86_OP_MOV_E_DX, /* mov ([0x66] 0xba) */ X86_OP_MOV_E_BX, /* mov ([0x66] 0xbb) */ X86_OP_MOV_E_SP, /* mov ([0x66] 0xbc) */ X86_OP_MOV_E_BP, /* mov ([0x66] 0xbd) */ X86_OP_MOV_E_SI, /* mov ([0x66] 0xbe) */ X86_OP_MOV_E_DI, /* mov ([0x66] 0xbf) */ X86_OP_RET, /* ret (0xc3) */ X86_OP_MOV_TO_CONTENT1632, /* mov ([0x66] 0xc7) */ X86_OP_LEAVE, /* leave (0xc9) */ X86_OP_INT, /* int (0xcd) */ X86_OP_CALL, /* call (0xe8) */ X86_OP_HLT, /* hlt (0xf4) */ X86_OP_PUSH_CONTENT, /* push ([0x66] 0xff) */ /* 66 ? */ X86_OP_COUNT } X86Opcodes; /* Eventuel préfixe rencontré */ typedef enum _X86Prefix { X86_PRE_NONE = 0, /* Aucun préfixe */ X86_PRE_OPSIZE /* Basculement des opérandes */ } X86Prefix; /* Définition d'une instruction x86 */ struct _asm_x86_instr { asm_instr base; /* A laisser en premier... */ X86Opcodes type; X86Prefix prefix; /* Eventuel préfixe trouvé */ }; #endif /* _ARCH_X86_INSTRUCTION_H */