diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2015-11-26 23:30:01 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2015-11-26 23:30:01 (GMT) |
commit | 6b1a70c16f83a926f7b1f1fb2af5d6a2e017737b (patch) | |
tree | 8ffb0b3d8f3063c612f8cebe4f00a65f8b029a52 /src/arch/arm | |
parent | a93a5dca1a7292b7e61ae09b74f3252e04b73488 (diff) |
Used several threads without lock to disassemble binary code.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@610 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/arch/arm')
-rw-r--r-- | src/arch/arm/context-int.h | 1 | ||||
-rw-r--r-- | src/arch/arm/context.c | 18 | ||||
-rw-r--r-- | src/arch/arm/v7/context.c | 10 |
3 files changed, 24 insertions, 5 deletions
diff --git a/src/arch/arm/context-int.h b/src/arch/arm/context-int.h index 51ed6d0..fbd3a6f 100644 --- a/src/arch/arm/context-int.h +++ b/src/arch/arm/context-int.h @@ -50,6 +50,7 @@ struct _GArmContext disass_arm_area *areas; /* Désassemblage découpé */ size_t acount; /* Nombre de zones définies */ + GMutex areas_access; /* Accès aux découpes de zones */ }; diff --git a/src/arch/arm/context.c b/src/arch/arm/context.c index b54de42..d805e8c 100644 --- a/src/arch/arm/context.c +++ b/src/arch/arm/context.c @@ -139,6 +139,7 @@ static void g_arm_context_class_init(GArmContextClass *klass) static void g_arm_context_init(GArmContext *ctx) { + g_mutex_init(&ctx->areas_access); } @@ -157,6 +158,8 @@ static void g_arm_context_init(GArmContext *ctx) static void g_arm_context_dispose(GArmContext *ctx) { + g_mutex_clear(&ctx->areas_access); + G_OBJECT_CLASS(g_arm_context_parent_class)->dispose(G_OBJECT(ctx)); } @@ -263,11 +266,11 @@ void _g_arm_context_define_encoding(GArmContext *ctx, virt_t addr, unsigned int { size_t selected; /* Zone associée à une adresse */ - /* TODO : pose de verroux ? */ + g_mutex_lock(&ctx->areas_access); selected = find_disass_arm_area(ctx->areas, addr, 0, ctx->acount - 1); - assert(ctx->areas[selected].start != addr || ctx->areas[selected].marker == marker); + //assert(ctx->areas[selected].start != addr || ctx->areas[selected].marker == marker); /* S'agit-il d'une redéfinition ? */ if (ctx->areas[selected].start == addr) @@ -290,6 +293,8 @@ void _g_arm_context_define_encoding(GArmContext *ctx, virt_t addr, unsigned int } + g_mutex_unlock(&ctx->areas_access); + } @@ -308,13 +313,18 @@ void _g_arm_context_define_encoding(GArmContext *ctx, virt_t addr, unsigned int unsigned int _g_arm_context_find_encoding(GArmContext *ctx, virt_t addr) { + unsigned int result; /* Identifiant à retourner */ size_t selected; /* Zone associée à une adresse */ - /* TODO : pose de verroux ? */ + g_mutex_lock(&ctx->areas_access); selected = find_disass_arm_area(ctx->areas, addr, 0, ctx->acount - 1); - return ctx->areas[selected].marker; + result = ctx->areas[selected].marker; + + g_mutex_unlock(&ctx->areas_access); + + return result; } diff --git a/src/arch/arm/v7/context.c b/src/arch/arm/v7/context.c index 885ce70..030457e 100644 --- a/src/arch/arm/v7/context.c +++ b/src/arch/arm/v7/context.c @@ -245,7 +245,15 @@ void g_armv7_context_push_drop_point_ext(GArmV7Context *ctx, virt_t addr, ArmV7I g_armv7_context_define_encoding(ctx, addr, marker); - G_PROC_CONTEXT_CLASS(g_armv7_context_parent_class)->push_point(G_PROC_CONTEXT(ctx), addr); + /** + * 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); } |