diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2021-12-30 18:28:18 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2021-12-30 18:44:35 (GMT) |
commit | 945e0c9ecce02155555387aad672e272f5646362 (patch) | |
tree | 3d35bdb25012a9ef710a13c9e733b5a80f6641b1 /plugins/arm/v7/operands/maccess.c | |
parent | 98570719ff25a4dcde917056e55490bf2a6b1453 (diff) |
Create generic functions to load and store operands.
Diffstat (limited to 'plugins/arm/v7/operands/maccess.c')
-rw-r--r-- | plugins/arm/v7/operands/maccess.c | 127 |
1 files changed, 6 insertions, 121 deletions
diff --git a/plugins/arm/v7/operands/maccess.c b/plugins/arm/v7/operands/maccess.c index 3eb3116..d503b12 100644 --- a/plugins/arm/v7/operands/maccess.c +++ b/plugins/arm/v7/operands/maccess.c @@ -99,12 +99,6 @@ static void g_armv7_maccess_operand_update_inner_instances(GArmV7MAccessOperand /* Fournit l'empreinte d'un candidat à une centralisation. */ static guint g_armv7_maccess_operand_hash(const GArmV7MAccessOperand *, bool); -/* Charge un contenu depuis une mémoire tampon. */ -static bool g_armv7_maccess_operand_load(GArmV7MAccessOperand *, GObjectStorage *, packed_buffer_t *); - -/* Sauvegarde un contenu dans une mémoire tampon. */ -static bool g_armv7_maccess_operand_store(GArmV7MAccessOperand *, GObjectStorage *, packed_buffer_t *); - /* ---------------------------------------------------------------------------------- */ @@ -150,8 +144,8 @@ static void g_armv7_maccess_operand_class_init(GArmV7MAccessOperandClass *klass) operand->update_inner = (operand_update_inners_fc)g_armv7_maccess_operand_update_inner_instances; operand->hash = (operand_hash_fc)g_armv7_maccess_operand_hash; - operand->load = (load_operand_fc)g_armv7_maccess_operand_load; - operand->store = (store_operand_fc)g_armv7_maccess_operand_store; + operand->load = g_arch_operand_load_generic_fixed_3; + operand->store = g_arch_operand_store_generic_fixed; } @@ -638,28 +632,28 @@ static void g_armv7_maccess_operand_update_inner_instances(GArmV7MAccessOperand switch (i) { case 0: - g_object_unref(G_OBJECT(operand->base)); + g_clear_object(&operand->base); operand->base = instances[i]; break; case 1: if (operand->offset != NULL) { - g_object_unref(G_OBJECT(operand->offset)); + g_clear_object(&operand->offset); operand->offset = instances[i]; } else { assert(count == 2); - g_object_unref(G_OBJECT(operand->shift)); + g_clear_object(&operand->shift); operand->shift = instances[i]; } break; case 2: - g_object_unref(G_OBJECT(operand->shift)); + g_clear_object(&operand->shift); operand->shift = instances[i]; break; @@ -716,112 +710,3 @@ static guint g_armv7_maccess_operand_hash(const GArmV7MAccessOperand *operand, b return result; } - - -/****************************************************************************** -* * -* Paramètres : operand = élément GLib à constuire. * -* storage = conservateur de données à manipuler ou NULL. * -* pbuf = zone tampon à lire. * -* * -* Description : Charge un contenu depuis une mémoire tampon. * -* * -* Retour : Bilan de l'opération. * -* * -* Remarques : - * -* * -******************************************************************************/ - -static bool g_armv7_maccess_operand_load(GArmV7MAccessOperand *operand, GObjectStorage *storage, packed_buffer_t *pbuf) -{ - bool result; /* Bilan à retourner */ - GArchOperandClass *parent; /* Classe parente à consulter */ - GSerializableObject *obj; /* Instance à manipuler */ - - parent = G_ARCH_OPERAND_CLASS(g_armv7_maccess_operand_parent_class); - - result = parent->load(G_ARCH_OPERAND(operand), storage, pbuf); - - if (result) - { - obj = g_object_storage_unpack_object(storage, "operands", pbuf); - - result = (obj != NULL); - - if (result) - operand->base = G_ARCH_OPERAND(obj); - - } - - if (result) - { - obj = g_object_storage_unpack_object(storage, "operands", pbuf); - - result = (obj != NULL); - - if (result) - operand->offset = G_ARCH_OPERAND(obj); - - } - - if (result) - { - obj = g_object_storage_unpack_object(storage, "operands", pbuf); - - result = (obj != NULL); - - if (result) - operand->shift = G_ARCH_OPERAND(obj); - - } - - return result; - -} - - -/****************************************************************************** -* * -* Paramètres : operand = élément GLib à consulter. * -* storage = conservateur de données à manipuler ou NULL. * -* pbuf = zone tampon à remplir. * -* * -* Description : Sauvegarde un contenu dans une mémoire tampon. * -* * -* Retour : Bilan de l'opération. * -* * -* Remarques : - * -* * -******************************************************************************/ - -static bool g_armv7_maccess_operand_store(GArmV7MAccessOperand *operand, GObjectStorage *storage, packed_buffer_t *pbuf) -{ - bool result; /* Bilan à retourner */ - GArchOperandClass *parent; /* Classe parente à consulter */ - GSerializableObject *obj; /* Instance à manipuler */ - - parent = G_ARCH_OPERAND_CLASS(g_armv7_maccess_operand_parent_class); - - result = parent->store(G_ARCH_OPERAND(operand), storage, pbuf); - - if (result) - { - obj = G_SERIALIZABLE_OBJECT(operand->base); - result = g_object_storage_pack_object(storage, "operands", obj, pbuf); - } - - if (result) - { - obj = G_SERIALIZABLE_OBJECT(operand->offset); - result = g_object_storage_pack_object(storage, "operands", obj, pbuf); - } - - if (result) - { - obj = G_SERIALIZABLE_OBJECT(operand->shift); - result = g_object_storage_pack_object(storage, "operands", obj, pbuf); - } - - return result; - -} |