diff options
Diffstat (limited to 'src/arch/arm/v7')
-rw-r--r-- | src/arch/arm/v7/context.c | 76 | ||||
-rw-r--r-- | src/arch/arm/v7/context.h | 3 | ||||
-rw-r--r-- | src/arch/arm/v7/fetch.c | 19 |
3 files changed, 45 insertions, 53 deletions
diff --git a/src/arch/arm/v7/context.c b/src/arch/arm/v7/context.c index 030457e..446a972 100644 --- a/src/arch/arm/v7/context.c +++ b/src/arch/arm/v7/context.c @@ -63,7 +63,7 @@ static void g_armv7_context_dispose(GArmV7Context *); static void g_armv7_context_finalize(GArmV7Context *); /* Ajoute une adresse virtuelle comme point de départ de code. */ -static void g_armv7_context_push_drop_point(GArmV7Context *, virt_t ); +static void g_armv7_context_push_drop_point(GArmV7Context *, unsigned int, virt_t, va_list); @@ -196,8 +196,10 @@ GArmV7Context *g_armv7_context_new(void) /****************************************************************************** * * -* Paramètres : ctx = contexte de désassemblage à compléter. * -* addr = adresse d'un nouveau point de départ à traiter. * +* Paramètres : ctx = contexte de désassemblage à compléter. * +* level = indication de priorité et d'origine de l'adresse. * +* addr = adresse d'un nouveau point de départ à traiter. * +* ap = forme générique d'un encodage à mémoriser. * * * * Description : Ajoute une adresse virtuelle comme point de départ de code. * * * @@ -207,53 +209,45 @@ GArmV7Context *g_armv7_context_new(void) * * ******************************************************************************/ -static void g_armv7_context_push_drop_point(GArmV7Context *ctx, virt_t addr) +static void g_armv7_context_push_drop_point(GArmV7Context *ctx, unsigned int level, virt_t addr, va_list ap) { - if (addr & 0x1) - { - addr -= 0x1; - g_armv7_context_define_encoding(ctx, addr, AV7IS_THUMB); - } - else - g_armv7_context_define_encoding(ctx, addr, AV7IS_ARM); + ArmV7InstrSet marker; /* Type de jeu d'instructions */ - G_PROC_CONTEXT_CLASS(g_armv7_context_parent_class)->push_point(G_PROC_CONTEXT(ctx), addr); + switch (level) + { + case 0: -} + if (addr & 0x1) + { + addr -= 0x1; + marker = AV7IS_THUMB; + } + else + marker = AV7IS_ARM; -/****************************************************************************** -* * -* Paramètres : ctx = contexte de désassemblage à compléter. * -* addr = adresse d'un nouveau point de départ à traiter. * -* marker = forme générique d'un encodage à mémoriser. * -* * -* Description : Ajoute une adresse virtuelle comme point de départ de code. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ + break; + + default: + + marker = va_arg(ap, ArmV7InstrSet); + + /** + * Attention : toute adresse impaire est destinée à du mode Thumb. + * + * Mais la réciproque n'est pas vraie : le mode Thumb peut aussi + * manipuler des adresses paires. + */ + assert(((addr & 0x1) && marker == AV7IS_THUMB) || (addr & 0x1) == 0); + + addr &= ~0x1; + + break; -void g_armv7_context_push_drop_point_ext(GArmV7Context *ctx, virt_t addr, ArmV7InstrSet marker) -{ - if (addr & 0x1) - { - addr -= 0x1; - assert(marker == AV7IS_THUMB); } g_armv7_context_define_encoding(ctx, addr, marker); - /** - * Il faut impérativement passer pour l'interface publique afin : - * - de poser le verrou associé. - * - de déclencher l'émission du signal lié. - * - * Pas d'appel via G_PROC_CONTEXT_CLASS(g_armv7_context_parent_class)->push_point() donc. - */ - - g_proc_context_push_drop_point(G_PROC_CONTEXT(ctx), addr); + G_PROC_CONTEXT_CLASS(g_armv7_context_parent_class)->push_point(G_PROC_CONTEXT(ctx), level, addr, ap); } diff --git a/src/arch/arm/v7/context.h b/src/arch/arm/v7/context.h index 48cafce..b7edfd5 100644 --- a/src/arch/arm/v7/context.h +++ b/src/arch/arm/v7/context.h @@ -76,9 +76,6 @@ void g_armv7_context_define_encoding(GArmV7Context *, virt_t, ArmV7InstrSet); /* Indique l'encodage (générique) utilisé à une adresse donnée. */ ArmV7InstrSet g_armv7_context_find_encoding(GArmV7Context *, virt_t); -/* Ajoute une adresse virtuelle comme point de départ de code. */ -void g_armv7_context_push_drop_point_ext(GArmV7Context *ctx, virt_t addr, ArmV7InstrSet marker); - #endif /* _ARCH_ARM_V7_CONTEXT_H */ diff --git a/src/arch/arm/v7/fetch.c b/src/arch/arm/v7/fetch.c index da83d15..33a9e92 100644 --- a/src/arch/arm/v7/fetch.c +++ b/src/arch/arm/v7/fetch.c @@ -99,7 +99,7 @@ void help_fetching_with_instruction_b_with_orig(GArchInstruction *instr, GArchPr target = pc + offset; //g_armv7_context_define_encoding(context, target, iset); - g_armv7_context_push_drop_point_ext(context, target, iset); + g_proc_context_push_drop_point(G_PROC_CONTEXT(context), 3, target, iset); } @@ -168,7 +168,7 @@ void help_fetching_with_instruction_bl_with_orig(GArchInstruction *instr, GArchP target = pc + offset; //g_armv7_context_define_encoding(context, target, iset); - g_armv7_context_push_drop_point_ext(context, target, iset); + g_proc_context_push_drop_point(G_PROC_CONTEXT(context), 3, target, iset); } @@ -227,7 +227,7 @@ void help_fetching_with_instruction_blx_with_dest(GArchInstruction *instr, GArch target = pc + offset; //g_armv7_context_define_encoding(context, target, iset); - g_armv7_context_push_drop_point_ext(context, target, iset); + g_proc_context_push_drop_point(G_PROC_CONTEXT(context), 3, target, iset); } @@ -280,12 +280,12 @@ void help_fetching_with_instruction_bx_with_orig(GArchInstruction *instr, GArchP case AV7IS_ARM: pc += 8; //g_armv7_context_define_encoding(context, - g_armv7_context_push_drop_point_ext(context, pc, AV7IS_THUMB); + g_proc_context_push_drop_point(G_PROC_CONTEXT(context), 3, pc, AV7IS_THUMB); break; case AV7IS_THUMB: pc += 4; //g_armv7_context_define_encoding(context, - g_armv7_context_push_drop_point_ext(context, pc, AV7IS_ARM); + g_proc_context_push_drop_point(G_PROC_CONTEXT(context), 3, pc, AV7IS_ARM); break; default: assert(0); @@ -342,7 +342,7 @@ void help_fetching_with_instruction_cb_n_z(GArchInstruction *instr, GArchProcess target = pc + offset; //g_armv7_context_define_encoding(context, target, AV7IS_THUMB); - g_armv7_context_push_drop_point_ext(context, target, AV7IS_THUMB); + g_proc_context_push_drop_point(G_PROC_CONTEXT(context), 3, target, AV7IS_THUMB); } @@ -506,9 +506,9 @@ void help_fetching_with_instruction_ldr_literal_with_orig(GArchInstruction *inst /// FIXME ?! - if (target < 0x8000) return; + //if (target < 0x8000) return; - if (target > 0x6966c) return; + //if (target > 0x6966c) return; new = g_imm_operand_new_from_value(MDS_32_BITS_UNSIGNED, target); @@ -523,8 +523,9 @@ void help_fetching_with_instruction_ldr_literal_with_orig(GArchInstruction *inst //target = pc + offset; + //g_armv7_context_define_encoding(context, target, AV7IS_THUMB); - g_armv7_context_push_drop_point_ext(context, target, iset); + g_proc_context_push_drop_point(G_PROC_CONTEXT(context), 0/*FIXME*/, target); //exit(0); |