From ba1d7ae3ae3c82ab2c3d23a900c16baff6f8ca26 Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Sun, 12 Jul 2015 01:57:23 +0000 Subject: Defined AIF_RETURN_POINT to replace the previous 'return' accessors. git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@546 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a --- ChangeLog | 35 +++++++++++++++++++++++++++ plugins/androhelpers/switch.c | 2 +- plugins/libcsem/exit.c | 2 +- plugins/ropgadgets/finder.c | 4 +-- src/analysis/disass/area.c | 4 +-- src/analysis/disass/links.c | 2 +- src/analysis/disass/loop.c | 2 +- src/analysis/disass/macro.c | 6 ++--- src/arch/arm/v7/opdefs/Makefile.am | 1 - src/arch/arm/v7/opdefs/b_A8818.d | 10 ++++---- src/arch/arm/v7/opdefs/bl_A8825.d | 8 +++--- src/arch/arm/v7/opdefs/blx_A8826.d | 4 +-- src/arch/arm/v7/opdefs/bx_A8827.d | 4 +-- src/arch/arm/v7/opdefs/ldr_A8862.d | 6 ++--- src/arch/arm/v7/opdefs/ldr_A8863.d | 4 +-- src/arch/arm/v7/opdefs/ldr_A8864.d | 4 +-- src/arch/arm/v7/opdefs/ldr_A8865.d | 2 +- src/arch/arm/v7/opdefs/ldrb_A8867.d | 6 ++--- src/arch/arm/v7/opdefs/ldrb_A8868.d | 4 +-- src/arch/arm/v7/opdefs/ldrb_A8870.d | 6 ++--- src/arch/arm/v7/opdefs/pop_A88131.d | 6 ++--- src/arch/arm/v7/opdefs/pop_A88132.d | 4 +-- src/arch/arm/v7/opdefs/str_A88204.d | 4 +-- src/arch/arm/v7/opdefs/strb_A88207.d | 4 +-- src/arch/arm/v7/opdefs/strb_A88208.d | 6 ++--- src/arch/instruction.c | 47 +++--------------------------------- src/arch/instruction.h | 11 +++------ src/gtkext/gtkgraphview.c | 2 +- 28 files changed, 95 insertions(+), 105 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4e31145..0534fa0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,38 @@ +15-07-12 Cyrille Bagard + + * plugins/androhelpers/switch.c: + * plugins/libcsem/exit.c: + * plugins/ropgadgets/finder.c: + * src/analysis/disass/area.c: + * src/analysis/disass/links.c: + * src/analysis/disass/loop.c: + * src/analysis/disass/macro.c: + * src/arch/arm/v7/opdefs/b_A8818.d: + * src/arch/arm/v7/opdefs/bl_A8825.d: + * src/arch/arm/v7/opdefs/blx_A8826.d: + * src/arch/arm/v7/opdefs/bx_A8827.d: + * src/arch/arm/v7/opdefs/ldr_A8862.d: + * src/arch/arm/v7/opdefs/ldr_A8863.d: + * src/arch/arm/v7/opdefs/ldr_A8864.d: + * src/arch/arm/v7/opdefs/ldr_A8865.d: + * src/arch/arm/v7/opdefs/ldrb_A8867.d: + * src/arch/arm/v7/opdefs/ldrb_A8868.d: + * src/arch/arm/v7/opdefs/ldrb_A8870.d: + * src/arch/arm/v7/opdefs/Makefile.am: + * src/arch/arm/v7/opdefs/pop_A88131.d: + * src/arch/arm/v7/opdefs/pop_A88132.d: + * src/arch/arm/v7/opdefs/str_A88204.d: + * src/arch/arm/v7/opdefs/strb_A88207.d: + * src/arch/arm/v7/opdefs/strb_A88208.d: + Update code. + + * src/arch/instruction.c: + * src/arch/instruction.h: + Define AIF_RETURN_POINT to replace the previous 'return' accessors. + + * src/gtkext/gtkgraphview.c: + Update code. + 15-07-10 Cyrille Bagard * pixmaps/chrysalide.xcf: diff --git a/plugins/androhelpers/switch.c b/plugins/androhelpers/switch.c index 14a4562..f93c9e9 100644 --- a/plugins/androhelpers/switch.c +++ b/plugins/androhelpers/switch.c @@ -219,7 +219,7 @@ static void ensure_each_case_has_its_block(GArchInstruction *instr, GArchInstruc if (prev != NULL && !g_arch_instruction_has_destinations(prev) - && !g_arch_instruction_is_return(prev)) + && !(g_arch_instruction_get_flags(prev) & AIF_RETURN_POINT)) { g_arch_instruction_link_with(prev, instr, ILT_EXEC_FLOW, NULL); } diff --git a/plugins/libcsem/exit.c b/plugins/libcsem/exit.c index fbe0923..1bb4edd 100644 --- a/plugins/libcsem/exit.c +++ b/plugins/libcsem/exit.c @@ -74,7 +74,7 @@ static void mark_one_kind_of_exit_as_return(const GLoadedBinary *binary, const c { if (types[i] != ILT_CALL) continue; - g_arch_instruction_define_as_return(sources[i], true); + g_arch_instruction_set_flag(sources[i], AIF_RETURN_POINT); } diff --git a/plugins/ropgadgets/finder.c b/plugins/ropgadgets/finder.c index ff0c6ad..a71dfb3 100644 --- a/plugins/ropgadgets/finder.c +++ b/plugins/ropgadgets/finder.c @@ -166,7 +166,7 @@ static GArchInstruction *look_backward_for_gadgets(const search_domain *domain, /* S'il s'agit d'un point de retour, on laisse la main à une autre liste */ - if (g_arch_instruction_is_return(instr)) + if (g_arch_instruction_get_flags(instr) & AIF_RETURN_POINT) { g_object_unref(G_OBJECT(instr)); instr = NULL; @@ -258,7 +258,7 @@ static GArchInstruction **list_all_gadgets_in_domain(const search_domain *domain /* A-t-on bien affaire à une instruction de retour ? */ - if (!g_arch_instruction_is_return(gadget)) + if (!(g_arch_instruction_get_flags(gadget) & AIF_RETURN_POINT)) { g_object_unref(G_OBJECT(gadget)); continue; diff --git a/src/analysis/disass/area.c b/src/analysis/disass/area.c index a0ad90e..94d659b 100644 --- a/src/analysis/disass/area.c +++ b/src/analysis/disass/area.c @@ -617,13 +617,13 @@ bool load_code_from_mem_area(mem_area **list, size_t *count, size_t *index, cons assert(!is_range_blank_in_mem_areas(*list, *count, &range)); - if (g_arch_instruction_is_return(instr)) + if (g_arch_instruction_get_flags(instr) & AIF_RETURN_POINT) printf("BREAK @ 0x%08x\n", (unsigned int)get_virt_addr(&prev)); //continue; /* Rupture du flot d'exécution ? */ - if (g_arch_instruction_is_return(instr)) + if (g_arch_instruction_get_flags(instr) & AIF_RETURN_POINT) break; } diff --git a/src/analysis/disass/links.c b/src/analysis/disass/links.c index 545afb1..43b7e6f 100644 --- a/src/analysis/disass/links.c +++ b/src/analysis/disass/links.c @@ -156,7 +156,7 @@ static void establish_natural_link(GArchInstruction *instr, GArchInstruction *pr * avec le voisin. */ - if (g_arch_instruction_is_return(prev)) + if (g_arch_instruction_get_flags(prev) & AIF_RETURN_POINT) return; if (g_arch_instruction_get_flags(instr) & AIF_ROUTINE_START) diff --git a/src/analysis/disass/loop.c b/src/analysis/disass/loop.c index 9a99bc4..88b997f 100644 --- a/src/analysis/disass/loop.c +++ b/src/analysis/disass/loop.c @@ -224,7 +224,7 @@ static void track_loops_in_code(const GArchProcessor *proc, const mrange_t *rang /* Fin de parcours ? */ - if (g_arch_instruction_is_return(iter)) + if (g_arch_instruction_get_flags(iter) & AIF_RETURN_POINT) break; /** diff --git a/src/analysis/disass/macro.c b/src/analysis/disass/macro.c index 4e77881..a9ae261 100644 --- a/src/analysis/disass/macro.c +++ b/src/analysis/disass/macro.c @@ -638,10 +638,10 @@ static void find_next_hops(GArchProcessor *proc, const vmpa2t *start, const code - if (g_arch_instruction_is_return(iter)) + if (g_arch_instruction_get_flags(iter) & AIF_RETURN_POINT) printf(" ++ return 0x%08x\n", (unsigned int)range->addr.virtual); - if (g_arch_instruction_is_return(iter)) + if (g_arch_instruction_get_flags(iter) & AIF_RETURN_POINT) { iter = NULL; break; @@ -1231,7 +1231,7 @@ static GInstrBlock *build_instruction_blocks(GArchProcessor *proc, code_coverage * L'expérience montre qu'il peut y avoir plusieurs fins dans une routine, * et donc des fins en milieu de couverture de cette même routine. */ - if (g_arch_instruction_is_return(iter)) break; + if (g_arch_instruction_get_flags(iter) & AIF_RETURN_POINT) break; /* On n'approfondit que les chemins qui se séparent */ if (!g_arch_instruction_has_destinations(iter)) diff --git a/src/arch/arm/v7/opdefs/Makefile.am b/src/arch/arm/v7/opdefs/Makefile.am index 6207906..5483f92 100644 --- a/src/arch/arm/v7/opdefs/Makefile.am +++ b/src/arch/arm/v7/opdefs/Makefile.am @@ -16,7 +16,6 @@ D2C_ENCODINGS = \ -e T=thumb_32_ D2C_MACROS = \ - -M DefineAsReturn=g_arch_instruction_define_as_return \ -M SetFlags=g_armv7_instruction_define_setflags \ -M Condition=g_arm_instruction_set_cond \ -M Register=translate_armv7_register \ diff --git a/src/arch/arm/v7/opdefs/b_A8818.d b/src/arch/arm/v7/opdefs/b_A8818.d index ab5971f..55b123e 100644 --- a/src/arch/arm/v7/opdefs/b_A8818.d +++ b/src/arch/arm/v7/opdefs/b_A8818.d @@ -48,7 +48,7 @@ //if cond == '1110' then UNDEFINED; //if cond == '1111' then SEE SVC; - //chk_call DefineAsReturn(1) + //chk_call SetInsFlag(AIF_RETURN_POINT) } @@ -77,7 +77,7 @@ @rules { //if InITBlock() && !LastInITBlock() then UNPREDICTABLE; - //chk_call DefineAsReturn(1) + //chk_call SetInsFlag(AIF_RETURN_POINT) } @@ -108,7 +108,7 @@ //if cond<3:1> == '111' then SEE "Related encodings"; //if InITBlock() then UNPREDICTABLE; - //chk_call DefineAsReturn(1) + //chk_call SetInsFlag(AIF_RETURN_POINT) } @@ -139,7 +139,7 @@ @rules { //if InITBlock() && !LastInITBlock() then UNPREDICTABLE; - //chk_call DefineAsReturn(1) + //chk_call SetInsFlag(AIF_RETURN_POINT) } @@ -168,7 +168,7 @@ @rules { - //chk_call DefineAsReturn(1) + //chk_call SetInsFlag(AIF_RETURN_POINT) } diff --git a/src/arch/arm/v7/opdefs/bl_A8825.d b/src/arch/arm/v7/opdefs/bl_A8825.d index 183ba36..a9b395a 100644 --- a/src/arch/arm/v7/opdefs/bl_A8825.d +++ b/src/arch/arm/v7/opdefs/bl_A8825.d @@ -47,7 +47,7 @@ @rules { - //chk_call DefineAsReturn(1) + //chk_call SetInsFlag(AIF_RETURN_POINT) } @@ -77,7 +77,7 @@ @rules { - //chk_call DefineAsReturn(1) + //chk_call SetInsFlag(AIF_RETURN_POINT) } @@ -105,7 +105,7 @@ @rules { - //chk_call DefineAsReturn(1) + //chk_call SetInsFlag(AIF_RETURN_POINT) } @@ -133,7 +133,7 @@ @rules { - //chk_call DefineAsReturn(1) + //chk_call SetInsFlag(AIF_RETURN_POINT) } diff --git a/src/arch/arm/v7/opdefs/blx_A8826.d b/src/arch/arm/v7/opdefs/blx_A8826.d index c972af2..bc26867 100644 --- a/src/arch/arm/v7/opdefs/blx_A8826.d +++ b/src/arch/arm/v7/opdefs/blx_A8826.d @@ -39,7 +39,7 @@ //if m == 15 then UNPREDICTABLE; //if InITBlock() && !LastInITBlock() then UNPREDICTABLE; - //chk_call DefineAsReturn(1) + //chk_call SetInsFlag(AIF_RETURN_POINT) } @@ -61,7 +61,7 @@ @rules { //if m == 15 then UNPREDICTABLE; - //chk_call DefineAsReturn(1) + //chk_call SetInsFlag(AIF_RETURN_POINT) } diff --git a/src/arch/arm/v7/opdefs/bx_A8827.d b/src/arch/arm/v7/opdefs/bx_A8827.d index f8027a4..75921ac 100644 --- a/src/arch/arm/v7/opdefs/bx_A8827.d +++ b/src/arch/arm/v7/opdefs/bx_A8827.d @@ -44,7 +44,7 @@ @rules { - chk_call DefineAsReturn(1) + chk_call SetInsFlag(AIF_RETURN_POINT) } @@ -71,7 +71,7 @@ @rules { - chk_call DefineAsReturn(1) + chk_call SetInsFlag(AIF_RETURN_POINT) } diff --git a/src/arch/arm/v7/opdefs/ldr_A8862.d b/src/arch/arm/v7/opdefs/ldr_A8862.d index 49d5c3a..e2f9e3f 100644 --- a/src/arch/arm/v7/opdefs/ldr_A8862.d +++ b/src/arch/arm/v7/opdefs/ldr_A8862.d @@ -76,7 +76,7 @@ //if Rn == '1111' then SEE LDR (literal); //if t == 15 && InITBlock() && !LastInITBlock() then UNPREDICTABLE; - if (Rt == '1111'); chk_call DefineAsReturn(1) + if (Rt == '1111'); chk_call SetInsFlag(AIF_RETURN_POINT) } @@ -104,7 +104,7 @@ //if Rn == '1101' && P == '0' && U == '1' && W == '1' && imm8 == '00000100' then SEE POP; //if P == '0' && W == '0' then UNDEFINED; //if (wback && n == t) || (t == 15 && InITBlock() && !LastInITBlock()) then UNPREDICTABLE; - if (Rt == '1111'); chk_call DefineAsReturn(1) + if (Rt == '1111'); chk_call SetInsFlag(AIF_RETURN_POINT) } @@ -133,7 +133,7 @@ //if Rn == '1101' && P == '0' && U == '1' && W == '1' && imm8 == '00000100' then SEE POP; //if P == '0' && W == '0' then UNDEFINED; //if (wback && n == t) || (t == 15 && InITBlock() && !LastInITBlock()) then UNPREDICTABLE; - if (Rt == '1111'); chk_call DefineAsReturn(1) + if (Rt == '1111'); chk_call SetInsFlag(AIF_RETURN_POINT) } diff --git a/src/arch/arm/v7/opdefs/ldr_A8863.d b/src/arch/arm/v7/opdefs/ldr_A8863.d index 2360e3a..b2f7f84 100644 --- a/src/arch/arm/v7/opdefs/ldr_A8863.d +++ b/src/arch/arm/v7/opdefs/ldr_A8863.d @@ -46,7 +46,7 @@ //t = UInt(Rt); n = UInt(Rn); imm32 = ZeroExtend(imm12, 32); //index = (P == '1'); add = (U == '1'); wback = (P == '0') || (W == '1'); //if wback && n == t then UNPREDICTABLE; - if (Rt == '1111'); chk_call DefineAsReturn(1) + if (Rt == '1111'); chk_call SetInsFlag(AIF_RETURN_POINT) } @@ -76,7 +76,7 @@ //t = UInt(Rt); n = UInt(Rn); imm32 = ZeroExtend(imm12, 32); //index = (P == '1'); add = (U == '1'); wback = (P == '0') || (W == '1'); //if wback && n == t then UNPREDICTABLE; - if (Rt == '1111'); chk_call DefineAsReturn(1) + if (Rt == '1111'); chk_call SetInsFlag(AIF_RETURN_POINT) } diff --git a/src/arch/arm/v7/opdefs/ldr_A8864.d b/src/arch/arm/v7/opdefs/ldr_A8864.d index 4cf0048..bd7ed50 100644 --- a/src/arch/arm/v7/opdefs/ldr_A8864.d +++ b/src/arch/arm/v7/opdefs/ldr_A8864.d @@ -70,7 +70,7 @@ @rules { //if t == 15 && InITBlock() && !LastInITBlock() then UNPREDICTABLE; - if (Rt == '1111'); chk_call DefineAsReturn(1) + if (Rt == '1111'); chk_call SetInsFlag(AIF_RETURN_POINT) } @@ -101,7 +101,7 @@ @rules { //if t == 15 && InITBlock() && !LastInITBlock() then UNPREDICTABLE; - if (Rt == '1111'); chk_call DefineAsReturn(1) + if (Rt == '1111'); chk_call SetInsFlag(AIF_RETURN_POINT) } diff --git a/src/arch/arm/v7/opdefs/ldr_A8865.d b/src/arch/arm/v7/opdefs/ldr_A8865.d index e8d255b..b6a0126 100644 --- a/src/arch/arm/v7/opdefs/ldr_A8865.d +++ b/src/arch/arm/v7/opdefs/ldr_A8865.d @@ -67,7 +67,7 @@ //if Rn == '1111' then SEE LDR (literal); //if m IN {13,15} then UNPREDICTABLE; //if t == 15 && InITBlock() && !LastInITBlock() then UNPREDICTABLE; - if (Rt == '1111'); chk_call DefineAsReturn(1) + if (Rt == '1111'); chk_call SetInsFlag(AIF_RETURN_POINT) } diff --git a/src/arch/arm/v7/opdefs/ldrb_A8867.d b/src/arch/arm/v7/opdefs/ldrb_A8867.d index 2114330..c772b08 100644 --- a/src/arch/arm/v7/opdefs/ldrb_A8867.d +++ b/src/arch/arm/v7/opdefs/ldrb_A8867.d @@ -60,7 +60,7 @@ //if Rt == '1111' then SEE PLD; //if Rn == '1111' then SEE LDRB (literal); //if t == 13 then UNPREDICTABLE; - if (Rt == '1111'); chk_call DefineAsReturn(1) + if (Rt == '1111'); chk_call SetInsFlag(AIF_RETURN_POINT) } @@ -88,7 +88,7 @@ //if P == '1' && U == '1' && W == '0' then SEE LDRBT; //if P == '0' && W == '0' then UNDEFINED; //if t == 13 || (t == 15 && W == '1') || (wback && n == t) then UNPREDICTABLE; - if (Rt == '1111'); chk_call DefineAsReturn(1) + if (Rt == '1111'); chk_call SetInsFlag(AIF_RETURN_POINT) } @@ -117,7 +117,7 @@ //if P == '1' && U == '1' && W == '0' then SEE LDRBT; //if P == '0' && W == '0' then UNDEFINED; //if t == 13 || (t == 15 && W == '1') || (wback && n == t) then UNPREDICTABLE; - if (Rt == '1111'); chk_call DefineAsReturn(1) + if (Rt == '1111'); chk_call SetInsFlag(AIF_RETURN_POINT) } diff --git a/src/arch/arm/v7/opdefs/ldrb_A8868.d b/src/arch/arm/v7/opdefs/ldrb_A8868.d index fdf3049..579db06 100644 --- a/src/arch/arm/v7/opdefs/ldrb_A8868.d +++ b/src/arch/arm/v7/opdefs/ldrb_A8868.d @@ -45,7 +45,7 @@ //if P == '1' && U == '1' && W == '0' then SEE LDRBT; //if P == '0' && W == '0' then UNDEFINED; //if t == 13 || (t == 15 && W == '1') || (wback && n == t) then UNPREDICTABLE; - if (Rt == '1111'); chk_call DefineAsReturn(1) + if (Rt == '1111'); chk_call SetInsFlag(AIF_RETURN_POINT) } @@ -74,7 +74,7 @@ //if P == '1' && U == '1' && W == '0' then SEE LDRBT; //if P == '0' && W == '0' then UNDEFINED; //if t == 13 || (t == 15 && W == '1') || (wback && n == t) then UNPREDICTABLE; - if (Rt == '1111'); chk_call DefineAsReturn(1) + if (Rt == '1111'); chk_call SetInsFlag(AIF_RETURN_POINT) } diff --git a/src/arch/arm/v7/opdefs/ldrb_A8870.d b/src/arch/arm/v7/opdefs/ldrb_A8870.d index 868b1c9..2b6f2e9 100644 --- a/src/arch/arm/v7/opdefs/ldrb_A8870.d +++ b/src/arch/arm/v7/opdefs/ldrb_A8870.d @@ -65,7 +65,7 @@ //if Rn == '1111' then UNDEFINED; //if t IN {13,15} || m IN {13,15} then UNPREDICTABLE; - if (Rt == '1111'); chk_call DefineAsReturn(1) + if (Rt == '1111'); chk_call SetInsFlag(AIF_RETURN_POINT) } @@ -93,7 +93,7 @@ //if t == 15 || m == 15 then UNPREDICTABLE; //if wback && (n == 15 || n == t) then UNPREDICTABLE; //if ArchVersion() < 6 && wback && m == n then UNPREDICTABLE; - if (Rt == '1111'); chk_call DefineAsReturn(1) + if (Rt == '1111'); chk_call SetInsFlag(AIF_RETURN_POINT) } @@ -122,7 +122,7 @@ //if t == 15 || m == 15 then UNPREDICTABLE; //if wback && (n == 15 || n == t) then UNPREDICTABLE; //if ArchVersion() < 6 && wback && m == n then UNPREDICTABLE; - if (Rt == '1111'); chk_call DefineAsReturn(1) + if (Rt == '1111'); chk_call SetInsFlag(AIF_RETURN_POINT) } diff --git a/src/arch/arm/v7/opdefs/pop_A88131.d b/src/arch/arm/v7/opdefs/pop_A88131.d index a5e878f..47b9c2d 100644 --- a/src/arch/arm/v7/opdefs/pop_A88131.d +++ b/src/arch/arm/v7/opdefs/pop_A88131.d @@ -39,7 +39,7 @@ //if BitCount(registers) < 1 then UNPREDICTABLE; //if registers<15> == '1' && InITBlock() && !LastInITBlock() then UNPREDICTABLE; - if (P == '1') ; chk_call DefineAsReturn(1) + if (P == '1') ; chk_call SetInsFlag(AIF_RETURN_POINT) } @@ -61,7 +61,7 @@ //if BitCount(registers) < 2 || (P == '1' && M == '1') then UNPREDICTABLE; //if registers<15> == '1' && InITBlock() && !LastInITBlock() then UNPREDICTABLE; - if (P == '1') ; chk_call DefineAsReturn(1) + if (P == '1') ; chk_call SetInsFlag(AIF_RETURN_POINT) } @@ -83,7 +83,7 @@ @rules { //if t == 13 || (t == 15 && InITBlock() && !LastInITBlock()) then UNPREDICTABLE; - if (Rt == '1111') ; chk_call DefineAsReturn(1) + if (Rt == '1111') ; chk_call SetInsFlag(AIF_RETURN_POINT) } diff --git a/src/arch/arm/v7/opdefs/pop_A88132.d b/src/arch/arm/v7/opdefs/pop_A88132.d index 1762b45..10e18a4 100644 --- a/src/arch/arm/v7/opdefs/pop_A88132.d +++ b/src/arch/arm/v7/opdefs/pop_A88132.d @@ -40,7 +40,7 @@ //if BitCount(register_list) < 2 then SEE LDM / LDMIA / LDMFD; //if registers<13> == '1' && ArchVersion() >= 7 then UNPREDICTABLE; - if (register_list & 0x8000) ; chk_call DefineAsReturn(1) + if (register_list & 0x8000) ; chk_call SetInsFlag(AIF_RETURN_POINT) } @@ -63,7 +63,7 @@ @rules { //if t == 13 then UNPREDICTABLE; - if (Rt == '1111') ; chk_call DefineAsReturn(1) + if (Rt == '1111') ; chk_call SetInsFlag(AIF_RETURN_POINT) } diff --git a/src/arch/arm/v7/opdefs/str_A88204.d b/src/arch/arm/v7/opdefs/str_A88204.d index 2712e1b..fb5879a 100644 --- a/src/arch/arm/v7/opdefs/str_A88204.d +++ b/src/arch/arm/v7/opdefs/str_A88204.d @@ -43,7 +43,7 @@ //if P == '0' && W == '1' then SEE STRT; //if Rn == '1101' && P == '1' && U == '0' && W == '1' && imm12 == '000000000100' then SEE PUSH; //if wback && (n == 15 || n == t) then UNPREDICTABLE; - if (Rt == '1111'); chk_call DefineAsReturn(1) + if (Rt == '1111'); chk_call SetInsFlag(AIF_RETURN_POINT) } @@ -70,7 +70,7 @@ //if P == '0' && W == '1' then SEE STRT; //if Rn == '1101' && P == '1' && U == '0' && W == '1' && imm12 == '000000000100' then SEE PUSH; //if wback && (n == 15 || n == t) then UNPREDICTABLE; - if (Rt == '1111'); chk_call DefineAsReturn(1) + if (Rt == '1111'); chk_call SetInsFlag(AIF_RETURN_POINT) } diff --git a/src/arch/arm/v7/opdefs/strb_A88207.d b/src/arch/arm/v7/opdefs/strb_A88207.d index b57dbf7..2af8fb7 100644 --- a/src/arch/arm/v7/opdefs/strb_A88207.d +++ b/src/arch/arm/v7/opdefs/strb_A88207.d @@ -45,7 +45,7 @@ //if P == '1' && U == '1' && W == '0' then SEE LDRBT; //if P == '0' && W == '0' then UNDEFINED; //if t == 13 || (t == 15 && W == '1') || (wback && n == t) then UNPREDICTABLE; - if (Rt == '1111'); chk_call DefineAsReturn(1) + if (Rt == '1111'); chk_call SetInsFlag(AIF_RETURN_POINT) } @@ -74,7 +74,7 @@ //if P == '1' && U == '1' && W == '0' then SEE LDRBT; //if P == '0' && W == '0' then UNDEFINED; //if t == 13 || (t == 15 && W == '1') || (wback && n == t) then UNPREDICTABLE; - if (Rt == '1111'); chk_call DefineAsReturn(1) + if (Rt == '1111'); chk_call SetInsFlag(AIF_RETURN_POINT) } diff --git a/src/arch/arm/v7/opdefs/strb_A88208.d b/src/arch/arm/v7/opdefs/strb_A88208.d index ab6c198..c94fe4d 100644 --- a/src/arch/arm/v7/opdefs/strb_A88208.d +++ b/src/arch/arm/v7/opdefs/strb_A88208.d @@ -65,7 +65,7 @@ //if Rn == '1111' then UNDEFINED; //if t IN {13,15} || m IN {13,15} then UNPREDICTABLE; - if (Rt == '1111'); chk_call DefineAsReturn(1) + if (Rt == '1111'); chk_call SetInsFlag(AIF_RETURN_POINT) } @@ -92,7 +92,7 @@ //if P == '0' && W == '1' then SEE STRT; //if Rn == '1101' && P == '1' && U == '0' && W == '1' && imm12 == '000000000100' then SEE PUSH; //if wback && (n == 15 || n == t) then UNPREDICTABLE; - if (Rt == '1111'); chk_call DefineAsReturn(1) + if (Rt == '1111'); chk_call SetInsFlag(AIF_RETURN_POINT) } @@ -120,7 +120,7 @@ //if P == '0' && W == '1' then SEE STRT; //if Rn == '1101' && P == '1' && U == '0' && W == '1' && imm12 == '000000000100' then SEE PUSH; //if wback && (n == 15 || n == t) then UNPREDICTABLE; - if (Rt == '1111'); chk_call DefineAsReturn(1) + if (Rt == '1111'); chk_call SetInsFlag(AIF_RETURN_POINT) } diff --git a/src/arch/instruction.c b/src/arch/instruction.c index 7391af1..b895af0 100644 --- a/src/arch/instruction.c +++ b/src/arch/instruction.c @@ -175,16 +175,18 @@ void g_arch_instruction_append_suffix(GArchInstruction *instr, const char *suffi * * * Description : Ajoute une information complémentaire à une instruction. * * * -* Retour : - * +* Retour : Bilan de l'opération. * * * * Remarques : - * * * ******************************************************************************/ -void g_arch_instruction_set_flag(GArchInstruction *instr, ArchInstrFlag flag) +bool g_arch_instruction_set_flag(GArchInstruction *instr, ArchInstrFlag flag) { instr->flags |= flag; + return true; + } @@ -520,47 +522,6 @@ InstructionLinkType g_arch_instruction_get_link(const GArchInstruction *instr, v /****************************************************************************** * * -* Paramètres : instr = instruction à consulter. * -* status = statut de l'instruction vis à vis du flot. * -* * -* Description : Précise si l'instruction correspond à un retour de fonction. * -* * -* Retour : true (pour respecter le prototypage depuis les fichiers D). * -* * -* Remarques : - * -* * -******************************************************************************/ - -bool g_arch_instruction_define_as_return(GArchInstruction *instr, bool status) -{ - instr->is_return = status; - - return true; - -} - - -/****************************************************************************** -* * -* Paramètres : instr = instruction à consulter. * -* * -* Description : Indique si l'instruction correspond à un retour de fonction. * -* * -* Retour : true si l'instruction est un 'return' quelconque ou false. * -* * -* Remarques : - * -* * -******************************************************************************/ - -bool g_arch_instruction_is_return(const GArchInstruction *instr) -{ - return instr->is_return; - -} - - -/****************************************************************************** -* * * Paramètres : instr = instruction dont les informations sont à consulter. * * dest = ligne visée par la liaison (côté destination). * * type = type de lien à construire. * diff --git a/src/arch/instruction.h b/src/arch/instruction.h index b570d92..a4ea1b5 100644 --- a/src/arch/instruction.h +++ b/src/arch/instruction.h @@ -66,12 +66,13 @@ void g_arch_instruction_append_suffix(GArchInstruction *, const char *); typedef enum _ArchInstrFlag { AIF_NONE = (0 << 0), /* Aucune information */ - AIF_ROUTINE_START = (1 << 0) /* Début de routine */ + AIF_ROUTINE_START = (1 << 0), /* Début de routine */ + AIF_RETURN_POINT = (1 << 1) /* Retour de fonction appelée */ } ArchInstrFlag; /* Ajoute une information complémentaire à une instruction. */ -void g_arch_instruction_set_flag(GArchInstruction *, ArchInstrFlag); +bool g_arch_instruction_set_flag(GArchInstruction *, ArchInstrFlag); /* Fournit les informations complémentaires d'une instruction. */ ArchInstrFlag g_arch_instruction_get_flags(const GArchInstruction *); @@ -179,12 +180,6 @@ typedef union _link_extra_info /* Informe sur une éventuelle référence à une autre instruction. */ InstructionLinkType g_arch_instruction_get_link(const GArchInstruction *, vmpa_t *); -/* Précise si l'instruction correspond à un retour de fonction. */ -bool g_arch_instruction_define_as_return(GArchInstruction *, bool); - -/* Indique si l'instruction correspond à un retour de fonction. */ -bool g_arch_instruction_is_return(const GArchInstruction *instr); - /* Etablit un lien entre deux instructions. */ void g_arch_instruction_link_with(GArchInstruction *, GArchInstruction *, InstructionLinkType, ...); diff --git a/src/gtkext/gtkgraphview.c b/src/gtkext/gtkgraphview.c index ac78981..c10d9c1 100644 --- a/src/gtkext/gtkgraphview.c +++ b/src/gtkext/gtkgraphview.c @@ -762,7 +762,7 @@ static void gtk_graph_view_reach_caret_limit(GtkBufferView *node, GdkScrollDirec #ifndef NDEBUG if (ref != NULL) - is_return = g_arch_instruction_is_return(ref); + is_return = (g_arch_instruction_get_flags(ref) & AIF_RETURN_POINT); #endif if (ref != NULL) -- cgit v0.11.2-87-g4458