/* OpenIDA - Outil d'analyse de fichiers binaires * operand-int.h - prototypes pour la définition générique interne des opérandes * * 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_OPERAND_INT_H #define _ARCH_OPERAND_INT_H #include #include "operand.h" /* Types d'opérandes rencontrables */ typedef enum _AsmOperandType { AOT_NONE, /* Type d'opérande inconnu ! */ AOT_IMM, /* Valeur immédiate */ AOT_REG, /* Registre quelconque */ AOT_MEM, /* Accès à la mémoire */ /* X86 */ AOT_MOFFS /* Emplacement mémoire */ } AsmOperandType; /* Définition générique d'une opérande */ struct _asm_operand { AsmOperandType type; /* Type d'opérande */ AsmOperandSize size; /* Taille de l'opérande */ /** * Note : dans le cas d'une valeur signée, * signed_imm contient la valeur lue/donnée, et * unsigned_imm la valeur humainement lisible (ie. positive). */ union { uint8_t val8; /* Valeur sur 8 bits */ uint16_t val16; /* Valeur sur 16 bits */ uint32_t val32; /* Valeur sur 32 bits */ uint64_t val64; /* Valeur sur 64 bits */ } unsigned_imm; union { uint8_t val8; /* Valeur sur 8 bits */ uint16_t val16; /* Valeur sur 16 bits */ uint32_t val32; /* Valeur sur 32 bits */ uint64_t val64; /* Valeur sur 64 bits */ } signed_imm; }; #define ASM_OPERAND(o) ((asm_operand *)o) /* Traduit un opérande en version humainement lisible. */ typedef char * (* get_operand_text_fc) (const GArchOperand *, const exe_format *, AsmSyntax); /* Définition générique d'un opérande d'architecture (instance) */ struct _GArchOperand { GObject parent; /* A laisser en premier */ get_operand_text_fc get_text; /* Texte humain équivalent */ }; /* Définition générique d'un opérande d'architecture (classe) */ struct _GArchOperandClass { GObjectClass parent; /* A laisser en premier */ }; #endif /* _ARCH_OPERAND_INT_H */