summaryrefslogtreecommitdiff
path: root/src/arch/arm
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2015-12-15 22:08:44 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2015-12-15 22:08:44 (GMT)
commit4d313d845a60e908b9e2723cc1fe2bdbbdded315 (patch)
tree96b3c599e250b987e284e4bfcf33a7ae201cf637 /src/arch/arm
parenta847082da67c5af831d1f4b66a628de2e9d61395 (diff)
Stored and provided the encoding used by an instruction.
Diffstat (limited to 'src/arch/arm')
-rw-r--r--src/arch/arm/v7/instruction.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/arch/arm/v7/instruction.c b/src/arch/arm/v7/instruction.c
index de81056..d485dbc 100644
--- a/src/arch/arm/v7/instruction.c
+++ b/src/arch/arm/v7/instruction.c
@@ -58,6 +58,8 @@ static void g_armv7_instruction_dispose(GArmV7Instruction *);
/* Procède à la libération totale de la mémoire. */
static void g_armv7_instruction_finalize(GArmV7Instruction *);
+/* Indique l'encodage d'une instruction de façon détaillée. */
+static const char *g_armv7_instruction_get_encoding(const GArmV7Instruction *);
/* Indique le type défini pour une représentation d'une instruction ARMv7. */
@@ -79,12 +81,16 @@ G_DEFINE_TYPE(GArmV7Instruction, g_armv7_instruction, G_TYPE_ARM_INSTRUCTION);
static void g_armv7_instruction_class_init(GArmV7InstructionClass *klass)
{
GObjectClass *object_class; /* Autre version de la classe */
+ GArchInstructionClass *instr; /* Encore une autre vision... */
object_class = G_OBJECT_CLASS(klass);
+ instr = G_ARCH_INSTRUCTION_CLASS(klass);
object_class->dispose = (GObjectFinalizeFunc/* ! */)g_armv7_instruction_dispose;
object_class->finalize = (GObjectFinalizeFunc)g_armv7_instruction_finalize;
+ instr->get_encoding = (get_instruction_encoding_fc)g_armv7_instruction_get_encoding;
+
}
@@ -171,6 +177,35 @@ GArchInstruction *g_armv7_instruction_new(const char *keyword)
/******************************************************************************
* *
+* Paramètres : instr = instruction quelconque à consulter. *
+* *
+* Description : Indique l'encodage d'une instruction de façon détaillée. *
+* *
+* Retour : Description humaine de l'encodage utilisé. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+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;
+
+ if (raw[0] == 'T' || raw[0] == 't')
+ result = "Thumb";
+ else
+ result = "ARM";
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : instr = instruction ARMv7 à mettre à jour. *
* set = statut à enregistrer. *
* *