summaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-05-30 10:49:12 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-05-30 10:49:12 (GMT)
commitb66cda8ef8be6d9929683ab5a1b22bdfe4b22849 (patch)
tree6bae6ab5b1d41da87131f6d6a030a224ba29f542 /src/arch
parentb9811a151ebeca6b64cdfc0a07df697ecfe84d7e (diff)
Determined if an iterator is at its ending position.
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/instriter.c56
-rw-r--r--src/arch/instriter.h3
2 files changed, 59 insertions, 0 deletions
diff --git a/src/arch/instriter.c b/src/arch/instriter.c
index a603383..3319fb7 100644
--- a/src/arch/instriter.c
+++ b/src/arch/instriter.c
@@ -332,3 +332,59 @@ GArchInstruction *get_instruction_iterator_next(instr_iter_t *iter)
return result;
}
+
+
+/******************************************************************************
+* *
+* Paramètres : iter = itérateur à consulter. *
+* *
+* Description : Détermine s'il reste une instruction dans l'itération. *
+* *
+* Retour : Bilan de la consultation. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool has_instruction_iterator_next(const instr_iter_t *iter)
+{
+ bool result; /* Bilan à retourner */
+ GArchInstruction *instr; /* Prochaine instruction */
+ const mrange_t *irange; /* Emplacement d'instruction */
+
+ g_arch_processor_lock(iter->proc);
+
+ if (iter->stamp != g_arch_processor_get_stamp(iter->proc))
+ result = false;
+
+ else
+ {
+ if ((iter->index + 1) < g_arch_processor_count_instructions(iter->proc))
+ {
+ instr = g_arch_processor_get_instruction(iter->proc, iter->index + 1);
+
+ /* L'instruction sort-elle des clous ? */
+ if (iter->is_restricted)
+ {
+ irange = g_arch_instruction_get_range(instr);
+
+ result = mrange_contains_mrange(&iter->restriction, irange);
+
+ }
+
+ else
+ result = true;
+
+ g_object_unref(G_OBJECT(instr));
+
+ }
+ else
+ result = false;
+ }
+
+ g_arch_processor_unlock(iter->proc);
+
+ return result;
+
+
+}
diff --git a/src/arch/instriter.h b/src/arch/instriter.h
index 68db9cb..9a58005 100644
--- a/src/arch/instriter.h
+++ b/src/arch/instriter.h
@@ -57,6 +57,9 @@ GArchInstruction *get_instruction_iterator_prev(instr_iter_t *);
/* Fournit l'instruction qui en suit une autre. */
GArchInstruction *get_instruction_iterator_next(instr_iter_t *);
+/* Détermine s'il reste une instruction dans l'itération. */
+bool has_instruction_iterator_next(const instr_iter_t *);
+
#endif /* _ARCH_INSTRITER_H */