summaryrefslogtreecommitdiff
path: root/src/analysis/disass
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/analysis/disass
parent0320d85e480882c58f254640a54c6c6e190dbf47 (diff)
Locked access to instruction operands when needed.
Diffstat (limited to 'src/analysis/disass')
-rw-r--r--src/analysis/disass/links.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/analysis/disass/links.c b/src/analysis/disass/links.c
index 0884dce..abe26d6 100644
--- a/src/analysis/disass/links.c
+++ b/src/analysis/disass/links.c
@@ -185,12 +185,15 @@ static void convert_immediate_into_target(GArchInstruction *instr, size_t index,
vmpa2t target; /* Défination finale précise */
GArchOperand *new; /* Instruction de ciblage */
- op = g_arch_instruction_get_operand(instr, index);
- if (!G_IS_IMM_OPERAND(op)) return;
+ op = _g_arch_instruction_get_operand(instr, index);
+
+ if (!G_IS_IMM_OPERAND(op))
+ goto ciit_done;
imm = G_IMM_OPERAND(op);
- if (g_imm_operand_get_display(imm) != IOD_HEX) return;
+ if (g_imm_operand_get_display(imm) != IOD_HEX)
+ goto ciit_done;
if (g_imm_operand_to_virt_t(imm, &addr))
{
@@ -203,12 +206,16 @@ static void convert_immediate_into_target(GArchInstruction *instr, size_t index,
if (!g_target_operand_resolve(G_TARGET_OPERAND(new), format, false))
g_object_unref(G_OBJECT(new));
else
- g_arch_instruction_replace_operand(instr, new, op);
+ _g_arch_instruction_replace_operand(instr, new, op);
}
}
+ ciit_done:
+
+ ;
+
}
@@ -240,14 +247,16 @@ void establish_links_for_instruction(GArchInstruction *instr, GBinFormat *format
else
skip = false;
- count = g_arch_instruction_count_operands(instr);
+ g_arch_instruction_lock_operands(instr);
+
+ count = _g_arch_instruction_count_operands(instr);
for (i = 0; i < count; i++)
{
if (!skip)
convert_immediate_into_target(instr, i, format);
- op = g_arch_instruction_get_operand(instr, i);
+ op = _g_arch_instruction_get_operand(instr, i);
if (!G_IS_TARGET_OPERAND(op)) continue;
g_target_operand_get_addr(G_TARGET_OPERAND(op), &addr);
@@ -262,4 +271,6 @@ void establish_links_for_instruction(GArchInstruction *instr, GBinFormat *format
}
+ g_arch_instruction_unlock_operands(instr);
+
}