diff options
Diffstat (limited to 'src/arch/arm')
-rw-r--r-- | src/arch/arm/context.c | 44 | ||||
-rw-r--r-- | src/arch/arm/processor.c | 28 | ||||
-rw-r--r-- | src/arch/arm/v7/link.c | 7 |
3 files changed, 79 insertions, 0 deletions
diff --git a/src/arch/arm/context.c b/src/arch/arm/context.c index c86b190..7f41b92 100644 --- a/src/arch/arm/context.c +++ b/src/arch/arm/context.c @@ -60,6 +60,9 @@ static void g_arm_context_dispose(GArmContext *); /* Procède à la libération totale de la mémoire. */ static void g_arm_context_finalize(GArmContext *); +/* Ajoute une adresse virtuelle comme point de départ de code. */ +static void g_arm_context_push_drop_point(GArmContext *, virt_t ); + /* ------------------------- CONTEXTE POUR LA DECOMPILATION ------------------------- */ @@ -124,12 +127,17 @@ G_DEFINE_TYPE(GArmContext, g_arm_context, G_TYPE_PROC_CONTEXT); static void g_arm_context_class_init(GArmContextClass *klass) { GObjectClass *object; /* Autre version de la classe */ + GProcContextClass *proc; /* Version parente de la classe*/ object = G_OBJECT_CLASS(klass); object->dispose = (GObjectFinalizeFunc/* ! */)g_arm_context_dispose; object->finalize = (GObjectFinalizeFunc)g_arm_context_finalize; + proc = G_PROC_CONTEXT_CLASS(klass); + + proc->push_point = (push_drop_point_fc)g_arm_context_push_drop_point; + } @@ -212,6 +220,42 @@ GArmContext *g_arm_context_new(void) } +/****************************************************************************** +* * +* Paramètres : ctx = contexte de désassemblage à compléter. * +* addr = adresse d'un nouveau point de départ à traiter. * +* * +* Description : Ajoute une adresse virtuelle comme point de départ de code. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void g_arm_context_push_drop_point(GArmContext *ctx, virt_t addr) +{ + + + printf("PUSH !!\n"); + + + + if (addr & 0x1) + { + addr -= 0x1; + + + } + else ; + + // ARM / Thumb + + G_PROC_CONTEXT_CLASS(g_arm_context_parent_class)->push_point(G_PROC_CONTEXT(ctx), addr); + +} + + /* ---------------------------------------------------------------------------------- */ /* CONTEXTE POUR LA DECOMPILATION */ diff --git a/src/arch/arm/processor.c b/src/arch/arm/processor.c index 2c676be..cf993c0 100644 --- a/src/arch/arm/processor.c +++ b/src/arch/arm/processor.c @@ -24,6 +24,7 @@ #include "processor.h" +#include "context.h" #include "processor-int.h" @@ -40,6 +41,9 @@ static void g_arm_processor_dispose(GArmProcessor *); /* Procède à la libération totale de la mémoire. */ static void g_arm_processor_finalize(GArmProcessor *); +/* Fournit un contexte pour l'exécution du processeur ARM. */ +static GArmContext *g_arm_processor_get_context(const GArmProcessor *); + /* Indique le type défini par la GLib pour le processeur ARM. */ @@ -84,6 +88,11 @@ static void g_arm_processor_class_init(GArmProcessorClass *klass) static void g_arm_processor_init(GArmProcessor *proc) { + GArchProcessor *parent; /* Instance parente */ + + parent = G_ARCH_PROCESSOR(proc); + + parent->get_ctx = (get_processor_context_fc)g_arm_processor_get_context; } @@ -124,3 +133,22 @@ static void g_arm_processor_finalize(GArmProcessor *proc) G_OBJECT_CLASS(g_arm_processor_parent_class)->finalize(G_OBJECT(proc)); } + + +/****************************************************************************** +* * +* Paramètres : proc = architecture, spectatrice ici. * +* * +* Description : Fournit un contexte pour l'exécution du processeur Arm. * +* * +* Retour : Contexte mis en place. * +* * +* Remarques : - * +* * +******************************************************************************/ + +static GArmContext *g_arm_processor_get_context(const GArmProcessor *proc) +{ + return g_arm_context_new(); + +} diff --git a/src/arch/arm/v7/link.c b/src/arch/arm/v7/link.c index 278b8d0..e7a1b40 100644 --- a/src/arch/arm/v7/link.c +++ b/src/arch/arm/v7/link.c @@ -67,6 +67,9 @@ void handle_links_with_thumb_instruction_bl(GArchInstruction *instr, GProcContex 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); + } @@ -110,4 +113,8 @@ void handle_links_with_thumb_instruction_blx(GArchInstruction *instr, GProcConte 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); + + } |