summaryrefslogtreecommitdiff
path: root/src/arch/arm/v7/instruction.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/arm/v7/instruction.c')
-rw-r--r--src/arch/arm/v7/instruction.c51
1 files changed, 45 insertions, 6 deletions
diff --git a/src/arch/arm/v7/instruction.c b/src/arch/arm/v7/instruction.c
index d485dbc..0fba9cb 100644
--- a/src/arch/arm/v7/instruction.c
+++ b/src/arch/arm/v7/instruction.c
@@ -24,6 +24,12 @@
#include "instruction.h"
+#include <assert.h>
+#ifndef NDEBUG
+# include <string.h>
+#endif
+
+
#include "../instruction-int.h"
@@ -33,6 +39,8 @@ struct _GArmV7Instruction
{
GArmInstruction parent; /* Instance parente */
+ char encoding; /* Encodage de l'instruction */
+
bool setflags; /* Mise à jour des drapeaux */
};
@@ -190,14 +198,22 @@ GArchInstruction *g_armv7_instruction_new(const char *keyword)
static const char *g_armv7_instruction_get_encoding(const GArmV7Instruction *instr)
{
const char *result; /* Description à retourner */
- const char *raw; /* Description brute d'origine */
- raw = G_ARCH_INSTRUCTION(instr)->encoding;
+ switch (instr->encoding)
+ {
+ case 't':
+ result = "Thumb/16";
+ break;
- if (raw[0] == 'T' || raw[0] == 't')
- result = "Thumb";
- else
- result = "ARM";
+ case 'T':
+ result = "Thumb/32";
+ break;
+
+ default:
+ result = "ARM";
+ break;
+
+ }
return result;
@@ -206,6 +222,29 @@ static const char *g_armv7_instruction_get_encoding(const GArmV7Instruction *ins
/******************************************************************************
* *
+* Paramètres : instr = instruction quelconque à modifier. *
+* encoding = encodage de l'instruction. *
+* *
+* Description : Précise l'encodage d'une instruction ARMv7 dans le détail. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void g_armv7_instruction_set_encoding(GArmV7Instruction *instr, const char *encoding)
+{
+ assert(strlen(encoding) == 1);
+ assert(encoding[0] == 'A' || encoding[0] == 'T' || encoding[0] == 't');
+
+ instr->encoding = encoding[0];
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : instr = instruction ARMv7 à mettre à jour. *
* set = statut à enregistrer. *
* *