summaryrefslogtreecommitdiff
path: root/plugins/arm/v7
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2020-02-29 09:40:35 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2020-02-29 09:40:35 (GMT)
commite26ba6f0429e079785bfc96e0ea55c814537e76f (patch)
tree5b109544e13d838c873f119d742cf35b0f7e0988 /plugins/arm/v7
parent526985383c4e601775b4f04b273566b8ab930a58 (diff)
Broken ARMv7 basic blocks depending on conditional flags.
Diffstat (limited to 'plugins/arm/v7')
-rw-r--r--plugins/arm/v7/link.c19
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));