diff options
Diffstat (limited to 'plugins/arm')
-rw-r--r-- | plugins/arm/v7/link.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/plugins/arm/v7/link.c b/plugins/arm/v7/link.c index 263bb49..30b91f9 100644 --- a/plugins/arm/v7/link.c +++ b/plugins/arm/v7/link.c @@ -29,6 +29,7 @@ #include "operands/reglist.h" +#include "../instruction.h" #include "../register.h" @@ -50,16 +51,22 @@ void handle_armv7_conditional_branch_from_register(GArchInstruction *instr, GArchProcessor *proc, GProcContext *context, GExeFormat *format) { + ArmCondCode cond; /* Condition d'exécution */ + ArchInstrFlag flag; /* Fanion particulier appliqué */ GArchOperand *op; /* Opérande numérique en place */ GArmRegister *reg; /* Registre matériel manipulé */ + cond = g_arm_instruction_get_cond(G_ARM_INSTRUCTION(instr)); + + flag = (cond == ACC_AL ? AIF_RETURN_POINT : AIF_COND_RETURN_POINT); + 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))); if (g_arm_register_get_index(reg) == 14 /* lr */) - g_arch_instruction_set_flag(instr, AIF_RETURN_POINT); + g_arch_instruction_set_flag(instr, flag); else { @@ -70,7 +77,7 @@ void handle_armv7_conditional_branch_from_register(GArchInstruction *instr, GArc * vers l'instruction suivante, donc on marque le branchement comme * étant un point de retour. */ - g_arch_instruction_set_flag(instr, AIF_RETURN_POINT); + g_arch_instruction_set_flag(instr, flag); } @@ -98,12 +105,18 @@ void handle_armv7_conditional_branch_from_register(GArchInstruction *instr, GArc void handle_armv7_return_from_pop(GArchInstruction *instr, GArchProcessor *proc, GProcContext *context, GExeFormat *format) { + ArmCondCode cond; /* Condition d'exécution */ + ArchInstrFlag flag; /* Fanion particulier appliqué */ 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é */ + cond = g_arm_instruction_get_cond(G_ARM_INSTRUCTION(instr)); + + flag = (cond == ACC_AL ? AIF_RETURN_POINT : AIF_COND_RETURN_POINT); + op = g_arch_instruction_get_operand(instr, 0); assert(G_IS_ARMV7_REGLIST_OPERAND(op)); @@ -116,7 +129,7 @@ void handle_armv7_return_from_pop(GArchInstruction *instr, GArchProcessor *proc, 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); + g_arch_instruction_set_flag(instr, flag); g_object_unref(G_OBJECT(reg)); |