summaryrefslogtreecommitdiff
path: root/src/analysis/blocks/flow.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2015-03-21 15:06:14 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2015-03-21 15:06:14 (GMT)
commit276ec9c9b8a3b283751c8d8c59f70c3fc88d5b0d (patch)
treedffaebf2ce377dd93a20e62ded16fb70dfd804ff /src/analysis/blocks/flow.c
parent10ce277a45469fa194e0d5fa2f0ca531f1830191 (diff)
Restored a limited but working version of basic blocks definitions.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@493 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/analysis/blocks/flow.c')
-rw-r--r--src/analysis/blocks/flow.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/src/analysis/blocks/flow.c b/src/analysis/blocks/flow.c
index cd435aa..7777623 100644
--- a/src/analysis/blocks/flow.c
+++ b/src/analysis/blocks/flow.c
@@ -70,7 +70,7 @@ static void g_flow_block_dispose(GFlowBlock *);
static void g_flow_block_finalize(GFlowBlock *);
/* Recherche le bloc contenant une adresse donnée. */
-static GInstrBlock *g_flow_block_find_by_addr(const GFlowBlock *, vmpa_t, bool);
+static GInstrBlock *g_flow_block_find_by_addr(const GFlowBlock *, const vmpa2t *, bool);
/* Parcourt le bloc d'instructions dans un ordre donné. */
static bool g_flow_block_visit(GFlowBlock *, instr_block_visitor_cb, void *);
@@ -225,7 +225,7 @@ GInstrBlock *g_flow_block_new(GArchInstruction *instrs, GArchInstruction *first,
g_object_ref(G_OBJECT(result->first));
g_object_ref(G_OBJECT(result->last));
- g_flow_block_compute_regs_access(result);
+ //g_flow_block_compute_regs_access(result);
return G_INSTR_BLOCK(result);
@@ -325,15 +325,18 @@ void g_flow_block_set_next_rank(GFlowBlock *block, unsigned int rank)
* *
******************************************************************************/
-static GInstrBlock *g_flow_block_find_by_addr(const GFlowBlock *block, vmpa_t addr, bool final)
+static GInstrBlock *g_flow_block_find_by_addr(const GFlowBlock *block, const vmpa2t *addr, bool final)
{
GInstrBlock *result; /* Resultat à retourner */
- vmpa_t start; /* Adresse de début du bloc */
- vmpa_t end; /* Adresse de fin du bloc */
+ vmpa2t start; /* Adresse de début du bloc */
+ vmpa2t end; /* Adresse de fin du bloc */
+ mrange_t range; /* Couverture globale */
g_flow_block_get_boundary_addresses(block, &start, &end);
- if (start <= addr && addr <= end)
+ init_mrange(&range, &start, compute_vmpa_diff(&start, &end));
+
+ if (mrange_contains_addr(&range, addr))
result = G_INSTR_BLOCK(block);
else
@@ -566,13 +569,21 @@ void g_flow_block_get_boundary(const GFlowBlock *block, GArchInstruction **first
* *
******************************************************************************/
-void g_flow_block_get_boundary_addresses(const GFlowBlock *block, vmpa_t *start, vmpa_t *end)
+void g_flow_block_get_boundary_addresses(const GFlowBlock *block, vmpa2t *start, vmpa2t *end)
{
+ const mrange_t *range; /* Couverture d'instruction */
+
if (start != NULL)
- g_arch_instruction_get_location(block->first, NULL, NULL, start);
+ {
+ range = g_arch_instruction_get_range(block->first);
+ copy_vmpa(start, get_mrange_addr(range));
+ }
if (end != NULL)
- g_arch_instruction_get_location(block->last, NULL, NULL, end);
+ {
+ range = g_arch_instruction_get_range(block->last);
+ copy_vmpa(end, get_mrange_addr(range));
+ }
}