diff options
| author | Cyrille Bagard <nocbos@gmail.com> | 2009-07-18 15:41:02 (GMT) | 
|---|---|---|
| committer | Cyrille Bagard <nocbos@gmail.com> | 2009-07-18 15:41:02 (GMT) | 
| commit | 3a9fe39c6a8923f45e7c96d80b0bfe52b8686ff9 (patch) | |
| tree | 30c3bfa3df145a74d3237513b9eb6dc5559d32be /src/arch | |
| parent | 10105a5f877fd2c6d1e67343956269f1b19a5133 (diff) | |
Computed the end of routines with no limit.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@98 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/arch')
| -rw-r--r-- | src/arch/instruction-int.h | 4 | ||||
| -rw-r--r-- | src/arch/instruction.c | 19 | ||||
| -rw-r--r-- | src/arch/instruction.h | 4 | ||||
| -rw-r--r-- | src/arch/x86/instruction.c | 22 | 
4 files changed, 49 insertions, 0 deletions
| diff --git a/src/arch/instruction-int.h b/src/arch/instruction-int.h index 6ae0597..db6a3bf 100644 --- a/src/arch/instruction-int.h +++ b/src/arch/instruction-int.h @@ -36,6 +36,9 @@ typedef const char * (* get_instruction_text_fc) (const GArchInstruction *, cons  /* Informe sur une éventuelle référence à une autre instruction. */  typedef InstructionLinkType (* get_instruction_link_fc) (const GArchInstruction *, vmpa_t *); +/* Indique si l'instruction correspond à un retour de fonction. */ +typedef bool (* is_instruction_return_fc) (const GArchInstruction *); +  /* Définition générique d'une instruction d'architecture (instance) */  struct _GArchInstruction @@ -52,6 +55,7 @@ struct _GArchInstruction      get_instruction_text_fc get_text;       /* Texte humain équivalent     */      get_instruction_link_fc get_link;       /* Référence à une instruction */ +    is_instruction_return_fc is_return;     /* Retour de fonction ou pas ? */  }; diff --git a/src/arch/instruction.c b/src/arch/instruction.c index 69644dc..e0cea9f 100644 --- a/src/arch/instruction.c +++ b/src/arch/instruction.c @@ -321,3 +321,22 @@ InstructionLinkType g_arch_instruction_get_link(const GArchInstruction *instr, v      return instr->get_link(instr, addr);  } + + +/****************************************************************************** +*                                                                             * +*  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(instr); + +} diff --git a/src/arch/instruction.h b/src/arch/instruction.h index b8be830..c0cb9f6 100644 --- a/src/arch/instruction.h +++ b/src/arch/instruction.h @@ -25,6 +25,7 @@  #define _ARCH_INSTRUCTION_H +#include <stdbool.h>  #include <glib-object.h>  #include <sys/types.h> @@ -90,6 +91,9 @@ char *g_arch_instruction_get_text(const GArchInstruction *, const exe_format *,  /* Informe sur une éventuelle référence à une autre instruction. */  InstructionLinkType g_arch_instruction_get_link(const GArchInstruction *, vmpa_t *); +/* Indique si l'instruction correspond à un retour de fonction. */ +bool g_arch_instruction_is_return(const GArchInstruction *instr); +  #endif  /* _ARCH_INSTRUCTION_H */ diff --git a/src/arch/x86/instruction.c b/src/arch/x86/instruction.c index 0321e88..0af29c1 100644 --- a/src/arch/x86/instruction.c +++ b/src/arch/x86/instruction.c @@ -326,6 +326,8 @@ static const char *x86_get_instruction_text(const GX86Instruction *, const exe_f  /* Informe sur une éventuelle référence à une autre instruction. */  static InstructionLinkType x86_get_instruction_link(const GX86Instruction *, vmpa_t *); +/* Indique si l'instruction correspond à un retour de fonction. */ +static bool x86_instruction_is_return(const GX86Instruction *); @@ -372,6 +374,7 @@ static void g_x86_instruction_init(GX86Instruction *instr)      parent->get_text = (get_instruction_text_fc)x86_get_instruction_text;      parent->get_link = (get_instruction_link_fc)x86_get_instruction_link; +    parent->is_return = (is_instruction_return_fc)x86_instruction_is_return;  } @@ -622,3 +625,22 @@ static InstructionLinkType x86_get_instruction_link(const GX86Instruction *instr      return result;  } + + +/****************************************************************************** +*                                                                             * +*  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   : -                                                            * +*                                                                             * +******************************************************************************/ + +static bool x86_instruction_is_return(const GX86Instruction *instr) +{ +    return (instr->type == XOP_RET); + +} | 
