summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-11-13 21:42:10 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-11-13 21:42:10 (GMT)
commit23bc425f9c35c31a80d65d824452c8728614a206 (patch)
tree71b1c9762fee17f85648bf210a88adad5ab60052 /src
parent65e12afde4bd9cd32e206f874cfa378708248918 (diff)
Exported extra processor features.
Diffstat (limited to 'src')
-rw-r--r--src/analysis/disass/area.c26
-rw-r--r--src/arch/processor.c4
-rw-r--r--src/arch/processor.h2
3 files changed, 28 insertions, 4 deletions
diff --git a/src/analysis/disass/area.c b/src/analysis/disass/area.c
index 2dca001..0a82b99 100644
--- a/src/analysis/disass/area.c
+++ b/src/analysis/disass/area.c
@@ -286,7 +286,31 @@ static void init_mem_area_from_addr(mem_area *area, const vmpa2t *addr, phys_t l
area->content = g_restricted_content_new(content, &area->range);
- area->packing_size = 2; /* FIXME */
+ switch (g_arch_processor_get_instruction_min_size(area->proc))
+ {
+ case MDS_4_BITS:
+ case MDS_8_BITS:
+ area->packing_size = 1;
+ break;
+
+ case MDS_16_BITS:
+ area->packing_size = 2;
+ break;
+
+ case MDS_32_BITS:
+ area->packing_size = 4;
+ break;
+
+ case MDS_64_BITS:
+ area->packing_size = 8;
+ break;
+
+ default:
+ assert(false);
+ area->packing_size = 1;
+ break;
+
+ }
area->processed = create_bit_field(len, false);
area->instructions = (GArchInstruction **)calloc(len, sizeof(GArchInstruction *));
diff --git a/src/arch/processor.c b/src/arch/processor.c
index 06f9c2f..4450208 100644
--- a/src/arch/processor.c
+++ b/src/arch/processor.c
@@ -297,13 +297,13 @@ MemoryDataSize g_arch_processor_get_memory_size(const GArchProcessor *proc)
* *
* Description : Fournit la taille min. des instructions d'une architecture. *
* *
-* Retour : Taille d'encodage des instructions *
+* Retour : Taille d'encodage des instructions. *
* *
* Remarques : - *
* *
******************************************************************************/
-MemoryDataSize g_arch_processor_get_instruction_size(const GArchProcessor *proc)
+MemoryDataSize g_arch_processor_get_instruction_min_size(const GArchProcessor *proc)
{
return proc->inssize;
diff --git a/src/arch/processor.h b/src/arch/processor.h
index 762d547..24d9287 100644
--- a/src/arch/processor.h
+++ b/src/arch/processor.h
@@ -65,7 +65,7 @@ SourceEndian g_arch_processor_get_endianness(const GArchProcessor *);
MemoryDataSize g_arch_processor_get_memory_size(const GArchProcessor *);
/* Fournit la taille min. des instructions d'une architecture. */
-MemoryDataSize g_arch_processor_get_instruction_size(const GArchProcessor *);
+MemoryDataSize g_arch_processor_get_instruction_min_size(const GArchProcessor *);
/* Indique si l'architecture possède un espace virtuel ou non. */
bool g_arch_processor_has_virtual_space(const GArchProcessor *);