summaryrefslogtreecommitdiff
path: root/src/arch/operand.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2008-10-19 15:05:04 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2008-10-19 15:05:04 (GMT)
commit10deb6bbbeeaacfec577f5b24c5f821492af77f3 (patch)
tree9db0a1679c518f6a95cdb25e38c7a281b8ea30c1 /src/arch/operand.c
parent43f740ee35b452980e8d190660896a535816dfc3 (diff)
Registered symbols found in the PLT.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@35 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/arch/operand.c')
-rw-r--r--src/arch/operand.c118
1 files changed, 118 insertions, 0 deletions
diff --git a/src/arch/operand.c b/src/arch/operand.c
index 53e652c..fa43416 100644
--- a/src/arch/operand.c
+++ b/src/arch/operand.c
@@ -367,6 +367,124 @@ bool fill_relimm_operand(asm_operand *operand, AsmOperandSize size, const uint8_
/******************************************************************************
* *
+* Paramètres : operand = structure dont le contenu est à définir. *
+* size = taille de l'opérande souhaitée. *
+* ... = zone d'enregistrement prévue. *
+* *
+* Description : Récupère la valeur d'une opérande sur x bits. *
+* *
+* Retour : true si l'opération s'est effectuée avec succès, false sinon.*
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool get_imm_operand_value(asm_operand *operand, AsmOperandSize size, ...)
+{
+ bool result; /* Bilan à retourner */
+ va_list ap; /* Récupération d'argument */
+ uint8_t *val8; /* Valeur sur 8 bits */
+ uint16_t *val16; /* Valeur sur 16 bits */
+ uint32_t *val32; /* Valeur sur 32 bits */
+ uint64_t *val64; /* Valeur sur 64 bits */
+
+ result = true;
+
+ va_start(ap, size);
+
+ switch (size)
+ {
+ case AOS_8_BITS:
+ val8 = va_arg(ap, uint8_t *);
+ switch (operand->size)
+ {
+ case AOS_8_BITS:
+ *val8 = operand->value.val8;
+ break;
+ case AOS_16_BITS:
+ result = false;
+ break;
+ case AOS_32_BITS:
+ result = false;
+ break;
+ case AOS_64_BITS:
+ result = false;
+ break;
+ }
+ break;
+
+ case AOS_16_BITS:
+ val16 = va_arg(ap, uint16_t *);
+ switch (operand->size)
+ {
+ case AOS_8_BITS:
+ *val16 = operand->value.val8;
+ break;
+ case AOS_16_BITS:
+ *val16 = operand->value.val16;
+ break;
+ case AOS_32_BITS:
+ result = false;
+ break;
+ case AOS_64_BITS:
+ result = false;
+ break;
+ }
+ break;
+
+ case AOS_32_BITS:
+ val32 = va_arg(ap, uint32_t *);
+ switch (operand->size)
+ {
+ case AOS_8_BITS:
+ *val32 = operand->value.val8;
+ break;
+ case AOS_16_BITS:
+ *val32 = operand->value.val16;
+ break;
+ case AOS_32_BITS:
+ *val32 = operand->value.val32;
+ break;
+ case AOS_64_BITS:
+ result = false;
+ break;
+ }
+ break;
+
+ case AOS_64_BITS:
+ val64 = va_arg(ap, uint64_t *);
+ switch (operand->size)
+ {
+ case AOS_8_BITS:
+ *val64 = operand->value.val8;
+ break;
+ case AOS_16_BITS:
+ *val64 = operand->value.val16;
+ break;
+ case AOS_32_BITS:
+ *val64 = operand->value.val32;
+ break;
+ case AOS_64_BITS:
+ *val64 = operand->value.val64;
+ break;
+ }
+ break;
+
+ default:
+ result = false;
+ break;
+
+ }
+
+ va_end(ap);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : operand = instruction à traiter. *
* buffer = tampon de sortie mis à disposition. [OUT] *
* len = taille de ce tampon. *