summaryrefslogtreecommitdiff
path: root/plugins/arm
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/arm')
-rw-r--r--plugins/arm/v7/fetch.c4
-rw-r--r--plugins/arm/v7/link.c2
-rw-r--r--plugins/arm/v7/operands/register.c23
-rw-r--r--plugins/arm/v7/operands/register.h3
-rw-r--r--plugins/arm/v7/operands/reglist.c8
5 files changed, 12 insertions, 28 deletions
diff --git a/plugins/arm/v7/fetch.c b/plugins/arm/v7/fetch.c
index bf60d9c..09278c9 100644
--- a/plugins/arm/v7/fetch.c
+++ b/plugins/arm/v7/fetch.c
@@ -606,7 +606,7 @@ void apply_write_back_from_registers(GArchInstruction *instr, GArchProcessor *pr
regop = G_ARMV7_REGISTER_OPERAND(op);
- reg_ref = G_ARCH_REGISTER(g_armv7_register_operand_get(regop));
+ reg_ref = g_register_operand_get_register(G_REGISTER_OPERAND(regop));
op = _g_arch_instruction_get_operand(instr, 1);
assert(G_IS_ARMV7_REGLIST_OPERAND(op));
@@ -623,6 +623,8 @@ void apply_write_back_from_registers(GArchInstruction *instr, GArchProcessor *pr
inside = (g_arch_register_compare(reg_ref, G_ARCH_REGISTER(reg)) == 0);
+ g_object_unref(G_OBJECT(reg));
+
}
if (!inside)
diff --git a/plugins/arm/v7/link.c b/plugins/arm/v7/link.c
index 441fa50..67f4226 100644
--- a/plugins/arm/v7/link.c
+++ b/plugins/arm/v7/link.c
@@ -107,6 +107,8 @@ void handle_armv7_return_from_pop(GArchInstruction *instr, GArchProcessor *proc,
if (g_arm_register_get_index(reg) == 15 /* pc */)
g_arch_instruction_set_flag(instr, AIF_RETURN_POINT);
+ g_object_unref(G_OBJECT(reg));
+
}
g_object_unref(G_OBJECT(op));
diff --git a/plugins/arm/v7/operands/register.c b/plugins/arm/v7/operands/register.c
index 412d0f9..e6b3751 100644
--- a/plugins/arm/v7/operands/register.c
+++ b/plugins/arm/v7/operands/register.c
@@ -226,29 +226,6 @@ GArchOperand *g_armv7_register_operand_new(GArmV7Register *reg)
/******************************************************************************
* *
* Paramètres : operand = opérande représentant un registre. *
-* *
-* Description : Fournit le registre ARMv7 associé à l'opérande. *
-* *
-* Retour : Représentation interne du registre. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-const GArmV7Register *g_armv7_register_operand_get(const GArmV7RegisterOperand *operand)
-{
- GArmV7Register *result; /* Instance à retourner */
-
- result = G_ARMV7_REGISTER(G_REGISTER_OPERAND(operand)->reg);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : operand = opérande représentant un registre. *
* wback = indique si le registre est mis à jour après coup. *
* *
* Description : Détermine si le registre est mis à jour après l'opération. *
diff --git a/plugins/arm/v7/operands/register.h b/plugins/arm/v7/operands/register.h
index 2bd13c6..4a9c0c3 100644
--- a/plugins/arm/v7/operands/register.h
+++ b/plugins/arm/v7/operands/register.h
@@ -57,9 +57,6 @@ GType g_armv7_register_operand_get_type(void);
/* Crée un opérande visant un registre ARMv7. */
GArchOperand *g_armv7_register_operand_new(GArmV7Register *);
-/* Fournit le registre ARMv7 associé à l'opérande. */
-const GArmV7Register *g_armv7_register_operand_get(const GArmV7RegisterOperand *);
-
/* Détermine si le registre est mis à jour après l'opération. */
void g_armv7_register_operand_write_back(GArmV7RegisterOperand *, bool);
diff --git a/plugins/arm/v7/operands/reglist.c b/plugins/arm/v7/operands/reglist.c
index 005aff7..33a3fcd 100644
--- a/plugins/arm/v7/operands/reglist.c
+++ b/plugins/arm/v7/operands/reglist.c
@@ -364,9 +364,15 @@ size_t g_armv7_reglist_count_registers(const GArmV7RegListOperand *operand)
GArmV7Register *g_armv7_reglist_operand_get_register(const GArmV7RegListOperand *operand, size_t index)
{
+ GArmV7Register *result; /* Instance à retourner */
+
assert(index < operand->count);
- return operand->registers[index];
+ result = operand->registers[index];
+
+ g_object_ref(G_OBJECT(result));
+
+ return result;
}