summaryrefslogtreecommitdiff
path: root/src/arch/raw.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2015-01-30 23:37:39 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2015-01-30 23:37:39 (GMT)
commitd246c98c515cb44c5bc4c742a674bae2e824872b (patch)
tree2ea1ec27ae5fba761ee778ba4ddb85c7752ebbf5 /src/arch/raw.c
parent262c95e0b088a56e9fd919edc57ad19f85e2e40e (diff)
Bound a symbol for each loaded value for 'ldr' instructions.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@462 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/arch/raw.c')
-rw-r--r--src/arch/raw.c70
1 files changed, 70 insertions, 0 deletions
diff --git a/src/arch/raw.c b/src/arch/raw.c
index e76d75d..62c88c1 100644
--- a/src/arch/raw.c
+++ b/src/arch/raw.c
@@ -169,6 +169,76 @@ static void g_raw_instruction_finalize(GRawInstruction *instr)
/******************************************************************************
* *
+* Paramètres : addr = position à associer à l'instruction. *
+* size = taille de l'opérande souhaitée. *
+* value = valeur sur x bits à venir récupérer. *
+* *
+* Description : Crée une instruction de type 'db/dw/etc' simple. *
+* *
+* Retour : Instruction mise en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *g_raw_instruction_new_from_value(const vmpa2t *addr, MemoryDataSize size, uint64_t value)
+{
+ GArchInstruction *result; /* Instruction à retourner */
+ GArchOperand *operand; /* Octet non décodé à afficher */
+ mrange_t range; /* Couverture de l'instruction */
+
+ result = g_object_new(G_TYPE_RAW_INSTRUCTION, NULL);
+
+ operand = g_imm_operand_new_from_value(size, value);
+ if (operand == NULL) goto grinfv_error;
+
+ g_imm_operand_pad(G_IMM_OPERAND(operand), true);
+
+ g_arch_instruction_attach_extra_operand(result, operand);
+
+ switch (size)
+ {
+ case MDS_8_BITS_UNSIGNED:
+ case MDS_8_BITS_SIGNED:
+ init_mrange(&range, addr, 1);
+ break;
+
+ case MDS_16_BITS_UNSIGNED:
+ case MDS_16_BITS_SIGNED:
+ init_mrange(&range, addr, 2);
+ break;
+
+ case MDS_32_BITS_UNSIGNED:
+ case MDS_32_BITS_SIGNED:
+ init_mrange(&range, addr, 4);
+ break;
+
+ case MDS_64_BITS_UNSIGNED:
+ case MDS_64_BITS_SIGNED:
+ init_mrange(&range, addr, 8);
+ break;
+
+ default:
+ goto grinfv_error;
+ break;
+
+ }
+
+ g_arch_instruction_set_range(result, &range);
+
+ return result;
+
+ grinfv_error:
+
+ g_object_unref(G_OBJECT(result));
+
+ return NULL;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : data = flux de données à analyser. *
* size = taille de chacun des éléments à représenter. *
* count = nombre de ces éléments. *