diff options
Diffstat (limited to 'src/arch/operand-int.h')
-rw-r--r-- | src/arch/operand-int.h | 129 |
1 files changed, 121 insertions, 8 deletions
diff --git a/src/arch/operand-int.h b/src/arch/operand-int.h index a50ec73..e6c1232 100644 --- a/src/arch/operand-int.h +++ b/src/arch/operand-int.h @@ -28,9 +28,16 @@ #include "operand.h" +#include <stdbool.h> + + +#include "../analysis/storage/storage.h" +#include "../glibext/objhole.h" + + /* Compare un opérande avec un autre. */ -typedef int (* operand_compare_fc) (const GArchOperand *, const GArchOperand *); +typedef int (* operand_compare_fc) (const GArchOperand *, const GArchOperand *, bool); /* Détermine le chemin conduisant à un opérande interne. */ typedef char * (* find_inner_operand_fc) (const GArchOperand *, const GArchOperand *); @@ -41,14 +48,43 @@ typedef GArchOperand * (* get_inner_operand_fc) (const GArchOperand *, const cha /* Traduit un opérande en version humainement lisible. */ typedef void (* operand_print_fc) (const GArchOperand *, GBufferLine *); +#ifdef INCLUDE_GTK_SUPPORT + /* Construit un petit résumé concis de l'opérande. */ typedef char * (* operand_build_tooltip_fc) (const GArchOperand *, const GLoadedBinary *); -/* Charge un opérande depuis une mémoire tampon. */ -typedef bool (* unserialize_operand_fc) (GArchOperand *, GAsmStorage *, GBinFormat *, packed_buffer_t *); +#endif + +/* Fournit une liste de candidats embarqués par un candidat. */ +typedef GArchOperand ** (* operand_list_inners_fc) (const GArchOperand *, size_t *); + +/* Met à jour une liste de candidats embarqués par un candidat. */ +typedef void (* operand_update_inners_fc) (GArchOperand *, GArchOperand **, size_t); -/* Sauvegarde un opérande dans une mémoire tampon. */ -typedef bool (* serialize_operand_fc) (const GArchOperand *, GAsmStorage *, packed_buffer_t *); +/* Fournit l'empreinte d'un candidat à une centralisation. */ +typedef guint (* operand_hash_fc) (const GArchOperand *, bool); + +/* Charge un contenu depuis une mémoire tampon. */ +typedef bool (* load_operand_fc) (GArchOperand *, GObjectStorage *, packed_buffer_t *); + +/* Sauvegarde un contenu dans une mémoire tampon. */ +typedef bool (* store_operand_fc) (GArchOperand *, GObjectStorage *, packed_buffer_t *); + + +/* Informations glissées dans la structure GObject de GArchOperand */ +typedef struct _operand_extra_data_t +{ + ArchOperandFlag flags; /* Informations diverses */ + +} operand_extra_data_t; + +/* Encapsulation avec un verrou d'accès */ +typedef union _operand_obj_extra_t +{ + operand_extra_data_t data; /* Données embarquées */ + lockable_obj_extra_t lockable; /* Gestion d'accès aux fanions */ + +} operand_obj_extra_t; /* Définition générique d'un opérande d'architecture (instance) */ @@ -56,8 +92,20 @@ struct _GArchOperand { GObject parent; /* A laisser en premier */ -}; +#if 1 //__SIZEOF_INT__ == __SIZEOF_LONG__ + + /** + * L'inclusion des informations suivantes dépend de l'architecture. + * + * Si la structure GObject possède un trou, on remplit de préférence + * ce dernier. + */ + + operand_obj_extra_t extra; /* Externalisation embarquée */ +#endif + +}; /* Définition générique d'un opérande d'architecture (classe) */ struct _GArchOperandClass @@ -69,13 +117,78 @@ struct _GArchOperandClass get_inner_operand_fc get_inner; /* Récupération d'un opérande */ operand_print_fc print; /* Texte humain équivalent */ +#ifdef INCLUDE_GTK_SUPPORT operand_build_tooltip_fc build_tooltip; /* Construction de description */ +#endif + + operand_list_inners_fc list_inner; /* Récupération d'internes */ + operand_update_inners_fc update_inner; /* Mise à jour des éléments */ + operand_hash_fc hash; /* Prise d'empreinte */ - unserialize_operand_fc unserialize; /* Chargement depuis un tampon */ - serialize_operand_fc serialize; /* Conservation dans un tampon */ + load_operand_fc load; /* Chargement depuis un tampon */ + store_operand_fc store; /* Conservation dans un tampon */ }; +/** + * Accès aux informations éventuellement déportées. + */ + +#if 1 //__SIZEOF_INT__ == __SIZEOF_LONG__ + +# define GET_ARCH_OP_EXTRA(op) (operand_extra_data_t *)&op->extra + +#else + +# define GET_ARCH_OP_EXTRA(op) GET_GOBJECT_EXTRA(G_OBJECT(op), operand_extra_data_t) + +#endif + + +/* Ajoute une information complémentaire à un opérande. */ +bool _g_arch_operand_set_flag(GArchOperand *, ArchOperandFlag, bool); + +/* Retire une information complémentaire à un opérande. */ +bool _g_arch_operand_unset_flag(GArchOperand *, ArchOperandFlag, bool); + + + +/* ------------------------ CONTROLE DU VOLUME DES INSTANCES ------------------------ */ + + +/* Fournit une liste de candidats embarqués par un candidat. */ +GArchOperand **g_arch_operand_list_inner_instances(const GArchOperand *, size_t *); + +/* Met à jour une liste de candidats embarqués par un candidat. */ +void g_arch_operand_update_inner_instances(GArchOperand *, GArchOperand **, size_t); + + + +/* -------------------- CONSERVATION ET RECHARGEMENT DES DONNEES -------------------- */ + + +/* Charge une série d'opérandes internes depuis un tampon. */ +bool _g_arch_operand_load_inner_instances(GArchOperand *, GObjectStorage *, packed_buffer_t *, size_t); + +/* Charge une série d'opérandes internes depuis un tampon. */ +bool g_arch_operand_load_generic_fixed_1(GArchOperand *, GObjectStorage *, packed_buffer_t *); + +/* Charge une série d'opérandes internes depuis un tampon. */ +bool g_arch_operand_load_generic_fixed_3(GArchOperand *, GObjectStorage *, packed_buffer_t *); + +/* Charge une série d'opérandes internes depuis un tampon. */ +bool g_arch_operand_load_generic_variadic(GArchOperand *, GObjectStorage *, packed_buffer_t *); + +/* Sauvegarde une série d'opérandes internes dans un tampon. */ +bool _g_arch_operand_store_inner_instances(GArchOperand *, GObjectStorage *, packed_buffer_t *, bool); + +/* Sauvegarde un opérande dans un tampon de façon générique. */ +bool g_arch_operand_store_generic_fixed(GArchOperand *, GObjectStorage *, packed_buffer_t *); + +/* Sauvegarde un opérande dans un tampon de façon générique. */ +bool g_arch_operand_store_generic_variadic(GArchOperand *, GObjectStorage *, packed_buffer_t *); + + #endif /* _ARCH_OPERAND_INT_H */ |