summaryrefslogtreecommitdiff
path: root/src/arch/arm
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/arm')
-rw-r--r--src/arch/arm/cond.h12
-rw-r--r--src/arch/arm/instruction.c35
2 files changed, 40 insertions, 7 deletions
diff --git a/src/arch/arm/cond.h b/src/arch/arm/cond.h
index 942c243..faa0727 100644
--- a/src/arch/arm/cond.h
+++ b/src/arch/arm/cond.h
@@ -43,12 +43,12 @@ typedef enum _ArmCondCode
ACC_EQ = 0x0, /* Equal */
ACC_NE = 0x1, /* Not equal */
ACC_HS = 0x2, /* Unsigned higher or same */
- ACC_LO = 0x2, /* Unsigned lower */
- ACC_MI = 0x3, /* Minus */
- ACC_PL = 0x4, /* Plus or zero */
- ACC_VS = 0x5, /* Overflow set */
- ACC_VC = 0x6, /* Overflow clear */
- ACC_HI = 0x7, /* Unsigned higher */
+ ACC_LO = 0x3, /* Unsigned lower */
+ ACC_MI = 0x4, /* Minus */
+ ACC_PL = 0x5, /* Plus or zero */
+ ACC_VS = 0x6, /* Overflow set */
+ ACC_VC = 0x7, /* Overflow clear */
+ ACC_HI = 0x8, /* Unsigned higher */
ACC_LS = 0x9, /* Unsigned lower or same */
ACC_GE = 0xa, /* Signed greater than or equal*/
ACC_LT = 0xb, /* Signed less than */
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;
}