diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2016-02-10 10:02:16 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2016-02-10 10:02:16 (GMT) |
commit | 465488d5b231c2552116a305c48b5fcccea55a09 (patch) | |
tree | f4d072ad9cf56466f4e55d0608f7a3fe9204efaf /src/arch/dalvik/operands | |
parent | 946f5f093c7265dc5a5e00694325605b249eea43 (diff) |
Improved the support of the DEX format.
Diffstat (limited to 'src/arch/dalvik/operands')
-rw-r--r-- | src/arch/dalvik/operands/target.c | 17 | ||||
-rw-r--r-- | src/arch/dalvik/operands/target.h | 2 |
2 files changed, 11 insertions, 8 deletions
diff --git a/src/arch/dalvik/operands/target.c b/src/arch/dalvik/operands/target.c index 42d09cf..5e8b91a 100644 --- a/src/arch/dalvik/operands/target.c +++ b/src/arch/dalvik/operands/target.c @@ -169,31 +169,34 @@ static void g_dalvik_target_operand_finalize(GDalvikTargetOperand *operand) * * ******************************************************************************/ -GArchOperand *g_dalvik_target_operand_new(const GBinContent *content, vmpa2t *pos, MemoryDataSize size, SourceEndian endian, vmpa_t base) +GArchOperand *g_dalvik_target_operand_new(const GBinContent *content, vmpa2t *pos, MemoryDataSize size, SourceEndian endian, const vmpa2t *base) { GDalvikTargetOperand *result; /* Structure à retourner */ + phys_t offset; /* Emplacement de base */ int8_t val8; /* Valeur sur 8 bits */ int16_t val16; /* Valeur sur 16 bits */ int32_t val32; /* Valeur sur 32 bits */ bool test; /* Bilan de lecture */ - vmpa_t address; /* Adresse finale visée */ + phys_t address; /* Adresse finale visée */ + + offset = get_phy_addr(base); switch (size) { case MDS_8_BITS_SIGNED: test = g_binary_content_read_s8(content, pos, &val8); - address = base + val8 * sizeof(uint16_t); + address = offset + val8 * sizeof(uint16_t); break; case MDS_16_BITS_SIGNED: test = g_binary_content_read_s16(content, pos, endian, &val16); - address = base + val16 * sizeof(uint16_t); + address = offset + val16 * sizeof(uint16_t); break; case MDS_32_BITS_SIGNED: test = g_binary_content_read_s32(content, pos, endian, &val32); - address = base + val32 * sizeof(uint16_t); + address = offset + val32 * sizeof(uint16_t); break; default: - return NULL; + test = false; break; } @@ -201,7 +204,7 @@ GArchOperand *g_dalvik_target_operand_new(const GBinContent *content, vmpa2t *po return NULL; result = g_object_new(G_TYPE_DALVIK_TARGET_OPERAND, NULL); - result->immediate = G_IMM_OPERAND(g_imm_operand_new_from_value(MDS_32_BITS/*FIXME*/, (uint32_t)address/* FIXME */)); + result->immediate = G_IMM_OPERAND(g_imm_operand_new_from_value(MDS_32_BITS, address)); return G_ARCH_OPERAND(result); diff --git a/src/arch/dalvik/operands/target.h b/src/arch/dalvik/operands/target.h index cb0e9f1..6328546 100644 --- a/src/arch/dalvik/operands/target.h +++ b/src/arch/dalvik/operands/target.h @@ -51,7 +51,7 @@ typedef struct _GDalvikTargetOperandClass GDalvikTargetOperandClass; GType g_dalvik_target_operand_get_type(void); /* Crée un opérande visant un instruction Dalvik. */ -GArchOperand *g_dalvik_target_operand_new(const GBinContent *, vmpa2t *, MemoryDataSize, SourceEndian, vmpa_t); +GArchOperand *g_dalvik_target_operand_new(const GBinContent *, vmpa2t *, MemoryDataSize, SourceEndian, const vmpa2t *); /* Fournit l'adresse représentée par une opérande Dalvik. */ const GImmOperand *g_dalvik_target_operand_get_value(const GDalvikTargetOperand *); |