diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2015-01-10 16:37:34 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2015-01-10 16:37:34 (GMT) |
commit | 8ef66a1e0225c9e00175fbaf3f3038f537de511f (patch) | |
tree | dd7112dd50c02e0ad1565ce7a890991b5e1270c6 /src/arch/arm/v7/link.c | |
parent | cc3e31eecd90766ae4f0bb391428c5c59567ef4c (diff) |
Extended the grammar to allow hooks inclusion.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@453 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/arch/arm/v7/link.c')
-rw-r--r-- | src/arch/arm/v7/link.c | 28 |
1 files changed, 5 insertions, 23 deletions
diff --git a/src/arch/arm/v7/link.c b/src/arch/arm/v7/link.c index 69b43bc..fff0944 100644 --- a/src/arch/arm/v7/link.c +++ b/src/arch/arm/v7/link.c @@ -27,15 +27,13 @@ #include <assert.h> -#include "context.h" - - /****************************************************************************** * * * Paramètres : instr = instruction ARMv7 à traiter. * * context = contexte associé à la phase de désassemblage. * * format = acès aux données du binaire d'origine. * +* iset = type de jeu d'instructions courant à faire suivre. * * * * Description : Complète un désassemblage accompli pour une instruction. * * * @@ -45,14 +43,13 @@ * * ******************************************************************************/ -void handle_links_with_thumb_instruction_bl(GArchInstruction *instr, GArmV7Context *context, GBinFormat *format) +void handle_links_with_instruction_bl_with_orig(GArchInstruction *instr, GArmV7Context *context, GBinFormat *format, ArmV7InstrSet iset) { const mrange_t *range; /* Emplacementt d'instruction */ virt_t pc; /* Position dans l'exécution */ GArchOperand *op; /* Opérande numérique en place */ int32_t offset; /* Décallage encodé en dur */ virt_t target; /* Adresse virtuelle visée */ - ArmV7InstrSet iset; /* Type de jeu courant */ range = g_arch_instruction_get_range(instr); @@ -72,11 +69,7 @@ void handle_links_with_thumb_instruction_bl(GArchInstruction *instr, GArmV7Conte if (g_imm_operand_get_value(G_IMM_OPERAND(op), MDS_32_BITS_SIGNED, &offset)) g_imm_operand_set_value(G_IMM_OPERAND(op), MDS_32_BITS_UNSIGNED, pc + offset); - - //printf("[@ 0x%08x] Add 0x%08x to %p\n", (uint32_t)get_virt_addr(get_mrange_addr(range)), (uint32_t)(pc + offset), context); - target = pc + offset; - iset = g_armv7_context_find_encoding(context, get_virt_addr(get_mrange_addr(range))); g_armv7_context_define_encoding(context, target, iset); @@ -88,6 +81,7 @@ void handle_links_with_thumb_instruction_bl(GArchInstruction *instr, GArmV7Conte * Paramètres : instr = instruction ARMv7 à traiter. * * context = contexte associé à la phase de désassemblage. * * format = acès aux données du binaire d'origine. * +* iset = type de jeu d'instructions courant à inverser. * * * * Description : Complète un désassemblage accompli pour une instruction. * * * @@ -97,14 +91,13 @@ void handle_links_with_thumb_instruction_bl(GArchInstruction *instr, GArmV7Conte * * ******************************************************************************/ -void handle_links_with_thumb_instruction_blx(GArchInstruction *instr, GArmV7Context *context, GBinFormat *format) +void handle_links_with_instruction_blx_with_dest(GArchInstruction *instr, GArmV7Context *context, GBinFormat *format, ArmV7InstrSet iset) { const mrange_t *range; /* Emplacementt d'instruction */ virt_t pc; /* Position dans l'exécution */ GArchOperand *op; /* Opérande numérique en place */ int32_t offset; /* Décallage encodé en dur */ virt_t target; /* Adresse virtuelle visée */ - ArmV7InstrSet iset; /* Type de jeu courant */ range = g_arch_instruction_get_range(instr); @@ -125,19 +118,8 @@ void handle_links_with_thumb_instruction_blx(GArchInstruction *instr, GArmV7Cont if (g_imm_operand_get_value(G_IMM_OPERAND(op), MDS_32_BITS_SIGNED, &offset)) g_imm_operand_set_value(G_IMM_OPERAND(op), MDS_32_BITS_UNSIGNED, pc + offset); - - //printf("[@ 0x%08x] Add 0x%08x to %p\n", (uint32_t)get_virt_addr(get_mrange_addr(range)), (uint32_t)(pc + offset), context); - target = pc + offset; - iset = g_armv7_context_find_encoding(context, get_virt_addr(get_mrange_addr(range))); - - printf(" --link-- @ 0x%08x iset = %u\n", (unsigned int)target, (unsigned int)iset); - - if (iset == AV7IS_ARM) - g_armv7_context_define_encoding(context, target, AV7IS_THUMB); - else - g_armv7_context_define_encoding(context, target, AV7IS_ARM); - + g_armv7_context_define_encoding(context, target, iset); } |