summaryrefslogtreecommitdiff
path: root/src/arch/operands/immediate-int.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/operands/immediate-int.h')
-rw-r--r--src/arch/operands/immediate-int.h66
1 files changed, 39 insertions, 27 deletions
diff --git a/src/arch/operands/immediate-int.h b/src/arch/operands/immediate-int.h
index d2313f5..3d60c7d 100644
--- a/src/arch/operands/immediate-int.h
+++ b/src/arch/operands/immediate-int.h
@@ -2,7 +2,7 @@
/* Chrysalide - Outil d'analyse de fichiers binaires
* immediate-int.h - définitions internes propres aux opérandes représentant des valeurs numériques
*
- * Copyright (C) 2021 Cyrille Bagard
+ * Copyright (C) 2021-2024 Cyrille Bagard
*
* This file is part of Chrysalide.
*
@@ -30,27 +30,8 @@
-/* Informations glissées dans la structure GObject de GArchOperand */
-typedef struct _immop_extra_data_t
-{
- operand_extra_data_t parent; /* A laisser en premier */
-
- MemoryDataSize size; /* Taille de l'opérande */
-
- /**
- * Les deux éléments suivants sont de type ImmOperandDisplay ;
- * leur espace de conservation est réduit au maximum afin d'éviter
- * un recouvrement .
- */
-
- unsigned int def_display : 3; /* Type par défaut d'affichage */
- unsigned int display : 3; /* Format général d'affichage */
-
-} immop_extra_data_t;
-
-
/* Définition d'un opérande de valeur numérique (instance) */
-struct _GImmOperand
+struct _GImmediateOperand
{
GArchOperand parent; /* Instance parente */
@@ -59,7 +40,7 @@ struct _GImmOperand
};
/* Définition d'un opérande de valeur numérique (classe) */
-struct _GImmOperandClass
+struct _GImmediateOperandClass
{
GArchOperandClass parent; /* Classe parente */
@@ -70,15 +51,46 @@ struct _GImmOperandClass
* Accès aux informations éventuellement déportées.
*/
-#if 1 //__SIZEOF_INT__ == __SIZEOF_LONG__
+/* Informations glissées dans la structure GObject de GArchOperand */
+typedef struct _immop_extra_data_t
+{
+ ARCH_OPERAND_EXTRA_DATA(3); /* Informations pour l'opérande*/
-# define GET_IMM_OP_EXTRA(op) ((immop_extra_data_t *)&((GArchOperand *)op)->extra)
+ /**
+ * MemoryDataSize
+ */
+ unsigned int size : 4; /* Taille de l'opérande */
+
+ /**
+ * ImmOperandDisplay x 2
+ */
+ unsigned int def_display : 3; /* Type par défaut d'affichage */
+ unsigned int display : 3; /* Format général d'affichage */
+
+} immop_extra_data_t;
+
+
+#define GET_IMM_OP_EXTRA(op) \
+ GET_GOBJECT_EXTRA(op, immop_extra_data_t)
+
+#define SET_IMM_OP_EXTRA(op, data) \
+ SET_GOBJECT_EXTRA(op, immop_extra_data_t, data)
-#else
-# define GET_IMM_OP_EXTRA(op) GET_GOBJECT_EXTRA(G_OBJECT(op), immop_extra_data_t)
+/* Met en place un opérande réprésentant une valeur numérique. */
+bool g_immediate_operand_create_from_value(GImmediateOperand *, MemoryDataSize, uint64_t);
+
+/* Crée un opérande réprésentant une valeur numérique. */
+bool g_immediate_operand_create_from_data(GImmediateOperand *, MemoryDataSize, const GBinContent *, vmpa2t *, bool *, SourceEndian);
+
+/**
+ * La taille d'impression d'un opérande n'est pas VMPA_MAX_SIZE,
+ * mais 1 + 64 caractères + octet nul final en cas d'impression en binaire.
+ */
+#define IMM_MAX_SIZE 66
-#endif
+/* Construit la chaîne de caractères correspondant à l'opérande. */
+size_t _g_immediate_operand_to_string(const GImmediateOperand *, ImmOperandDisplay, char [IMM_MAX_SIZE]);