diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2016-10-29 11:37:13 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2016-10-29 11:37:13 (GMT) |
commit | 38e455ebbbbf90ddbf552f95a1dfb3c544907587 (patch) | |
tree | c6e2a4763baef01c87dd0954116fb2c457e10c23 /src/arch/undefined.c | |
parent | 8c71b36d401b2473342daddcb9b7eb4b83ba3295 (diff) |
Reduced once again the size of the main instruction structure.
Diffstat (limited to 'src/arch/undefined.c')
-rw-r--r-- | src/arch/undefined.c | 89 |
1 files changed, 46 insertions, 43 deletions
diff --git a/src/arch/undefined.c b/src/arch/undefined.c index e69a399..df2e9ff 100644 --- a/src/arch/undefined.c +++ b/src/arch/undefined.c @@ -66,12 +66,12 @@ static void g_undef_instruction_finalize(GUndefInstruction *); /* Indique l'encodage d'une instruction de façon détaillée. */ 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); + /* Ajoute à un tampon GLib le contenu de l'instance spécifiée. */ static GBufferLine *g_undef_instruction_print(GUndefInstruction *, GCodeBuffer *, MemoryDataSize, const GBinContent *, AsmSyntax); -/* Reconstruit le cache complet d'une désignation d'instruction. */ -static void g_undef_instruction_build_keyword(const GUndefInstruction *, AsmSyntax); - /* ---------------------------------------------------------------------------------- */ @@ -108,8 +108,8 @@ static void g_undef_instruction_class_init(GUndefInstructionClass *klass) instr = G_ARCH_INSTRUCTION_CLASS(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->print = (print_instruction_fc)g_undef_instruction_print; - instr->build_key = (build_instruction_keyword_fc)g_undef_instruction_build_keyword; } @@ -220,6 +220,48 @@ static const char *g_undef_instruction_get_encoding(const GUndefInstruction *ins /****************************************************************************** * * +* Paramètres : instr = instruction d'assemblage à consulter. * +* syntax = type de représentation demandée. * +* * +* Description : Fournit le nom humain de l'instruction manipulée. * +* * +* Retour : Mot clef de bas niveau. * +* * +* Remarques : - * +* * +******************************************************************************/ + +const char *g_undef_instruction_get_keyword(const GUndefInstruction *instr, AsmSyntax syntax) +{ + const char *result; /* Désignation à retourner */ + + switch (instr->status) + { + case IBS_NOP: + result = "nop"; + break; + + case IBS_UNDEFINED: + result = "undefined"; + break; + + case IBS_UNPREDICTABLE: + result = "unpredictable"; + break; + + default: + assert(false); + break; + + } + + return result; + +} + + +/****************************************************************************** +* * * Paramètres : instr = instruction d'assemblage à représenter. * * buffer = espace où placer ledit contenu. * * msize = taille idéale des positions et adresses; * @@ -263,45 +305,6 @@ static GBufferLine *g_undef_instruction_print(GUndefInstruction *instr, GCodeBuf /****************************************************************************** * * -* Paramètres : instr = instruction à traiter. * -* format = format du binaire manipulé. * -* syntax = type de représentation demandée. * -* * -* Description : Reconstruit le cache complet d'une désignation d'instruction.* -* * -* Retour : Mot clef de bas niveau. * -* * -* Remarques : - * -* * -******************************************************************************/ - -static void g_undef_instruction_build_keyword(const GUndefInstruction *instr, AsmSyntax syntax) -{ - switch (instr->status) - { - case IBS_NOP: - G_ARCH_INSTRUCTION(instr)->cached_keyword = strdup("nop"); - break; - - case IBS_UNDEFINED: - G_ARCH_INSTRUCTION(instr)->cached_keyword = strdup("undefined"); - break; - - case IBS_UNPREDICTABLE: - G_ARCH_INSTRUCTION(instr)->cached_keyword = strdup("unpredictable"); - break; - - default: - assert(false); - break; - - } - -} - - -/****************************************************************************** -* * * Paramètres : instr = instruction à consulter. * * * * Description : Indique le type de conséquences réél de l'instruction. * |