summaryrefslogtreecommitdiff
path: root/src/arch/arm
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/arm')
-rw-r--r--src/arch/arm/v7/processor.c31
1 files changed, 12 insertions, 19 deletions
diff --git a/src/arch/arm/v7/processor.c b/src/arch/arm/v7/processor.c
index 9117861..7a1dd5a 100644
--- a/src/arch/arm/v7/processor.c
+++ b/src/arch/arm/v7/processor.c
@@ -68,7 +68,7 @@ static void g_armv7_processor_finalize(GArmV7Processor *);
static GArmV7Context *g_armv7_processor_get_context(const GArmV7Processor *);
/* Décode une instruction dans un flux de données. */
-static GArchInstruction *g_armv7_processor_disassemble(const GArmV7Processor *, GArmV7Context *, const bin_t *, vmpa2t *, phys_t);
+static GArchInstruction *g_armv7_processor_disassemble(const GArmV7Processor *, GArmV7Context *, const GBinContent *, vmpa2t *);
@@ -218,11 +218,10 @@ static GArmV7Context *g_armv7_processor_get_context(const GArmV7Processor *proc)
/******************************************************************************
* *
-* Paramètres : proc = architecture visée par la procédure. *
-* ctx = contexte lié à l'exécution du processeur. *
-* data = flux de données à analyser. *
-* pos = position courante dans ce flux. [OUT] *
-* end = limite des données à analyser. *
+* Paramètres : proc = architecture visée par la procédure. *
+* ctx = contexte lié à l'exécution du processeur. *
+* content = flux de données à analyser. *
+* pos = position courante dans ce flux. [OUT] *
* *
* Description : Désassemble une instruction dans un flux de données. *
* *
@@ -232,26 +231,23 @@ static GArmV7Context *g_armv7_processor_get_context(const GArmV7Processor *proc)
* *
******************************************************************************/
-static GArchInstruction *g_armv7_processor_disassemble(const GArmV7Processor *proc, GArmV7Context *ctx, const bin_t *data, vmpa2t *pos, phys_t end)
+static GArchInstruction *g_armv7_processor_disassemble(const GArmV7Processor *proc, GArmV7Context *ctx, const GBinContent *content, vmpa2t *pos)
{
GArchInstruction *result; /* Instruction à renvoyer */
- phys_t start; /* Point de départ de lecture */
- phys_t diff; /* Avancée dans la lecture */
+ SourceEndian endian; /* Boutisme des données lues */
uint16_t raw16; /* Donnée 16 bits à analyser */
uint32_t raw32; /* Donnée 32 bits à analyser */
ArmV7InstrSet iset; /* Type de jeu d'instructions */
- iset = g_armv7_context_find_encoding(ctx, get_virt_addr(pos));
-
- start = get_phy_addr(pos);
+ endian = G_ARCH_PROCESSOR(proc)->endianness;
- diff = 4;
+ iset = g_armv7_context_find_encoding(ctx, get_virt_addr(pos));
switch (iset)
{
case AV7IS_ARM:
- if (!read_u32(&raw32, data, &start, end, G_ARCH_PROCESSOR(proc)->endianness))
+ if (!g_binary_content_read_u32(content, pos, endian, &raw32))
return NULL;
result = process_armv7_arm_instruction_set_encoding(raw32);
@@ -260,7 +256,7 @@ static GArchInstruction *g_armv7_processor_disassemble(const GArmV7Processor *pr
case AV7IS_THUMB:
- if (!read_u16(&raw16, data, &start, end, G_ARCH_PROCESSOR(proc)->endianness))
+ if (!g_binary_content_read_u16(content, pos, endian, &raw16))
return NULL;
switch (raw16 >> 11)
@@ -271,7 +267,7 @@ static GArchInstruction *g_armv7_processor_disassemble(const GArmV7Processor *pr
raw32 = raw16 << 16;
- if (!read_u16(&raw16, data, &start, end, G_ARCH_PROCESSOR(proc)->endianness))
+ if (!g_binary_content_read_u16(content, pos, endian, &raw16))
return NULL;
raw32 |= raw16;
@@ -280,7 +276,6 @@ static GArchInstruction *g_armv7_processor_disassemble(const GArmV7Processor *pr
break;
default:
- diff = 2;
result = process_armv7_thumb_16_instruction_set_encoding(raw16);
break;
@@ -294,8 +289,6 @@ static GArchInstruction *g_armv7_processor_disassemble(const GArmV7Processor *pr
}
- if (result != NULL)
- advance_vmpa(pos, diff);
/*
else
result = g_raw_instruction_new_array_old(data, MDS_32_BITS, 1, pos, end,