summaryrefslogtreecommitdiff
path: root/src/arch/arm
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2017-03-06 18:48:16 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2017-03-06 18:48:16 (GMT)
commit12b8a066d1d8dd8cbef587dc6fafed870604f49f (patch)
tree3eb6cfbab886b430a8479fda9a721f75ae806a4d /src/arch/arm
parent0320d85e480882c58f254640a54c6c6e190dbf47 (diff)
Locked access to instruction operands when needed.
Diffstat (limited to 'src/arch/arm')
-rw-r--r--src/arch/arm/v7/fetch.c15
-rw-r--r--src/arch/arm/v7/post.c13
2 files changed, 21 insertions, 7 deletions
diff --git a/src/arch/arm/v7/fetch.c b/src/arch/arm/v7/fetch.c
index 15707e3..6675706 100644
--- a/src/arch/arm/v7/fetch.c
+++ b/src/arch/arm/v7/fetch.c
@@ -388,13 +388,16 @@ void help_fetching_with_instruction_ldr_literal_with_orig(GArchInstruction *inst
break;
}
- op = g_arch_instruction_get_operand(instr, 1);
+ g_arch_instruction_lock_operands(instr);
+
+ op = _g_arch_instruction_get_operand(instr, 1);
assert(G_IS_IMM_OPERAND(op));
ret = g_imm_operand_get_value(G_IMM_OPERAND(op), MDS_32_BITS_UNSIGNED, &offset);
if (!ret)
{
assert(0);
+ g_arch_instruction_unlock_operands(instr);
return;
}
@@ -405,6 +408,7 @@ void help_fetching_with_instruction_ldr_literal_with_orig(GArchInstruction *inst
if (!g_exe_format_translate_offset_into_vmpa(format, val_offset, &sym_addr))
{
assert(0);
+ g_arch_instruction_unlock_operands(instr);
return;
}
@@ -427,7 +431,11 @@ void help_fetching_with_instruction_ldr_literal_with_orig(GArchInstruction *inst
ret = g_binary_content_read_u32(content, &pos, SRE_LITTLE /* FIXME */, &target);
g_object_unref(G_OBJECT(content));
- if (!ret) return;
+ if (!ret)
+ {
+ g_arch_instruction_unlock_operands(instr);
+ return;
+ }
/* Réalise l'intégration du symbole associé */
@@ -480,8 +488,9 @@ void help_fetching_with_instruction_ldr_literal_with_orig(GArchInstruction *inst
new = g_imm_operand_new_from_value(MDS_32_BITS_UNSIGNED, target);
- g_arch_instruction_replace_operand(instr, new, op);
+ _g_arch_instruction_replace_operand(instr, new, op);
+ g_arch_instruction_unlock_operands(instr);
diff --git a/src/arch/arm/v7/post.c b/src/arch/arm/v7/post.c
index 5ac3c62..6c63832 100644
--- a/src/arch/arm/v7/post.c
+++ b/src/arch/arm/v7/post.c
@@ -56,11 +56,12 @@ void post_process_ldr_instructions(GArchInstruction *instr, GArchProcessor *proc
GBinRoutine *routine; /* Nouvelle routine trouvée */
GBinSymbol *symbol; /* Nouveau symbole construit */
- op = g_arch_instruction_get_operand(instr, 1);
+ g_arch_instruction_lock_operands(instr);
+ op = _g_arch_instruction_get_operand(instr, 1);
- if (!G_IS_IMM_OPERAND(op)) return;
-
+ if (!G_IS_IMM_OPERAND(op))
+ goto ppli_release;
if (g_imm_operand_get_value(G_IMM_OPERAND(op), MDS_32_BITS_UNSIGNED, &addr)
&& g_exe_format_translate_address_into_vmpa(format, addr, &target))
@@ -92,8 +93,12 @@ void post_process_ldr_instructions(GArchInstruction *instr, GArchProcessor *proc
}
- g_arch_instruction_replace_operand(instr, new, op);
+ _g_arch_instruction_replace_operand(instr, new, op);
}
+ ppli_release:
+
+ g_arch_instruction_unlock_operands(instr);
+
}