summaryrefslogtreecommitdiff
path: root/src/arch/instructions/undefined.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/instructions/undefined.c')
-rw-r--r--src/arch/instructions/undefined.c104
1 files changed, 104 insertions, 0 deletions
diff --git a/src/arch/instructions/undefined.c b/src/arch/instructions/undefined.c
index 663a9eb..7ed5db9 100644
--- a/src/arch/instructions/undefined.c
+++ b/src/arch/instructions/undefined.c
@@ -74,6 +74,17 @@ static void g_undef_instruction_print(GUndefInstruction *, GBufferLine *, size_t
+/* --------------------- IMPLEMENTATION DES FONCTIONS DE CLASSE --------------------- */
+
+
+/* Charge un contenu depuis une mémoire tampon. */
+static bool g_undef_instruction_load(GUndefInstruction *, GObjectStorage *, packed_buffer_t *);
+
+/* Sauvegarde un contenu dans une mémoire tampon. */
+static bool g_undef_instruction_store(GUndefInstruction *, GObjectStorage *, packed_buffer_t *);
+
+
+
/* ---------------------------------------------------------------------------------- */
/* INSTRUCTION INCONNUE / DONNEES */
/* ---------------------------------------------------------------------------------- */
@@ -115,6 +126,9 @@ static void g_undef_instruction_class_init(GUndefInstructionClass *klass)
instr->print = (print_instruction_fc)g_undef_instruction_print;
+ instr->load = (load_instruction_fc)g_undef_instruction_load;
+ instr->store = (store_instruction_fc)g_undef_instruction_store;
+
}
@@ -440,3 +454,93 @@ InstrExpectedBehavior g_undef_instruction_get_behavior(const GUndefInstruction *
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_undef_instruction_load(GUndefInstruction *instr, GObjectStorage *storage, packed_buffer_t *pbuf)
+{
+ bool result; /* Bilan à retourner */
+ GArchInstructionClass *parent; /* Classe parente à consulter */
+ undef_extra_data_t *extra; /* Données insérées à consulter*/
+ uint8_t val; /* Champ de bits manipulé */
+
+ parent = G_ARCH_INSTRUCTION_CLASS(g_undef_instruction_parent_class);
+
+ result = parent->load(G_ARCH_INSTRUCTION(instr), storage, pbuf);
+
+ if (result)
+ {
+ extra = GET_UNDEF_INSTR_EXTRA(instr);
+
+ LOCK_GOBJECT_EXTRA(extra);
+
+ result = extract_packed_buffer(pbuf, &val, sizeof(uint8_t), false);
+ extra->behavior = val;
+
+ UNLOCK_GOBJECT_EXTRA(extra);
+
+ }
+
+ 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_undef_instruction_store(GUndefInstruction *instr, GObjectStorage *storage, packed_buffer_t *pbuf)
+{
+ bool result; /* Bilan à retourner */
+ GArchInstructionClass *parent; /* Classe parente à consulter */
+ undef_extra_data_t *extra; /* Données insérées à consulter*/
+
+ parent = G_ARCH_INSTRUCTION_CLASS(g_undef_instruction_parent_class);
+
+ result = parent->store(G_ARCH_INSTRUCTION(instr), storage, pbuf);
+
+ if (result)
+ {
+ extra = GET_UNDEF_INSTR_EXTRA(instr);
+
+ LOCK_GOBJECT_EXTRA(extra);
+
+ result = extend_packed_buffer(pbuf, (uint8_t []){ extra->behavior }, sizeof(uint8_t), false);
+
+ UNLOCK_GOBJECT_EXTRA(extra);
+
+ }
+
+ return result;
+
+}