summaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2020-06-21 20:21:00 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2020-06-21 20:21:00 (GMT)
commit6183dcf34a45b7250b63add608c02e96bf53e096 (patch)
tree971747a5dfab5384402a30aa26c8bf86e5ec7166 /src/arch
parentf6e8a85c7fe86e957adffc4e05bf10e8f3ae8ae2 (diff)
Reorganized the code for target operands.
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/Makefile.am1
-rw-r--r--src/arch/instructions/raw.c2
-rw-r--r--src/arch/operands/Makefile.am2
-rw-r--r--src/arch/operands/target-int.h58
-rw-r--r--src/arch/operands/target.c (renamed from src/arch/target.c)40
-rw-r--r--src/arch/operands/target.h (renamed from src/arch/target.h)12
-rw-r--r--src/arch/post.c2
-rw-r--r--src/arch/storage.c2
8 files changed, 77 insertions, 42 deletions
diff --git a/src/arch/Makefile.am b/src/arch/Makefile.am
index a8f9fb0..851570e 100644
--- a/src/arch/Makefile.am
+++ b/src/arch/Makefile.am
@@ -18,7 +18,6 @@ libarch_la_SOURCES = \
register-int.h \
register.h register.c \
storage.h storage.c \
- target.h target.c \
vmpa.h vmpa.c
libarch_la_LIBADD = \
diff --git a/src/arch/instructions/raw.c b/src/arch/instructions/raw.c
index 7c2535c..05eb886 100644
--- a/src/arch/instructions/raw.c
+++ b/src/arch/instructions/raw.c
@@ -33,8 +33,8 @@
#include "../instruction-int.h"
-#include "../target.h"
#include "../operands/immediate.h"
+#include "../operands/target.h"
diff --git a/src/arch/operands/Makefile.am b/src/arch/operands/Makefile.am
index 74f057d..25b4db2 100644
--- a/src/arch/operands/Makefile.am
+++ b/src/arch/operands/Makefile.am
@@ -11,6 +11,8 @@ libarchoperands_la_SOURCES = \
proxy.h proxy.c \
rename-int.h \
rename.h rename.c \
+ target-int.h \
+ target.h target.c \
targetable-int.h \
targetable.h targetable.c
diff --git a/src/arch/operands/target-int.h b/src/arch/operands/target-int.h
new file mode 100644
index 0000000..f3ed447
--- /dev/null
+++ b/src/arch/operands/target-int.h
@@ -0,0 +1,58 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * target-int.h - définitions internes propres aux opérandes ciblant un symbole
+ *
+ * Copyright (C) 2020 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Chrysalide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Chrysalide. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _ARCH_OPERANDS_TARGET_INT_H
+#define _ARCH_OPERANDS_TARGET_INT_H
+
+
+#include "target.h"
+#include "../operand-int.h"
+
+
+
+/* Définition d'un opérande ciblant idéalement un symbole connu (instance) */
+struct _GTargetOperand
+{
+ GArchOperand parent; /* Instance parente */
+
+ MemoryDataSize size; /* Taille de l'opérande */
+ vmpa2t addr; /* Adresse de l'élément visé */
+
+ bool strict; /* Résolution stricte */
+ /* Référence circulaire */
+ GBinSymbol *symbol; /* Eventuel symbole associé */
+ phys_t diff; /* Position dans le symbole */
+
+};
+
+
+/* Définition d'un opérande ciblant idéalement un symbole connu (classe) */
+struct _GTargetOperandClass
+{
+ GArchOperandClass parent; /* Classe parente */
+
+};
+
+
+
+#endif /* _ARCH_OPERANDS_TARGET_INT_H */
diff --git a/src/arch/target.c b/src/arch/operands/target.c
index 65fef30..d921200 100644
--- a/src/arch/target.c
+++ b/src/arch/operands/target.c
@@ -32,41 +32,17 @@
#include <string.h>
-#include "operand-int.h"
-#include "operands/immediate.h"
-#include "operands/targetable-int.h"
-#include "../analysis/routine.h"
-#include "../common/extstr.h"
-#include "../format/format.h"
-#include "../format/strsym.h"
-#include "../glibext/gbinarycursor.h"
+#include "immediate.h"
+#include "target-int.h"
+#include "targetable-int.h"
+#include "../../analysis/routine.h"
+#include "../../common/extstr.h"
+#include "../../format/format.h"
+#include "../../format/strsym.h"
+#include "../../glibext/gbinarycursor.h"
-/* Définition d'un opérande ciblant idéalement un symbole connu (instance) */
-struct _GTargetOperand
-{
- GArchOperand parent; /* Instance parente */
-
- MemoryDataSize size; /* Taille de l'opérande */
- vmpa2t addr; /* Adresse de l'élément visé */
-
- bool strict; /* Résolution stricte */
- /* Référence circulaire */
- GBinSymbol *symbol; /* Eventuel symbole associé */
- phys_t diff; /* Position dans le symbole */
-
-};
-
-
-/* Définition d'un opérande ciblant idéalement un symbole connu (classe) */
-struct _GTargetOperandClass
-{
- GArchOperandClass parent; /* Classe parente */
-
-};
-
-
/* Initialise la classe des opérandes ciblant des symboles. */
static void g_target_operand_class_init(GTargetOperandClass *);
diff --git a/src/arch/target.h b/src/arch/operands/target.h
index 1e72ad8..8810efa 100644
--- a/src/arch/target.h
+++ b/src/arch/operands/target.h
@@ -21,17 +21,17 @@
*/
-#ifndef _ARCH_TARGET_H
-#define _ARCH_TARGET_H
+#ifndef _ARCH_OPERANDS_TARGET_H
+#define _ARCH_OPERANDS_TARGET_H
#include <glib-object.h>
#include <stdbool.h>
-#include "archbase.h"
-#include "operand.h"
-#include "vmpa.h"
+#include "../archbase.h"
+#include "../operand.h"
+#include "../vmpa.h"
@@ -67,4 +67,4 @@ GBinSymbol *g_target_operand_get_symbol(const GTargetOperand *, phys_t *);
-#endif /* _ARCH_TARGET_H */
+#endif /* _ARCH_OPERANDS_TARGET_H */
diff --git a/src/arch/post.c b/src/arch/post.c
index 11fecf5..6f6392d 100644
--- a/src/arch/post.c
+++ b/src/arch/post.c
@@ -28,8 +28,8 @@
#include "processor.h"
-#include "target.h"
#include "operands/immediate.h"
+#include "operands/target.h"
#include "../analysis/routine.h"
diff --git a/src/arch/storage.c b/src/arch/storage.c
index 217d327..0995f4d 100644
--- a/src/arch/storage.c
+++ b/src/arch/storage.c
@@ -33,7 +33,7 @@
#include "instruction.h"
-#include "target.h"
+#include "operands/target.h"
#include "../common/compression.h"
#include "../common/extstr.h"
#include "../common/pathname.h"