summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2017-03-15 18:16:07 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2017-03-15 18:16:07 (GMT)
commit4d15e46e5b401b3237eec380e9c80735b1f24db3 (patch)
tree6ce7882de933a51edf921092f53cc17734e37eba
parentf2f54bba0c4db6f5fff3746b40be174617ce693f (diff)
Referenced all provided registers from operands.
-rw-r--r--ChangeLog9
-rw-r--r--src/arch/arm/v7/fetch.c16
-rw-r--r--src/arch/arm/v7/link.c2
-rw-r--r--src/arch/register.c2
4 files changed, 25 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index e9fa1ab..d4f605c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+17-03-15 Cyrille Bagard <nocbos@gmail.com>
+
+ * src/arch/arm/v7/fetch.c:
+ * src/arch/arm/v7/link.c:
+ Update code.
+
+ * src/arch/register.c:
+ Reference all provided registers from operands.
+
17-03-11 Cyrille Bagard <nocbos@gmail.com>
* src/analysis/disass/area.c:
diff --git a/src/arch/arm/v7/fetch.c b/src/arch/arm/v7/fetch.c
index 6675706..84319cc 100644
--- a/src/arch/arm/v7/fetch.c
+++ b/src/arch/arm/v7/fetch.c
@@ -237,20 +237,24 @@ void help_fetching_with_instruction_bx_with_orig(GArchInstruction *instr, GArchP
{
GArchOperand *op; /* Opérande numérique en place */
GArmRegister *reg; /* Registre matériel manipulé */
+ bool is_pc; /* Nature de ce même registre */
const mrange_t *range; /* Emplacementt d'instruction */
virt_t pc; /* Position dans l'exécution */
op = g_arch_instruction_get_operand(instr, 0);
assert(G_IS_REGISTER_OPERAND(op));
- reg = G_ARM_REGISTER(g_register_operand_get_register(G_REGISTER_OPERAND(op)));
-
/**
* On ne sait agir qu'avec le seul contenu facilement prédictible : pc !
*/
- if (g_arm_register_get_index(reg) != 15 /* pc */)
- return;
+ reg = G_ARM_REGISTER(g_register_operand_get_register(G_REGISTER_OPERAND(op)));
+
+ is_pc = (g_arm_register_get_index(reg) == 15 /* pc */);
+
+ g_object_unref(G_OBJECT(reg));
+
+ if (!is_pc) goto hfwibwo_no_pc;
/**
* On bascule alors le mode de décodage à cette adresse...
@@ -277,6 +281,10 @@ void help_fetching_with_instruction_bx_with_orig(GArchInstruction *instr, GArchP
break;
}
+ hfwibwo_no_pc:
+
+ ;
+
}
diff --git a/src/arch/arm/v7/link.c b/src/arch/arm/v7/link.c
index 24b56c6..63fb3ae 100644
--- a/src/arch/arm/v7/link.c
+++ b/src/arch/arm/v7/link.c
@@ -63,6 +63,8 @@ void handle_armv7_conditional_branch_from_register(GArchInstruction *instr, GArc
else
g_arch_instruction_set_flag(instr, AIF_RETURN_POINT); /* FIXME : jump inconnu ! */
+ g_object_unref(G_OBJECT(reg));
+
}
diff --git a/src/arch/register.c b/src/arch/register.c
index 6e18b45..519ecdd 100644
--- a/src/arch/register.c
+++ b/src/arch/register.c
@@ -555,6 +555,8 @@ GArchOperand *g_register_operand_new(GArchRegister *reg)
GArchRegister *g_register_operand_get_register(const GRegisterOperand *operand)
{
+ g_object_ref(G_OBJECT(operand->reg));
+
return operand->reg;
}