summaryrefslogtreecommitdiff
path: root/src/arch/instruction.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/instruction.h')
-rw-r--r--src/arch/instruction.h58
1 files changed, 51 insertions, 7 deletions
diff --git a/src/arch/instruction.h b/src/arch/instruction.h
index 6388f94..fad6c72 100644
--- a/src/arch/instruction.h
+++ b/src/arch/instruction.h
@@ -123,23 +123,67 @@ void g_arch_instruction_get_location(const GArchInstruction *, off_t *, off_t *,
+/* Liste les registres lus et écrits par l'instruction. */
+void g_arch_instruction_get_rw_registers(const GArchInstruction *, GArchRegister ***, size_t *, GArchRegister ***, size_t *) __attribute__ ((deprecated));
+
+
+
+/* --------------------------- MANIPULATION DES OPERANDES --------------------------- */
+
+
+/* Verrouille les accès la liste des opérandes. */
+void g_arch_instruction_lock_operands(GArchInstruction *);
+
+/* Déverrouille les accès la liste des opérandes. */
+void g_arch_instruction_unlock_operands(GArchInstruction *);
+
/* Attache un opérande supplémentaire à une instruction. */
void g_arch_instruction_attach_extra_operand(GArchInstruction *, GArchOperand *);
/* Indique la quantité d'opérandes présents dans l'instruction. */
-size_t g_arch_instruction_count_operands(const GArchInstruction *);
+size_t _g_arch_instruction_count_operands(const GArchInstruction *);
/* Fournit un opérande donné d'une instruction. */
-GArchOperand *g_arch_instruction_get_operand(const GArchInstruction *, size_t);
+GArchOperand *_g_arch_instruction_get_operand(const GArchInstruction *, size_t);
/* Remplace un opérande d'une instruction par un autre. */
-void g_arch_instruction_replace_operand(GArchInstruction *, GArchOperand *, const GArchOperand *);
+void _g_arch_instruction_replace_operand(GArchInstruction *, GArchOperand *, const GArchOperand *);
/* Détache un opérande liée d'une instruction. */
-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 *) __attribute__ ((deprecated));
+void _g_arch_instruction_detach_operand(GArchInstruction *, GArchOperand *);
+
+
+#define g_arch_instruction_count_operands(ins) \
+ ({ \
+ size_t __result; \
+ g_arch_instruction_lock_operands(ins); \
+ __result = _g_arch_instruction_count_operands(ins); \
+ g_arch_instruction_unlock_operands(ins); \
+ __result; \
+ })
+
+#define g_arch_instruction_get_operand(ins, idx) \
+ ({ \
+ GArchOperand *__result; \
+ g_arch_instruction_lock_operands(ins); \
+ __result = _g_arch_instruction_get_operand(ins, idx); \
+ g_arch_instruction_unlock_operands(ins); \
+ __result; \
+ })
+
+#define g_arch_instruction_replace_operand(ins, n, o) \
+ ({ \
+ g_arch_instruction_lock_operands(ins); \
+ _g_arch_instruction_replace_operand(ins, n, o); \
+ g_arch_instruction_unlock_operands(ins); \
+ })
+
+#define g_arch_instruction_detach_operand(ins, o) \
+ ({ \
+ g_arch_instruction_lock_operands(ins); \
+ _g_arch_instruction_detach_operand(ins, o); \
+ g_arch_instruction_unlock_operands(ins); \
+ })