diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2016-10-28 20:20:41 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2016-10-28 20:20:41 (GMT) |
commit | 2c70e3332b43bdcbe215081b697395d254418e48 (patch) | |
tree | d3287462eccd65d189f82de8428692bbaf477cbc /src/arch | |
parent | 0f0cb560006c0ef5eb690f89c4ce720936c9d6f6 (diff) |
Cleaned the structure for instructions a little bit.
Diffstat (limited to 'src/arch')
-rw-r--r-- | src/arch/dalvik/instruction.c | 4 | ||||
-rw-r--r-- | src/arch/instruction-int.h | 14 | ||||
-rw-r--r-- | src/arch/instruction.c | 38 | ||||
-rw-r--r-- | src/arch/instruction.h | 18 |
4 files changed, 23 insertions, 51 deletions
diff --git a/src/arch/dalvik/instruction.c b/src/arch/dalvik/instruction.c index 6e95147..3735bd7 100644 --- a/src/arch/dalvik/instruction.c +++ b/src/arch/dalvik/instruction.c @@ -393,8 +393,8 @@ static void g_dalvik_instruction_init(GDalvikInstruction *instr) parent = G_ARCH_INSTRUCTION(instr); - parent->get_rw_regs = (get_instruction_rw_regs_fc)g_dalvik_instruction_get_rw_registers; - parent->decomp = (decomp_instr_fc)dalvik_instruction_decompile; + //parent->get_rw_regs = (get_instruction_rw_regs_fc)g_dalvik_instruction_get_rw_registers; + //parent->decomp = (decomp_instr_fc)dalvik_instruction_decompile; } diff --git a/src/arch/instruction-int.h b/src/arch/instruction-int.h index 8eb6b68..c393b5f 100644 --- a/src/arch/instruction-int.h +++ b/src/arch/instruction-int.h @@ -67,15 +67,6 @@ struct _GArchInstruction mrange_t range; /* Emplacement en mémoire */ - /* ------- %< ----------- */ - - vmpa2t address2; /* Position associée */ - off_t offset; /* Position physique de départ */ - //off_t length; /* Taille de l'instruction */ - - vmpa_t address; /* Position associée */ - - /* ------- %< ----------- */ GArchOperand **operands; /* Liste des opérandes */ size_t operands_count; /* Nbre. d'opérandes utilisées */ @@ -89,18 +80,17 @@ struct _GArchInstruction GArchInstruction **to; /* Eventuelles lignes visées */ InstructionLinkType *to_types; /* Type des liens de dest. */ - link_extra_info *links_info; /* Informations complémentaires*/ size_t to_count; /* Nombre de ces destinations */ GRWLock to_access; /* Verrou de protection */ #ifndef NDEBUG gint hold_to_access; /* Suivi des verrouillages */ #endif - get_instruction_rw_regs_fc get_rw_regs; /* Liste des registres liés */ + //get_instruction_rw_regs_fc get_rw_regs; /* Liste des registres liés */ //print_instruction_fc print; /* Imprime l'ensemble */ //get_instruction_keyword_fc get_key; /* Texte humain équivalent */ //is_instruction_return_fc is_return; /* Retour de fonction ou pas ? */ - decomp_instr_fc decomp; /* Procédure de décompilation */ + //decomp_instr_fc decomp; /* Procédure de décompilation */ }; diff --git a/src/arch/instruction.c b/src/arch/instruction.c index 4c0fdb9..fa631ac 100644 --- a/src/arch/instruction.c +++ b/src/arch/instruction.c @@ -372,10 +372,10 @@ const mrange_t *g_arch_instruction_get_range(const GArchInstruction *instr) void g_arch_instruction_get_location(const GArchInstruction *instr, off_t *offset, off_t *length, vmpa_t *address) { - if (offset != NULL) *offset = instr->offset; + //if (offset != NULL) *offset = instr->offset; //if (length != NULL) *length = instr->length; - if (address != NULL) *address = instr->address; + //if (address != NULL) *address = instr->address; } @@ -529,6 +529,8 @@ void g_arch_instruction_detach_operand(GArchInstruction *instr, GArchOperand *op void g_arch_instruction_get_rw_registers(const GArchInstruction *instr, GArchRegister ***rregs, size_t *rcount, GArchRegister ***wregs, size_t *wcount) { +#if 0 + size_t i; /* Boucle de parcours */ *rregs = NULL; @@ -544,6 +546,8 @@ void g_arch_instruction_get_rw_registers(const GArchInstruction *instr, GArchReg for (i = 0; i < *wcount; i++) g_object_ref(G_OBJECT((*wregs)[i])); +#endif + } @@ -568,10 +572,9 @@ void g_arch_instruction_get_rw_registers(const GArchInstruction *instr, GArchReg * * ******************************************************************************/ -void g_arch_instruction_link_with(GArchInstruction *instr, GArchInstruction *dest, InstructionLinkType type, ...) +void g_arch_instruction_link_with(GArchInstruction *instr, GArchInstruction *dest, InstructionLinkType type) { size_t count; /* Raccourci pour la lecture */ - va_list ap; /* Gestion des variations */ /* Côté destination */ @@ -599,25 +602,10 @@ void g_arch_instruction_link_with(GArchInstruction *instr, GArchInstruction *des count * sizeof(GArchInstruction *)); instr->to_types = (InstructionLinkType *)realloc(instr->to_types, count * sizeof(InstructionLinkType)); - instr->links_info = (link_extra_info *)realloc(instr->links_info, - count * sizeof(link_extra_info)); instr->to[count - 1] = dest; instr->to_types[count - 1] = type; - va_start(ap, type); - - switch (type) - { - case ILT_CASE_JUMP: - instr->links_info[count - 1].imm = va_arg(ap, GImmOperand *); - break; - default: - break; - } - - va_end(ap); - g_arch_instruction_wunlock_dest(instr); } @@ -854,7 +842,6 @@ bool g_arch_instruction_has_destinations(const GArchInstruction *instr) * Paramètres : instr = instruction dont les informations sont à consulter. * * dests = liste des instructions de destination. [OUT] * * types = liste des types de liens présents. [OUT] * -* info = éventuelles informations complémentaires. [OUT] * * * * Description : Fournit les destinations d'une instruction donnée. * * * @@ -864,7 +851,7 @@ bool g_arch_instruction_has_destinations(const GArchInstruction *instr) * * ******************************************************************************/ -size_t g_arch_instruction_get_destinations(const GArchInstruction *instr, GArchInstruction ***dests, InstructionLinkType **types, link_extra_info **info) +size_t g_arch_instruction_get_destinations(const GArchInstruction *instr, GArchInstruction ***dests, InstructionLinkType **types) { assert(g_atomic_int_get(&instr->hold_to_access) > 0); @@ -874,9 +861,6 @@ size_t g_arch_instruction_get_destinations(const GArchInstruction *instr, GArchI if (types != NULL) *types = instr->to_types; - if (info != NULL) - *info = instr->links_info; - return instr->to_count; } @@ -1114,6 +1098,8 @@ GBufferLine *g_arch_instruction_print(const GArchInstruction *instr, GCodeBuffer GDecInstruction *g_arch_instruction_decompile(const GArchInstruction *instr, GDecContext *ctx) { +#if 0 + GDecInstruction *result; /* Instruction à retourner */ GDecInstruction *list; /* Instructions décompilées */ @@ -1139,6 +1125,10 @@ GDecInstruction *g_arch_instruction_decompile(const GArchInstruction *instr, GDe return result; +#endif + + return NULL; + } diff --git a/src/arch/instruction.h b/src/arch/instruction.h index 93dfa52..00e64ab 100644 --- a/src/arch/instruction.h +++ b/src/arch/instruction.h @@ -131,7 +131,7 @@ const mrange_t *g_arch_instruction_get_range(const GArchInstruction *); /* Fournit la localisation d'une instruction. */ -void g_arch_instruction_get_location(const GArchInstruction *, off_t *, off_t *, vmpa_t *); +void g_arch_instruction_get_location(const GArchInstruction *, off_t *, off_t *, vmpa_t *) __attribute__ ((deprecated)); @@ -151,7 +151,7 @@ void g_arch_instruction_replace_operand(GArchInstruction *, GArchOperand *, cons void g_arch_instruction_detach_operand(GArchInstruction *, GArchOperand *); /* Liste les registres lus et écrits par l'instruction. */ -void g_arch_instruction_get_rw_registers(const GArchInstruction *, GArchRegister ***, size_t *, GArchRegister ***, size_t *); +void g_arch_instruction_get_rw_registers(const GArchInstruction *, GArchRegister ***, size_t *, GArchRegister ***, size_t *) __attribute__ ((deprecated)); @@ -174,17 +174,9 @@ typedef enum _InstructionLinkType } InstructionLinkType; -/* Informations complémentaires pour un lien */ -typedef union _link_extra_info -{ - GImmOperand *imm; /* Valeur d'un cas de switch() */ - GDataType *type; /* Type d'une exception */ - -} link_extra_info; - /* Etablit un lien entre deux instructions. */ -void g_arch_instruction_link_with(GArchInstruction *, GArchInstruction *, InstructionLinkType, ...); +void g_arch_instruction_link_with(GArchInstruction *, GArchInstruction *, InstructionLinkType); /* Change la nature d'un lien entre deux instructions. */ bool g_arch_instruction_change_link(GArchInstruction *, GArchInstruction *, InstructionLinkType, InstructionLinkType); @@ -217,7 +209,7 @@ void g_arch_instruction_lock_unlock_destinations(GArchInstruction *, bool, bool) bool g_arch_instruction_has_destinations(const GArchInstruction *); /* Fournit les destinations d'une instruction donnée. */ -size_t g_arch_instruction_get_destinations(const GArchInstruction *, GArchInstruction ***, InstructionLinkType **, link_extra_info **); +size_t g_arch_instruction_get_destinations(const GArchInstruction *, GArchInstruction ***, InstructionLinkType **); /* Fournit la destination d'une instruction et d'un type donné. */ GArchInstruction *g_arch_instruction_get_given_destination(const GArchInstruction *, InstructionLinkType); @@ -243,7 +235,7 @@ void g_arch_instruction_set_displayed_max_length(GArchInstruction *, phys_t); GBufferLine *g_arch_instruction_print(const GArchInstruction *, GCodeBuffer *, MemoryDataSize, const GBinContent *, AsmSyntax); /* Décompile une instruction de façon générique. */ -GDecInstruction *g_arch_instruction_decompile(const GArchInstruction *, GDecContext *); +GDecInstruction *g_arch_instruction_decompile(const GArchInstruction *, GDecContext *) __attribute__ ((deprecated)); |