summaryrefslogtreecommitdiff
path: root/src/arch/arm/v7/link.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/arm/v7/link.c')
-rw-r--r--src/arch/arm/v7/link.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/arch/arm/v7/link.c b/src/arch/arm/v7/link.c
index 4443fdb..9eb625f 100644
--- a/src/arch/arm/v7/link.c
+++ b/src/arch/arm/v7/link.c
@@ -27,6 +27,7 @@
#include <assert.h>
+#include "operands/reglist.h"
#include "../register.h"
@@ -63,3 +64,45 @@ void handle_armv7_conditional_branch_from_register(GArchInstruction *instr, GArc
g_arch_instruction_set_flag(instr, AIF_RETURN_POINT); /* FIXME : jump inconnu ! */
}
+
+
+/******************************************************************************
+* *
+* Paramètres : instr = instruction ARM à traiter. *
+* proc = représentation de l'architecture utilisée. *
+* context = contexte associé à la phase de désassemblage. *
+* format = acès aux données du binaire d'origine. *
+* *
+* Description : Détecte les fins de procédures à base d'instructions 'pop'. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void handle_armv7_return_from_pop(GArchInstruction *instr, GArchProcessor *proc, GProcContext *context, GBinFormat *format)
+{
+ GArchOperand *op; /* Opérande numérique en place */
+ GArmV7RegListOperand *reglist; /* Autre version de l'instance */
+ size_t count; /* Nombre de registres présents*/
+ size_t i; /* Boucle de parcours */
+ GArmRegister *reg; /* Registre matériel manipulé */
+
+ op = g_arch_instruction_get_operand(instr, 0);
+ assert(G_IS_ARMV7_REGLIST_OPERAND(op));
+
+ reglist = G_ARMV7_REGLIST_OPERAND(op);
+
+ count = g_armv7_reglist_count_registers(reglist);
+
+ for (i = 0; i < count; i++)
+ {
+ reg = G_ARM_REGISTER(g_armv7_reglist_operand_get_register(reglist, i));
+
+ if (g_arm_register_get_index(reg) == 15 /* pc */)
+ g_arch_instruction_set_flag(instr, AIF_RETURN_POINT);
+
+ }
+
+}