summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/analysis/disass/block.c46
-rw-r--r--src/analysis/disass/block.h3
2 files changed, 49 insertions, 0 deletions
diff --git a/src/analysis/disass/block.c b/src/analysis/disass/block.c
index 8da671b..8cdbc8f 100644
--- a/src/analysis/disass/block.c
+++ b/src/analysis/disass/block.c
@@ -875,3 +875,49 @@ void g_basic_block_get_boundaries(const GBasicBlock *block, GArchInstruction **f
}
}
+
+
+/******************************************************************************
+* *
+* Paramètres : block = bloc d'instructions à consulter. *
+* proc = processeur contenant l'ensemble des instructions. *
+* *
+* Description : Fournit un itérateur d'instructions limité au bloc basique. *
+* *
+* Retour : Itérateur mis en place ou NULL en cas d'échec. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+instr_iter_t *g_basic_block_get_iterator(const GBasicBlock *block, GArchProcessor *proc)
+{
+ instr_iter_t *result; /* Itérateur à renvoyer */
+ const mrange_t *first_range; /* Emplacement d'instruction #1*/
+ const vmpa2t *first_addr; /* Point de départ associé */
+ const mrange_t *last_range; /* Emplacement d'instruction #2*/
+ phys_t length; /* Taille de la couverture */
+ mrange_t range; /* Couverture du bloc */
+
+ first_range = g_arch_instruction_get_range(block->first);
+
+ first_addr = get_mrange_addr(first_range);
+
+ result = g_arch_processor_get_iter_from_address(proc, first_addr);
+
+ if (result != NULL)
+ {
+ last_range = g_arch_instruction_get_range(block->last);
+
+ length = compute_vmpa_diff(first_addr, get_mrange_addr(last_range));
+ length += get_mrange_length(last_range);
+
+ init_mrange(&range, first_addr, length);
+
+ restrict_instruction_iterator(result, &range);
+
+ }
+
+ return result;
+
+}
diff --git a/src/analysis/disass/block.h b/src/analysis/disass/block.h
index a7c157d..f622b61 100644
--- a/src/analysis/disass/block.h
+++ b/src/analysis/disass/block.h
@@ -62,6 +62,9 @@ GCodeBlock *g_basic_block_new(GLoadedBinary *, GArchInstruction *, GArchInstruct
/* Fournit les instructions limites d'un bloc basique. */
void g_basic_block_get_boundaries(const GBasicBlock *, GArchInstruction **, GArchInstruction **);
+/* Fournit un itérateur d'instructions limité au bloc basique. */
+instr_iter_t *g_basic_block_get_iterator(const GBasicBlock *, GArchProcessor *);
+
#endif /* _ANALYSIS_DISASS_BLOCK_H */