summaryrefslogtreecommitdiff
path: root/src/arch/arm/instruction.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2016-05-25 21:29:53 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2016-05-25 21:29:53 (GMT)
commit1878e3ab82d8711f305e7b8bbc43c5ed21bf140b (patch)
tree5e39f6ae522ba9968e5a91e2ecda6980fc655145 /src/arch/arm/instruction.c
parent1b524ce0e645e451ca76723f4f86fe2a71c1adf2 (diff)
Applied conditional bits as keyword suffixes for ARM instructions.
Diffstat (limited to 'src/arch/arm/instruction.c')
-rw-r--r--src/arch/arm/instruction.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/src/arch/arm/instruction.c b/src/arch/arm/instruction.c
index 47c9b4b..2c1f3b8 100644
--- a/src/arch/arm/instruction.c
+++ b/src/arch/arm/instruction.c
@@ -155,12 +155,16 @@ static void g_arm_instruction_build_keyword(const GArmInstruction *instr, AsmSyn
{
GArchInstruction *base; /* Instruction, vue générique */
+ /* FIXME : tout bouger dans la base des instructions ? */
+
base = G_ARCH_INSTRUCTION(instr);
base->cached_keyword = strdup(instr->keyword);
+ /*
if (base->suffix != NULL)
base->cached_keyword = stradd(base->cached_keyword, base->suffix);
+ */
}
@@ -180,9 +184,38 @@ static void g_arm_instruction_build_keyword(const GArmInstruction *instr, AsmSyn
bool g_arm_instruction_set_cond(GArmInstruction *instr, ArmCondCode cond)
{
+ bool result; /* Bilan à retourner */
+ const char *suffix; /* Eventuelle marque à ajouter */
+
instr->cond = cond;
- return true;
+ switch (cond)
+ {
+ case ACC_EQ: suffix = "eq"; break;
+ case ACC_NE: suffix = "ne"; break;
+ case ACC_HS: suffix = "hs"; break;
+ case ACC_LO: suffix = "lo"; break;
+ case ACC_MI: suffix = "mi"; break;
+ case ACC_PL: suffix = "pl"; break;
+ case ACC_VS: suffix = "vs"; break;
+ case ACC_VC: suffix = "vc"; break;
+ case ACC_HI: suffix = "hi"; break;
+ case ACC_LS: suffix = "ls"; break;
+ case ACC_GE: suffix = "ge"; break;
+ case ACC_LT: suffix = "lt"; break;
+ case ACC_GT: suffix = "gt"; break;
+ case ACC_LE: suffix = "le"; break;
+ case ACC_AL: suffix = NULL; break;
+ case ACC_NV: suffix = "nv"; break;
+ }
+
+ if (suffix != NULL)
+ result = g_arch_instruction_extend_keyword(G_ARCH_INSTRUCTION(instr), suffix);
+
+ else
+ result = true;
+
+ return result;
}