/* 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_INC_EAX, /* inc (0x40) */ X86_OP_INC_ECX, /* inc (0x41) */ X86_OP_INC_EDX, /* inc (0x42) */ X86_OP_INC_EBX, /* inc (0x43) */ X86_OP_INC_ESP, /* inc (0x44) */ X86_OP_INC_EBP, /* inc (0x45) */ X86_OP_INC_ESI, /* inc (0x46) */ X86_OP_INC_EDI, /* inc (0x47) */ X86_OP_DEC_EAX, /* dec (0x48) */ X86_OP_DEC_ECX, /* dec (0x49) */ X86_OP_DEC_EDX, /* dec (0x4a) */ X86_OP_DEC_EBX, /* dec (0x4b) */ X86_OP_DEC_ESP, /* dec (0x4c) */ X86_OP_DEC_EBP, /* dec (0x4d) */ X86_OP_DEC_ESI, /* dec (0x4e) */ X86_OP_DEC_EDI, /* dec (0x4f) */ X86_OP_PUSH_EAX, /* push (0x50) */ X86_OP_PUSH_ECX, /* push (0x51) */ X86_OP_PUSH_EDX, /* push (0x52) */ X86_OP_PUSH_EBX, /* push (0x53) */ X86_OP_PUSH_ESP, /* push (0x54) */ X86_OP_PUSH_EBP, /* push (0x55) */ X86_OP_PUSH_ESI, /* push (0x56) */ X86_OP_PUSH_EDI, /* push (0x57) */ X86_OP_POP_EAX, /* pop (0x58) */ X86_OP_POP_ECX, /* pop (0x59) */ X86_OP_POP_EDX, /* pop (0x5a) */ X86_OP_POP_EBX, /* pop (0x5b) */ X86_OP_POP_ESP, /* pop (0x5c) */ X86_OP_POP_EBP, /* pop (0x5d) */ X86_OP_POP_ESI, /* pop (0x5e) */ X86_OP_POP_EDI, /* pop (0x5f) */ X86_OP_NOP, /* nop (0x90) */ X86_OP_MOV_AX, /* mov (0xb8) */ X86_OP_MOV_CX, /* mov (0xb9) */ X86_OP_MOV_DX, /* mov (0xba) */ X86_OP_MOV_BX, /* mov (0xbb) */ X86_OP_MOV_SP, /* mov (0xbc) */ X86_OP_MOV_BP, /* mov (0xbd) */ X86_OP_MOV_SI, /* mov (0xbe) */ X86_OP_MOV_DI, /* mov (0xbf) */ X86_OP_INT, /* int (0xcd) */ X86_OP_HLT, /* hlt (0xf4) */ X86_OP_INC_AX, /* inc (0x66 0x40) */ X86_OP_INC_CX, /* inc (0x66 0x41) */ X86_OP_INC_DX, /* inc (0x66 0x42) */ X86_OP_INC_BX, /* inc (0x66 0x43) */ X86_OP_INC_SP, /* inc (0x66 0x44) */ X86_OP_INC_BP, /* inc (0x66 0x45) */ X86_OP_INC_SI, /* inc (0x66 0x46) */ X86_OP_INC_DI, /* inc (0x66 0x47) */ X86_OP_DEC_AX, /* dec (0x66 0x48) */ X86_OP_DEC_CX, /* dec (0x66 0x49) */ X86_OP_DEC_DX, /* dec (0x66 0x4a) */ X86_OP_DEC_BX, /* dec (0x66 0x4b) */ X86_OP_DEC_SP, /* dec (0x66 0x4c) */ X86_OP_DEC_BP, /* dec (0x66 0x4d) */ X86_OP_DEC_SI, /* dec (0x66 0x4e) */ X86_OP_DEC_DI, /* dec (0x66 0x4f) */ X86_OP_PUSH_AX, /* push (0x66 0x50) */ X86_OP_PUSH_CX, /* push (0x66 0x51) */ X86_OP_PUSH_DX, /* push (0x66 0x52) */ X86_OP_PUSH_BX, /* push (0x66 0x53) */ X86_OP_PUSH_SP, /* push (0x66 0x54) */ X86_OP_PUSH_BP, /* push (0x66 0x55) */ X86_OP_PUSH_SI, /* push (0x66 0x56) */ X86_OP_PUSH_DI, /* push (0x66 0x57) */ X86_OP_POP_AX, /* pop (0x66 0x58) */ X86_OP_POP_CX, /* pop (0x66 0x59) */ X86_OP_POP_DX, /* pop (0x66 0x5a) */ X86_OP_POP_BX, /* pop (0x66 0x5b) */ X86_OP_POP_SP, /* pop (0x66 0x5c) */ X86_OP_POP_BP, /* pop (0x66 0x5d) */ X86_OP_POP_SI, /* pop (0x66 0x5e) */ X86_OP_POP_DI, /* pop (0x66 0x5f) */ X86_OP_MOV_EAX, /* mov (0x66 0xb8) */ X86_OP_MOV_ECX, /* mov (0x66 0xb9) */ X86_OP_MOV_EDX, /* mov (0x66 0xba) */ X86_OP_MOV_EBX, /* mov (0x66 0xbb) */ X86_OP_MOV_ESP, /* mov (0x66 0xbc) */ X86_OP_MOV_EBP, /* mov (0x66 0xbd) */ X86_OP_MOV_ESI, /* mov (0x66 0xbe) */ X86_OP_MOV_EDI, /* mov (0x66 0xbf) */ 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 */