summaryrefslogtreecommitdiff
path: root/plugins/arm/v7/operands/estate.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-05-14 19:40:07 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-05-14 19:40:07 (GMT)
commit0286b53bad21abf91cbe17c4772ca9cde6a89cbc (patch)
tree3bec9dc7e118c00ce9c748576b01606a71880ad7 /plugins/arm/v7/operands/estate.c
parent267b1ae8608ed4bf52de743798e8647c903ee1b4 (diff)
Created an instruction database for Chrysalide.
Diffstat (limited to 'plugins/arm/v7/operands/estate.c')
-rw-r--r--plugins/arm/v7/operands/estate.c94
1 files changed, 94 insertions, 0 deletions
diff --git a/plugins/arm/v7/operands/estate.c b/plugins/arm/v7/operands/estate.c
index 3302f30..472ac2b 100644
--- a/plugins/arm/v7/operands/estate.c
+++ b/plugins/arm/v7/operands/estate.c
@@ -67,6 +67,17 @@ static void g_armv7_endian_operand_print(const GArmV7EndianOperand *, GBufferLin
+/* --------------------- TRANSPOSITIONS VIA CACHE DES OPERANDES --------------------- */
+
+
+/* Charge un opérande depuis une mémoire tampon. */
+static bool g_armv7_endian_operand_unserialize(GArmV7EndianOperand *, GAsmStorage *, GBinFormat *, packed_buffer *);
+
+/* Sauvegarde un opérande dans une mémoire tampon. */
+static bool g_armv7_endian_operand_serialize(const GArmV7EndianOperand *, GAsmStorage *, packed_buffer *);
+
+
+
/* Indique le type défini par la GLib pour une endian de domaine et d'accès. */
G_DEFINE_TYPE(GArmV7EndianOperand, g_armv7_endian_operand, G_TYPE_ARCH_OPERAND);
@@ -97,6 +108,9 @@ static void g_armv7_endian_operand_class_init(GArmV7EndianOperandClass *klass)
operand->compare = (operand_compare_fc)g_armv7_endian_operand_compare;
operand->print = (operand_print_fc)g_armv7_endian_operand_print;
+ operand->unserialize = (unserialize_operand_fc)g_armv7_endian_operand_unserialize;
+ operand->serialize = (serialize_operand_fc)g_armv7_endian_operand_serialize;
+
}
@@ -246,3 +260,83 @@ bool g_armv7_endian_operand_is_big_endian(const GArmV7EndianOperand *operand)
return operand->big;
}
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* TRANSPOSITIONS VIA CACHE DES OPERANDES */
+/* ---------------------------------------------------------------------------------- */
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = opérande d'assemblage à constituer. *
+* storage = mécanisme de sauvegarde à manipuler. *
+* format = format binaire chargé associé à l'architecture. *
+* pbuf = zone tampon à remplir. *
+* *
+* Description : Charge un opérande depuis une mémoire tampon. *
+* *
+* Retour : Bilan de l'opération. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static bool g_armv7_endian_operand_unserialize(GArmV7EndianOperand *operand, GAsmStorage *storage, GBinFormat *format, packed_buffer *pbuf)
+{
+ bool result; /* Bilan à retourner */
+ GArchOperandClass *parent; /* Classe parente à consulter */
+ uint8_t big; /* Grand boutisme à afficher ? */
+
+ parent = G_ARCH_OPERAND_CLASS(g_armv7_endian_operand_parent_class);
+
+ result = parent->unserialize(G_ARCH_OPERAND(operand), storage, format, pbuf);
+
+ if (result)
+ {
+ result = extract_packed_buffer(pbuf, &big, sizeof(uint8_t), false);
+
+ if (result)
+ operand->big = (big == 1 ? true : false);
+
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = opérande d'assemblage à consulter. *
+* storage = mécanisme de sauvegarde à manipuler. *
+* pbuf = zone tampon à remplir. *
+* *
+* Description : Sauvegarde un opérande dans une mémoire tampon. *
+* *
+* Retour : Bilan de l'opération. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static bool g_armv7_endian_operand_serialize(const GArmV7EndianOperand *operand, GAsmStorage *storage, packed_buffer *pbuf)
+{
+ bool result; /* Bilan à retourner */
+ GArchOperandClass *parent; /* Classe parente à consulter */
+ uint8_t big; /* Grand boutisme à afficher ? */
+
+ parent = G_ARCH_OPERAND_CLASS(g_armv7_endian_operand_parent_class);
+
+ result = parent->serialize(G_ARCH_OPERAND(operand), storage, pbuf);
+
+ if (result)
+ {
+ big = (operand->big ? 1 : 0);
+ result = extend_packed_buffer(pbuf, &big, sizeof(uint8_t), false);
+ }
+
+ return result;
+
+}