diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2017-03-06 18:48:16 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2017-03-06 18:48:16 (GMT) |
commit | 12b8a066d1d8dd8cbef587dc6fafed870604f49f (patch) | |
tree | 3eb6cfbab886b430a8479fda9a721f75ae806a4d /src/arch/link.c | |
parent | 0320d85e480882c58f254640a54c6c6e190dbf47 (diff) |
Locked access to instruction operands when needed.
Diffstat (limited to 'src/arch/link.c')
-rw-r--r-- | src/arch/link.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/arch/link.c b/src/arch/link.c index dfc2bd5..fbcd391 100644 --- a/src/arch/link.c +++ b/src/arch/link.c @@ -53,9 +53,13 @@ void handle_jump_as_link(GArchInstruction *instr, GArchProcessor *proc, GProcCon vmpa2t addr; /* Adresse de destination */ GArchInstruction *target; /* Ligne visée par la référence*/ - assert(g_arch_instruction_count_operands(instr) > 0); + g_arch_instruction_lock_operands(instr); - op = g_arch_instruction_get_operand(instr, 0); + assert(_g_arch_instruction_count_operands(instr) > 0); + + op = _g_arch_instruction_get_operand(instr, 0); + + g_arch_instruction_unlock_operands(instr); if (!G_IS_IMM_OPERAND(op)) return; @@ -102,9 +106,13 @@ void handle_branch_as_link(GArchInstruction *instr, GArchProcessor *proc, GProcC const mrange_t *range; /* Emplacement d'instruction */ vmpa2t next; /* Position suivante */ - assert(g_arch_instruction_count_operands(instr) > index); + g_arch_instruction_lock_operands(instr); + + assert(_g_arch_instruction_count_operands(instr) > index); - op = g_arch_instruction_get_operand(instr, index); + op = _g_arch_instruction_get_operand(instr, index); + + g_arch_instruction_unlock_operands(instr); defined = false; @@ -175,9 +183,13 @@ void handle_call_as_link(GArchInstruction *instr, GArchProcessor *proc, GProcCon vmpa2t addr; /* Adresse de destination */ GArchInstruction *target; /* Ligne visée par la référence*/ - assert(g_arch_instruction_count_operands(instr) > 0); + g_arch_instruction_lock_operands(instr); + + assert(_g_arch_instruction_count_operands(instr) > 0); + + op = _g_arch_instruction_get_operand(instr, 0); - op = g_arch_instruction_get_operand(instr, 0); + g_arch_instruction_unlock_operands(instr); if (!G_IS_IMM_OPERAND(op)) return; |