summaryrefslogtreecommitdiff
path: root/plugins/arm/v7
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2020-04-21 18:44:33 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2020-04-21 18:44:33 (GMT)
commitcd54168f9877ed4ee16ee1e25c72e8338eed7928 (patch)
tree04dc1a85a28ff8a95eaaa6a0bbd5909ea2dc6397 /plugins/arm/v7
parent3dada5fbc27777217625603905727364a0cc996d (diff)
Redefined the interface for creating new processors from Python.
Diffstat (limited to 'plugins/arm/v7')
-rw-r--r--plugins/arm/v7/processor.c93
1 files changed, 84 insertions, 9 deletions
diff --git a/plugins/arm/v7/processor.c b/plugins/arm/v7/processor.c
index 078cc2d..7852284 100644
--- a/plugins/arm/v7/processor.c
+++ b/plugins/arm/v7/processor.c
@@ -66,6 +66,15 @@ static void g_armv7_processor_finalize(GArmV7Processor *);
/* Fournit la désignation interne du processeur d'architecture. */
static char *g_armv7_processor_get_key(const GArmV7Processor *);
+/* Fournit le nom humain de l'architecture visée. */
+static char *g_armv7_processor_get_desc(const GArmV7Processor *);
+
+/* Fournit la taille de l'espace mémoire d'une architecture. */
+static MemoryDataSize g_armv7_processor_get_memory_size(const GArmV7Processor *);
+
+/* Fournit la taille min. des instructions d'une architecture. */
+static MemoryDataSize g_armv7_processor_get_instruction_min_size(const GArmV7Processor *);
+
/* Fournit un contexte pour l'exécution du processeur ARM. */
static GArmV7Context *g_armv7_processor_get_context(const GArmV7Processor *);
@@ -102,16 +111,12 @@ static void g_armv7_processor_class_init(GArmV7ProcessorClass *klass)
proc = G_ARCH_PROCESSOR_CLASS(klass);
- proc->desc = "ARM v7";
-
- proc->endianness = SRE_LITTLE;
- proc->memsize = MDS_32_BITS;
- proc->inssize = MDS_32_BITS;
- proc->virt_space = true;
-
proc->get_key = (get_processor_key_fc)g_armv7_processor_get_key;
- proc->get_ctx = (get_processor_context_fc)g_armv7_processor_get_context;
+ proc->get_desc = (get_processor_desc_fc)g_armv7_processor_get_desc;
+ proc->get_memsize = (get_processor_memsize_fc)g_armv7_processor_get_memory_size;
+ proc->get_inssize = (get_processor_inssize_fc)g_armv7_processor_get_instruction_min_size;
+ proc->get_ctx = (get_processor_context_fc)g_armv7_processor_get_context;
proc->disassemble = (disass_instr_fc)g_armv7_processor_disassemble;
}
@@ -131,6 +136,7 @@ static void g_armv7_processor_class_init(GArmV7ProcessorClass *klass)
static void g_armv7_processor_init(GArmV7Processor *proc)
{
+ G_ARCH_PROCESSOR(proc)->endianness = SRE_LITTLE;
}
@@ -221,6 +227,75 @@ static char *g_armv7_processor_get_key(const GArmV7Processor *proc)
/******************************************************************************
* *
+* Paramètres : proc = processeur d'architecture à consulter. *
+* *
+* Description : Fournit le nom humain de l'architecture visée. *
+* *
+* Retour : Désignation humaine associée au processeur. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static char *g_armv7_processor_get_desc(const GArmV7Processor *proc)
+{
+ char *result; /* Désignation à renvoyer */
+
+ result = strdup("ARM v7");
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : proc = processeur d'architecture à consulter. *
+* *
+* Description : Fournit la taille de l'espace mémoire d'une architecture. *
+* *
+* Retour : Taille de l'espace mémoire. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static MemoryDataSize g_armv7_processor_get_memory_size(const GArmV7Processor *proc)
+{
+ MemoryDataSize result; /* Taille à retourner */
+
+ result = MDS_32_BITS;
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : proc = processeur d'architecture à consulter. *
+* *
+* Description : Fournit la taille min. des instructions d'une architecture. *
+* *
+* Retour : Taille d'encodage des instructions. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static MemoryDataSize g_armv7_processor_get_instruction_min_size(const GArmV7Processor *proc)
+{
+ MemoryDataSize result; /* Taille à retourner */
+
+ result = MDS_32_BITS;
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : proc = architecture, spectatrice ici. *
* *
* Description : Fournit un contexte pour l'exécution du processeur Arm. *
@@ -262,7 +337,7 @@ static GArchInstruction *g_armv7_processor_disassemble(const GArmV7Processor *pr
uint32_t raw32; /* Donnée 32 bits à analyser */
ArmV7InstrSet iset; /* Type de jeu d'instructions */
- endian = G_ARCH_PROCESSOR_GET_CLASS(proc)->endianness;
+ endian = G_ARCH_PROCESSOR(proc)->endianness;
iset = g_armv7_context_find_encoding(ctx, get_virt_addr(pos));