summaryrefslogtreecommitdiff
path: root/src/arch/arm/v7
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2016-10-29 11:37:13 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2016-10-29 11:37:13 (GMT)
commit38e455ebbbbf90ddbf552f95a1dfb3c544907587 (patch)
treec6e2a4763baef01c87dd0954116fb2c457e10c23 /src/arch/arm/v7
parent8c71b36d401b2473342daddcb9b7eb4b83ba3295 (diff)
Reduced once again the size of the main instruction structure.
Diffstat (limited to 'src/arch/arm/v7')
-rw-r--r--src/arch/arm/v7/instruction.c51
-rw-r--r--src/arch/arm/v7/instruction.h3
-rw-r--r--src/arch/arm/v7/opdefs/Makefile.am2
3 files changed, 49 insertions, 7 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. *
* *
diff --git a/src/arch/arm/v7/instruction.h b/src/arch/arm/v7/instruction.h
index 291f2c9..5d79cb8 100644
--- a/src/arch/arm/v7/instruction.h
+++ b/src/arch/arm/v7/instruction.h
@@ -55,6 +55,9 @@ GType g_armv7_instruction_get_type(void);
/* Crée une instruction pour l'architecture ARMv7. */
GArchInstruction *g_armv7_instruction_new(const char *);
+/* Précise l'encodage d'une instruction ARMv7 dans le détail. */
+void g_armv7_instruction_set_encoding(GArmV7Instruction *, const char *);
+
/* Définit si une instruction ARMv7 met à jour les drapeaux. */
bool g_armv7_instruction_define_setflags(GArmV7Instruction *, bool);
diff --git a/src/arch/arm/v7/opdefs/Makefile.am b/src/arch/arm/v7/opdefs/Makefile.am
index 7844578..41785c6 100644
--- a/src/arch/arm/v7/opdefs/Makefile.am
+++ b/src/arch/arm/v7/opdefs/Makefile.am
@@ -24,7 +24,7 @@ D2C_MACROS = \
-M SignExtend=sign_extend_armv7_imm \
-M SetInsFlag=g_arch_instruction_set_flag \
-M StoreCondition=g_arm_instruction_set_cond \
- -M ExtendKeyword=g_arch_instruction_extend_keyword
+ -M ExtendKeyword=g_arm_instruction_extend_keyword
D2C_OPERANDS = \
-n BarrierLimitation \