summaryrefslogtreecommitdiff
path: root/src/analysis/blocks/flow.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis/blocks/flow.c')
-rw-r--r--src/analysis/blocks/flow.c57
1 files changed, 53 insertions, 4 deletions
diff --git a/src/analysis/blocks/flow.c b/src/analysis/blocks/flow.c
index 2bdd0cf..f80b7c8 100644
--- a/src/analysis/blocks/flow.c
+++ b/src/analysis/blocks/flow.c
@@ -71,6 +71,9 @@ static void g_flow_block_memorize_access(GFlowBlock *, GArchRegister *, RegAcces
/* Note les différents accès aux registres. */
static void g_flow_block_compute_regs_access(GFlowBlock *);
+/* Etablit la liste de tous les blocs présents. */
+static void g_flow_block_list_all_blocks(const GFlowBlock *, GInstrBlock ***, size_t *);
+
/* Fournit les différents accès aux registres. */
static const reg_access *g_flow_block_list_regs_accesses(const GFlowBlock *, size_t *);
@@ -122,6 +125,7 @@ static void g_flow_block_init(GFlowBlock *block)
parent = G_INSTR_BLOCK(block);
+ parent->list_blocks = (list_all_blocks_fc)g_flow_block_list_all_blocks;
parent->list_regs = (list_regs_accesses_fc)g_flow_block_list_regs_accesses;
}
@@ -201,13 +205,13 @@ GInstrBlock *g_flow_block_new(GArchInstruction *instrs, GArchInstruction *first,
result = g_object_new(G_TYPE_FLOW_BLOCK, NULL);
-
+ /*
g_arch_instruction_get_location(first, NULL, NULL, &addr);
- //printf(" ! new block @ 0x%llx - ", addr);
+ printf(" ! new block @ 0x%llx - ", addr);
g_arch_instruction_get_location(last, NULL, NULL, &addr);
- //printf("0x%llx\n", addr);
-
+ printf("0x%llx\n", addr);
+ */
@@ -228,6 +232,29 @@ GInstrBlock *g_flow_block_new(GArchInstruction *instrs, GArchInstruction *first,
/******************************************************************************
* *
+* Paramètres : block = bloc d'instructions à consulter. *
+* list = ensemble de blocs à compléter. [OUT] *
+* count = nombre de blocs au total. [OUT] *
+* *
+* Description : Etablit la liste de tous les blocs présents. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_flow_block_list_all_blocks(const GFlowBlock *block, GInstrBlock ***list, size_t *count)
+{
+ (*list) = (GInstrBlock **)realloc(*list, ++(*count) * sizeof(GInstrBlock *));
+
+ (*list)[*count - 1] = G_INSTR_BLOCK(block);
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : block = bloc d'instructions à mettre à jour. *
* reg = registre visé par l'opération. *
* type = type d'accès à l'opérande. *
@@ -362,3 +389,25 @@ static const reg_access *g_flow_block_list_regs_accesses(const GFlowBlock *block
return block->accesses;
}
+
+
+/******************************************************************************
+* *
+* Paramètres : block = bloc d'instructions à consulter. *
+* start = adresse de départ du bloc. [OUT] *
+* end = dernière adresse du bloc. [OUT] *
+* *
+* Description : Fournit les adresses limites d'un bloc d'exécution. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void g_flow_block_get_boundary_addresses(const GFlowBlock *block, vmpa_t *start, vmpa_t *end)
+{
+ g_arch_instruction_get_location(block->first, NULL, NULL, start);
+ g_arch_instruction_get_location(block->last, NULL, NULL, end);
+
+}