diff options
Diffstat (limited to 'src/arch/undefined.c')
-rw-r--r-- | src/arch/undefined.c | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/src/arch/undefined.c b/src/arch/undefined.c index 656e3f5..5542ac2 100644 --- a/src/arch/undefined.c +++ b/src/arch/undefined.c @@ -69,6 +69,22 @@ static const char *g_undef_instruction_get_encoding(const GUndefInstruction *); /* Fournit le nom humain de l'instruction manipulée. */ static const char *g_undef_instruction_get_keyword(const GUndefInstruction *, AsmSyntax); + + +/* -------------------- CONSERVATION SUR DISQUE DES INSTRUCTIONS -------------------- */ + + +/* Charge une instruction depuis une mémoire tampon. */ +static bool g_undef_instruction_unserialize(GUndefInstruction *, GAsmStorage *, GBinFormat *, packed_buffer *); + +/* Sauvegarde une instruction dans une mémoire tampon. */ +static bool g_undef_instruction_serialize(GUndefInstruction *, GAsmStorage *, packed_buffer *); + + + +/* ------------------------ OFFRE DE CAPACITES DE GENERATION ------------------------ */ + + /* Ajoute à un tampon GLib le contenu de l'instance spécifiée. */ static void g_undef_instruction_print(GUndefInstruction *, GBufferLine *, size_t, size_t, const GBinContent *); @@ -109,6 +125,10 @@ static void g_undef_instruction_class_init(GUndefInstructionClass *klass) instr->get_encoding = (get_instruction_encoding_fc)g_undef_instruction_get_encoding; instr->get_keyword = (get_instruction_keyword_fc)g_undef_instruction_get_keyword; + + instr->unserialize = (unserialize_instruction_fc)g_undef_instruction_unserialize; + instr->serialize = (serialize_instruction_fc)g_undef_instruction_serialize; + instr->print = (print_instruction_fc)g_undef_instruction_print; } @@ -261,6 +281,81 @@ const char *g_undef_instruction_get_keyword(const GUndefInstruction *instr, AsmS } + +/* ---------------------------------------------------------------------------------- */ +/* CONSERVATION SUR DISQUE DES INSTRUCTIONS */ +/* ---------------------------------------------------------------------------------- */ + + +/****************************************************************************** +* * +* Paramètres : instr = instruction d'assemblage à consulter. * +* storage = mécanisme de sauvegarde à manipuler. * +* format = format binaire chargé associé à l'architecture. * +* pbuf = zone tampon à remplir. * +* * +* Description : Charge une instruction depuis une mémoire tampon. * +* * +* Retour : Bilan de l'opération. * +* * +* Remarques : - * +* * +******************************************************************************/ + +static bool g_undef_instruction_unserialize(GUndefInstruction *instr, GAsmStorage *storage, GBinFormat *format, packed_buffer *pbuf) +{ + bool result; /* Bilan à retourner */ + GArchInstructionClass *parent; /* Classe parente à consulter */ + + parent = G_ARCH_INSTRUCTION_CLASS(g_undef_instruction_parent_class); + + result = parent->unserialize(G_ARCH_INSTRUCTION(instr), storage, format, pbuf); + + if (result) + result = extract_packed_buffer(pbuf, &instr->status, sizeof(InstrBehaviorStatus), true); + + return result; + +} + + +/****************************************************************************** +* * +* Paramètres : instr = instruction d'assemblage à consulter. * +* storage = mécanisme de sauvegarde à manipuler. * +* pbuf = zone tampon à remplir. * +* * +* Description : Sauvegarde une instruction dans une mémoire tampon. * +* * +* Retour : Bilan de l'opération. * +* * +* Remarques : - * +* * +******************************************************************************/ + +static bool g_undef_instruction_serialize(GUndefInstruction *instr, GAsmStorage *storage, packed_buffer *pbuf) +{ + bool result; /* Bilan à retourner */ + GArchInstructionClass *parent; /* Classe parente à consulter */ + + parent = G_ARCH_INSTRUCTION_CLASS(g_undef_instruction_parent_class); + + result = parent->serialize(G_ARCH_INSTRUCTION(instr), storage, pbuf); + + if (result) + result = extend_packed_buffer(pbuf, &instr->status, sizeof(InstrBehaviorStatus), true); + + return result; + +} + + + +/* ---------------------------------------------------------------------------------- */ +/* OFFRE DE CAPACITES DE GENERATION */ +/* ---------------------------------------------------------------------------------- */ + + /****************************************************************************** * * * Paramètres : instr = instruction d'assemblage à représenter. * |