summaryrefslogtreecommitdiff
path: root/plugins/arm/v7
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/arm/v7')
-rw-r--r--plugins/arm/v7/instruction.c109
1 files changed, 109 insertions, 0 deletions
diff --git a/plugins/arm/v7/instruction.c b/plugins/arm/v7/instruction.c
index 30a5bd8..eb4a082 100644
--- a/plugins/arm/v7/instruction.c
+++ b/plugins/arm/v7/instruction.c
@@ -97,6 +97,17 @@ static bool g_armv7_instruction_serialize(GArmV7Instruction *, GAsmStorage *, pa
+/* --------------------- IMPLEMENTATION DES FONCTIONS DE CLASSE --------------------- */
+
+
+/* Charge un contenu depuis une mémoire tampon. */
+static bool g_armv7_instruction_load(GArmV7Instruction *, GObjectStorage *, packed_buffer_t *);
+
+/* Sauvegarde un contenu dans une mémoire tampon. */
+static bool g_armv7_instruction_store(GArmV7Instruction *, GObjectStorage *, packed_buffer_t *);
+
+
+
/* Indique le type défini pour une représentation d'une instruction ARMv7. */
G_DEFINE_TYPE(GArmV7Instruction, g_armv7_instruction, G_TYPE_ARM_INSTRUCTION);
@@ -132,6 +143,9 @@ static void g_armv7_instruction_class_init(GArmV7InstructionClass *klass)
instr->unserialize = (unserialize_instruction_fc)g_armv7_instruction_unserialize;
instr->serialize = (serialize_instruction_fc)g_armv7_instruction_serialize;
+ instr->load = (load_instruction_fc)g_armv7_instruction_load;
+ instr->store = (store_instruction_fc)g_armv7_instruction_store;
+
}
@@ -506,3 +520,98 @@ static bool g_armv7_instruction_serialize(GArmV7Instruction *instr, GAsmStorage
return result;
}
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* IMPLEMENTATION DES FONCTIONS DE CLASSE */
+/* ---------------------------------------------------------------------------------- */
+
+
+/******************************************************************************
+* *
+* Paramètres : instr = é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_instruction_load(GArmV7Instruction *instr, GObjectStorage *storage, packed_buffer_t *pbuf)
+{
+ bool result; /* Bilan à retourner */
+ GArchInstructionClass *parent; /* Classe parente à consulter */
+ uleb128_t value; /* Valeur ULEB128 à charger */
+ uint8_t boolean; /* Valeur booléenne */
+
+ parent = G_ARCH_INSTRUCTION_CLASS(g_armv7_instruction_parent_class);
+
+ result = parent->load(G_ARCH_INSTRUCTION(instr), storage, pbuf);
+
+ if (result)
+ result = unpack_uleb128(&value, pbuf);
+
+ if (result)
+ instr->sid = value;
+
+ if (result)
+ result = extract_packed_buffer(pbuf, &instr->encoding, sizeof(char), false);
+
+ if (result)
+ {
+ result = extract_packed_buffer(pbuf, &boolean, sizeof(uint8_t), false);
+
+ if (result)
+ instr->setflags = (boolean == 1 ? true : false);
+
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : instr = é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_instruction_store(GArmV7Instruction *instr, GObjectStorage *storage, packed_buffer_t *pbuf)
+{
+ bool result; /* Bilan à retourner */
+ GArchInstructionClass *parent; /* Classe parente à consulter */
+ uint8_t boolean; /* Valeur booléenne */
+
+ parent = G_ARCH_INSTRUCTION_CLASS(g_armv7_instruction_parent_class);
+
+ result = parent->store(G_ARCH_INSTRUCTION(instr), storage, pbuf);
+
+ if (result)
+ result = pack_uleb128((uleb128_t []){ instr->sid }, pbuf);
+
+ if (result)
+ result = extend_packed_buffer(pbuf, &instr->encoding, sizeof(char), false);
+
+ if (result)
+ {
+ boolean = (instr->setflags ? 1 : 0);
+ result = extend_packed_buffer(pbuf, &boolean, sizeof(uint8_t), false);
+ }
+
+ return result;
+
+}