summaryrefslogtreecommitdiff
path: root/src/arch/dalvik/operand.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2012-03-05 00:17:30 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2012-03-05 00:17:30 (GMT)
commit13bd8d546b2de76b1f5a1d758c9e476f7d859f39 (patch)
tree3d1c7dc3343ad4d460a9245bd2bb138fada611b3 /src/arch/dalvik/operand.c
parentaba1a14ba28f6df51b3be15648b6f55eea4a0e19 (diff)
Printed the string values of the Dex pool in the operand rendering.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@237 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/arch/dalvik/operand.c')
-rw-r--r--src/arch/dalvik/operand.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/src/arch/dalvik/operand.c b/src/arch/dalvik/operand.c
index 65efd31..a48a5ce 100644
--- a/src/arch/dalvik/operand.c
+++ b/src/arch/dalvik/operand.c
@@ -2,7 +2,7 @@
/* OpenIDA - Outil d'analyse de fichiers binaires
* operand.c - aide à la création d'opérandes Dalvik
*
- * Copyright (C) 2010-2011 Cyrille Bagard
+ * Copyright (C) 2010-2012 Cyrille Bagard
*
* This file is part of OpenIDA.
*
@@ -56,19 +56,20 @@ typedef enum _DalvikOperandID
/* Procède à la lecture d'opérandes pour une instruction. */
-static bool dalvik_read_basic_operands(GArchInstruction *, const bin_t *, off_t *, off_t, bool *, SourceEndian, DalvikOperandType, va_list);
+static bool dalvik_read_basic_operands(GArchInstruction *, const GDexFormat *, const bin_t *, off_t *, off_t, bool *, SourceEndian, DalvikOperandType, va_list);
/* Procède à la lecture d'opérandes pour une instruction. */
-static bool dalvik_read_fixed_operands(GArchInstruction *, const bin_t *, off_t *, off_t, bool *, SourceEndian, DalvikOperandType);
+static bool dalvik_read_fixed_operands(GArchInstruction *, const GDexFormat *, const bin_t *, off_t *, off_t, bool *, SourceEndian, DalvikOperandType);
/* Procède à la lecture d'opérandes pour une instruction. */
-static bool dalvik_read_variatic_operands(GArchInstruction *, const bin_t *, off_t *, off_t, bool *, SourceEndian, DalvikOperandType);
+static bool dalvik_read_variatic_operands(GArchInstruction *, const GDexFormat *, const bin_t *, off_t *, off_t, bool *, SourceEndian, DalvikOperandType);
/******************************************************************************
* *
* Paramètres : instr = instruction dont la définition est incomplète. [OUT]*
+* format = format du fichier contenant le code. *
* data = flux de données à analyser. *
* pos = position courante dans ce flux. [OUT] *
* len = taille totale des données à analyser. *
@@ -85,7 +86,7 @@ static bool dalvik_read_variatic_operands(GArchInstruction *, const bin_t *, off
* *
******************************************************************************/
-static bool dalvik_read_basic_operands(GArchInstruction *instr, const bin_t *data, off_t *pos, off_t len, bool *low, SourceEndian endian, DalvikOperandType model, va_list ap)
+static bool dalvik_read_basic_operands(GArchInstruction *instr, const GDexFormat *format, const bin_t *data, off_t *pos, off_t len, bool *low, SourceEndian endian, DalvikOperandType model, va_list ap)
{
bool result; /* Bilan à retourner */
DalvikOperandID *types; /* Liste des chargements */
@@ -313,11 +314,11 @@ static bool dalvik_read_basic_operands(GArchInstruction *instr, const bin_t *dat
break;
case DOI_POOL_CONST:
- op = g_dalvik_pool_operand_new(DALVIK_OP_GET_POOL(model), data, pos, len, MDS_16_BITS, endian);
+ op = g_dalvik_pool_operand_new(format, DALVIK_OP_GET_POOL(model), data, pos, len, MDS_16_BITS, endian);
break;
case DOI_POOL_CONST_WIDE:
- op = g_dalvik_pool_operand_new(DALVIK_OP_GET_POOL(model), data, pos, len, MDS_32_BITS, endian);
+ op = g_dalvik_pool_operand_new(format, DALVIK_OP_GET_POOL(model), data, pos, len, MDS_32_BITS, endian);
break;
case DOI_TARGET_8:
@@ -351,6 +352,7 @@ static bool dalvik_read_basic_operands(GArchInstruction *instr, const bin_t *dat
/******************************************************************************
* *
* Paramètres : instr = instruction dont la définition est incomplète. [OUT]*
+* format = format du fichier contenant le code. *
* data = flux de données à analyser. *
* pos = position courante dans ce flux. [OUT] *
* len = taille totale des données à analyser. *
@@ -366,7 +368,7 @@ static bool dalvik_read_basic_operands(GArchInstruction *instr, const bin_t *dat
* *
******************************************************************************/
-static bool dalvik_read_fixed_operands(GArchInstruction *instr, const bin_t *data, off_t *pos, off_t len, bool *low, SourceEndian endian, DalvikOperandType model)
+static bool dalvik_read_fixed_operands(GArchInstruction *instr, const GDexFormat *format, const bin_t *data, off_t *pos, off_t len, bool *low, SourceEndian endian, DalvikOperandType model)
{
GArchOperand *opa; /* Opérande vA décodé */
uint8_t b; /* Nbre. de registres utilisés */
@@ -384,7 +386,7 @@ static bool dalvik_read_fixed_operands(GArchInstruction *instr, const bin_t *dat
goto err_va;
- target1 = g_dalvik_pool_operand_new(DALVIK_OP_GET_POOL(model), data, pos, len, MDS_16_BITS, endian);
+ target1 = g_dalvik_pool_operand_new(format, DALVIK_OP_GET_POOL(model), data, pos, len, MDS_16_BITS, endian);
if (target1 == NULL) goto err_target1;
@@ -448,6 +450,7 @@ static bool dalvik_read_fixed_operands(GArchInstruction *instr, const bin_t *dat
/******************************************************************************
* *
* Paramètres : instr = instruction dont la définition est incomplète. [OUT]*
+* format = format du fichier contenant le code. *
* data = flux de données à analyser. *
* pos = position courante dans ce flux. [OUT] *
* len = taille totale des données à analyser. *
@@ -463,7 +466,7 @@ static bool dalvik_read_fixed_operands(GArchInstruction *instr, const bin_t *dat
* *
******************************************************************************/
-static bool dalvik_read_variatic_operands(GArchInstruction *instr, const bin_t *data, off_t *pos, off_t len, bool *low, SourceEndian endian, DalvikOperandType model)
+static bool dalvik_read_variatic_operands(GArchInstruction *instr, const GDexFormat *format, const bin_t *data, off_t *pos, off_t len, bool *low, SourceEndian endian, DalvikOperandType model)
{
uint8_t a; /* Nbre. de registres utilisés */
uint16_t b; /* Indice dans la table const. */
@@ -479,7 +482,7 @@ static bool dalvik_read_variatic_operands(GArchInstruction *instr, const bin_t *
if (!read_u16(&b, data, pos, len, endian))
return false;
- target = g_dalvik_pool_operand_new(DALVIK_OP_GET_POOL(model), data, pos, len, MDS_16_BITS, endian);
+ target = g_dalvik_pool_operand_new(format, DALVIK_OP_GET_POOL(model), data, pos, len, MDS_16_BITS, endian);
if (target == NULL) return false;
/* Mise en place des arguments */
@@ -528,6 +531,7 @@ static bool dalvik_read_variatic_operands(GArchInstruction *instr, const bin_t *
/******************************************************************************
* *
* Paramètres : instr = instruction dont la définition est incomplète. [OUT]*
+* format = format du fichier contenant le code. *
* data = flux de données à analyser. *
* pos = position courante dans ce flux. [OUT] *
* len = taille totale des données à analyser. *
@@ -543,7 +547,7 @@ static bool dalvik_read_variatic_operands(GArchInstruction *instr, const bin_t *
* *
******************************************************************************/
-bool dalvik_read_operands(GArchInstruction *instr, const bin_t *data, off_t *pos, off_t len, SourceEndian endian, DalvikOperandType model, ...)
+bool dalvik_read_operands(GArchInstruction *instr, const GDexFormat *format, const bin_t *data, off_t *pos, off_t len, SourceEndian endian, DalvikOperandType model, ...)
{
bool result; /* Bilan à retourner */
@@ -589,18 +593,18 @@ bool dalvik_read_operands(GArchInstruction *instr, const bin_t *data, off_t *pos
case DALVIK_OPT_31T:
case DALVIK_OPT_51L:
va_start(ap, model);
- result = dalvik_read_basic_operands(instr, data, pos, len, &low, endian, model, ap);
+ result = dalvik_read_basic_operands(instr, format, data, pos, len, &low, endian, model, ap);
va_end(ap);
break;
case DALVIK_OPT_35C:
- result = dalvik_read_fixed_operands(instr, data, pos, len, &low, endian, model);
+ result = dalvik_read_fixed_operands(instr, format, data, pos, len, &low, endian, model);
break;
case DALVIK_OPT_3RC:
case DALVIK_OPT_3RMS:
case DALVIK_OPT_3RFS:
- result = dalvik_read_variatic_operands(instr, data, pos, len, &low, endian, model);
+ result = dalvik_read_variatic_operands(instr, format, data, pos, len, &low, endian, model);
break;
default: