diff options
Diffstat (limited to 'plugins/arm/v7/operands/limitation.c')
-rw-r--r-- | plugins/arm/v7/operands/limitation.c | 66 |
1 files changed, 52 insertions, 14 deletions
diff --git a/plugins/arm/v7/operands/limitation.c b/plugins/arm/v7/operands/limitation.c index 5d22681..d9e11cf 100644 --- a/plugins/arm/v7/operands/limitation.c +++ b/plugins/arm/v7/operands/limitation.c @@ -26,7 +26,10 @@ #include <arch/operand-int.h> #include <common/sort.h> -#include <gtkext/gtkblockdisplay.h> +#include <core/columns.h> + + +#include "../operand-int.h" @@ -46,7 +49,7 @@ typedef struct _a7limop_extra_data_t /* Définition d'un opérande déterminant une limitation de domaine et d'accès (instance) */ struct _GArmV7LimitationOperand { - GArchOperand parent; /* Instance parente */ + GArmV7Operand parent; /* Instance parente */ }; @@ -54,7 +57,7 @@ struct _GArmV7LimitationOperand /* Définition d'un opérande déterminant une limitation de domaine et d'accès (classe) */ struct _GArmV7LimitationOperandClass { - GArchOperandClass parent; /* Classe parente */ + GArmV7OperandClass parent; /* Classe parente */ }; @@ -63,9 +66,9 @@ struct _GArmV7LimitationOperandClass * Accès aux informations éventuellement déportées. */ -#if __SIZEOF_INT__ == __SIZEOF_LONG__ +#if 1 //__SIZEOF_INT__ == __SIZEOF_LONG__ -# define GET_ARMV7_LIMITATION_OP_EXTRA(op) (a7limop_extra_data_t *)&op->extra +# define GET_ARMV7_LIMITATION_OP_EXTRA(op) ((a7limop_extra_data_t *)&((GArchOperand *)op)->extra) #else @@ -97,6 +100,9 @@ static int g_armv7_limitation_operand_compare(const GArmV7LimitationOperand *, c /* Traduit un opérande en version humainement lisible. */ static void g_armv7_limitation_operand_print(const GArmV7LimitationOperand *, GBufferLine *); +/* Fournit l'empreinte d'un candidat à une centralisation. */ +static guint g_armv7_limitation_operand_hash(const GArmV7LimitationOperand *, bool); + /* Charge un contenu depuis une mémoire tampon. */ static bool g_armv7_limitation_operand_load(GArmV7LimitationOperand *, GObjectStorage *, packed_buffer_t *); @@ -111,7 +117,7 @@ static bool g_armv7_limitation_operand_store(GArmV7LimitationOperand *, GObjectS /* Indique le type défini par la GLib pour une limitation de domaine et d'accès. */ -G_DEFINE_TYPE(GArmV7LimitationOperand, g_armv7_limitation_operand, G_TYPE_ARCH_OPERAND); +G_DEFINE_TYPE(GArmV7LimitationOperand, g_armv7_limitation_operand, G_TYPE_ARMV7_OPERAND); /****************************************************************************** @@ -138,8 +144,11 @@ static void g_armv7_limitation_operand_class_init(GArmV7LimitationOperandClass * object->finalize = (GObjectFinalizeFunc)g_armv7_limitation_operand_finalize; operand->compare = (operand_compare_fc)g_armv7_limitation_operand_compare; + operand->print = (operand_print_fc)g_armv7_limitation_operand_print; + operand->hash = (operand_hash_fc)g_armv7_limitation_operand_hash; + operand->load = (load_operand_fc)g_armv7_limitation_operand_load; operand->store = (store_operand_fc)g_armv7_limitation_operand_store; @@ -383,6 +392,43 @@ static void g_armv7_limitation_operand_print(const GArmV7LimitationOperand *oper /****************************************************************************** * * +* Paramètres : operand = objet dont l'instance se veut unique. * +* lock = précise le besoin en verrouillage. * +* * +* Description : Fournit l'empreinte d'un candidat à une centralisation. * +* * +* Retour : Empreinte de l'élément représenté. * +* * +* Remarques : - * +* * +******************************************************************************/ + +static guint g_armv7_limitation_operand_hash(const GArmV7LimitationOperand *operand, bool lock) +{ + guint result; /* Valeur à retourner */ + a7limop_extra_data_t *extra; /* Données internes à manipuler*/ + GArchOperandClass *class; /* Classe parente normalisée */ + + extra = GET_ARMV7_LIMITATION_OP_EXTRA(operand); + + if (lock) + LOCK_GOBJECT_EXTRA(extra); + + class = G_ARCH_OPERAND_CLASS(g_armv7_limitation_operand_parent_class); + result = class->hash(G_ARCH_OPERAND(operand), false); + + result ^= extra->type; + + if (lock) + UNLOCK_GOBJECT_EXTRA(extra); + + return result; + +} + + +/****************************************************************************** +* * * Paramètres : operand = élément GLib à constuire. * * storage = conservateur de données à manipuler ou NULL. * * pbuf = zone tampon à lire. * @@ -410,15 +456,11 @@ static bool g_armv7_limitation_operand_load(GArmV7LimitationOperand *operand, GO { extra = GET_ARMV7_LIMITATION_OP_EXTRA(operand); - LOCK_GOBJECT_EXTRA(extra); - result = unpack_uleb128(&value, pbuf); if (result) extra->type = value; - UNLOCK_GOBJECT_EXTRA(extra); - } return result; @@ -454,12 +496,8 @@ static bool g_armv7_limitation_operand_store(GArmV7LimitationOperand *operand, G { extra = GET_ARMV7_LIMITATION_OP_EXTRA(operand); - LOCK_GOBJECT_EXTRA(extra); - result = pack_uleb128((uleb128_t []){ extra->type }, pbuf); - UNLOCK_GOBJECT_EXTRA(extra); - } return result; |