summaryrefslogtreecommitdiff
path: root/src/arch/immediate.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2013-06-30 13:01:38 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2013-06-30 13:01:38 (GMT)
commite5314b83cf2521f4a1fee5d3cbb5011d7ac7bff7 (patch)
tree3af6d5b430d3a07753e273e9ddb1ff656e706661 /src/arch/immediate.c
parent0f3bbcb376ee4f76142ac4ddf729403fecac2641 (diff)
Provided first basic support for a few ARM instructions.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@354 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/arch/immediate.c')
-rw-r--r--src/arch/immediate.c60
1 files changed, 59 insertions, 1 deletions
diff --git a/src/arch/immediate.c b/src/arch/immediate.c
index 19c86b2..4f94be3 100644
--- a/src/arch/immediate.c
+++ b/src/arch/immediate.c
@@ -359,7 +359,7 @@ bool g_imm_operand_does_padding(const GImmOperand *operand)
/******************************************************************************
* *
-* Paramètres : operand = structure dont le contenu est à définir. *
+* Paramètres : operand = structure dont le contenu est à consulter. *
* *
* Description : Indique le signe d'une valeur immédiate. *
* *
@@ -402,6 +402,64 @@ bool g_imm_operand_is_negative(const GImmOperand *operand)
/******************************************************************************
* *
+* Paramètres : operand = structure dont le contenu est à consulter. *
+* *
+* Description : Indique si une valeur immédiate est nulle ou non. *
+* *
+* Retour : true si la valeur est nulle, false sinon. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool g_imm_operand_is_null(const GImmOperand *operand)
+{
+ bool result; /* Bilan à renvoyer */
+
+ switch (operand->size)
+ {
+ case MDS_4_BITS_SIGNED:
+ result = !(operand->signed_imm.val8 & 0x0f);
+ break;
+ case MDS_4_BITS_UNSIGNED:
+ result = !(operand->unsigned_imm.val8 & 0x0f);
+ break;
+ case MDS_8_BITS_SIGNED:
+ result = !(operand->signed_imm.val8 & 0xff);
+ break;
+ case MDS_8_BITS_UNSIGNED:
+ result = !(operand->unsigned_imm.val8 & 0xff);
+ break;
+ case MDS_16_BITS_SIGNED:
+ result = !(operand->signed_imm.val16 & 0xffff);
+ break;
+ case MDS_16_BITS_UNSIGNED:
+ result = !(operand->unsigned_imm.val16 & 0xffff);
+ break;
+ case MDS_32_BITS_SIGNED:
+ result = !(operand->signed_imm.val32 & 0xffffffff);
+ break;
+ case MDS_32_BITS_UNSIGNED:
+ result = !(operand->unsigned_imm.val32 & 0xffffffff);
+ break;
+ case MDS_64_BITS_SIGNED:
+ result = !(operand->signed_imm.val64 & 0xffffffffffffffffll);
+ break;
+ case MDS_64_BITS_UNSIGNED:
+ result = !(operand->unsigned_imm.val64 & 0xffffffffffffffffll);
+ break;
+ default:
+ result = false;
+ break;
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : operand = opérande à transcrire. *
* syntax = type de représentation demandée. *
* value = valeur portée par l'opérande transcrite. [OUT] *