diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2020-02-02 20:38:58 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2020-02-02 20:38:58 (GMT) |
commit | 296b4ed15fd074f80266e1d22ef4ade7ee11905e (patch) | |
tree | 9ec0dc238f42c5f3b7f12e96dd1c631685c539b3 /src/arch/instruction.c | |
parent | 62f178cc3dcc889d56ba6d94f6fc8bba7b503c1a (diff) |
Relied on flags for raw instructions.
Diffstat (limited to 'src/arch/instruction.c')
-rw-r--r-- | src/arch/instruction.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/arch/instruction.c b/src/arch/instruction.c index d3ac97e..1090138 100644 --- a/src/arch/instruction.c +++ b/src/arch/instruction.c @@ -283,6 +283,8 @@ bool g_arch_instruction_set_flag(GArchInstruction *instr, ArchInstrFlag flag) bool result; /* Bilan à retourner */ instr_obj_extra *extra; /* Données insérées à modifier */ + assert(flag <= AIF_HIGH_USER); + extra = GET_ARCH_INSTR_EXTRA(instr); g_bit_lock(&extra->lock, INSTR_EXTRA_LOCK_BIT); @@ -300,6 +302,41 @@ bool g_arch_instruction_set_flag(GArchInstruction *instr, ArchInstrFlag flag) /****************************************************************************** * * +* Paramètres : instr = instruction quelconque à modifier. * +* flag = drapeau d'information complémentaire à planter. * +* * +* Description : Retire une information complémentaire à une instruction. * +* * +* Retour : Bilan de l'opération. * +* * +* Remarques : - * +* * +******************************************************************************/ + +bool g_arch_instruction_unset_flag(GArchInstruction *instr, ArchInstrFlag flag) +{ + bool result; /* Bilan à retourner */ + instr_obj_extra *extra; /* Données insérées à modifier */ + + assert(flag <= AIF_HIGH_USER); + + extra = GET_ARCH_INSTR_EXTRA(instr); + + g_bit_lock(&extra->lock, INSTR_EXTRA_LOCK_BIT); + + extra->flags &= ~flag; + + result = true; + + g_bit_unlock(&extra->lock, INSTR_EXTRA_LOCK_BIT); + + return result; + +} + + +/****************************************************************************** +* * * Paramètres : instr = instruction quelconque à consulter. * * flag = drapeau d'information à rechercher. * * * @@ -316,6 +353,8 @@ bool g_arch_instruction_has_flag(const GArchInstruction *instr, ArchInstrFlag fl bool result; /* Bilan à retourner */ instr_obj_extra *extra; /* Données insérées à consulter*/ + assert(flag <= AIF_HIGH_USER); + extra = GET_ARCH_INSTR_EXTRA(instr); g_bit_lock(&extra->lock, INSTR_EXTRA_LOCK_BIT); |