diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2021-12-26 00:26:28 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2021-12-26 00:26:28 (GMT) |
commit | 98570719ff25a4dcde917056e55490bf2a6b1453 (patch) | |
tree | 4a01b57580aa05f8a55d37abbc4ddd178fb55a99 /plugins/arm/v7/operands/limitation.c | |
parent | 94efb7bf5239cf984a0dda9949a26719a8ae2090 (diff) |
Provide a method to hash all ARMv7 operands.
Diffstat (limited to 'plugins/arm/v7/operands/limitation.c')
-rw-r--r-- | plugins/arm/v7/operands/limitation.c | 52 |
1 files changed, 49 insertions, 3 deletions
diff --git a/plugins/arm/v7/operands/limitation.c b/plugins/arm/v7/operands/limitation.c index 5d22681..b3c6d07 100644 --- a/plugins/arm/v7/operands/limitation.c +++ b/plugins/arm/v7/operands/limitation.c @@ -29,6 +29,9 @@ #include <gtkext/gtkblockdisplay.h> +#include "../operand-int.h" + + /* -------------------------- DEFINITION D'UN NOUVEAU TYPE -------------------------- */ @@ -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 */ }; @@ -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. * |