summaryrefslogtreecommitdiff
path: root/plugins/arm/python/v7
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/arm/python/v7')
-rw-r--r--plugins/arm/python/v7/Makefile.am16
-rw-r--r--plugins/arm/python/v7/instruction.c109
-rw-r--r--plugins/arm/python/v7/instruction.h42
-rw-r--r--plugins/arm/python/v7/module.c93
-rw-r--r--plugins/arm/python/v7/module.h39
-rw-r--r--plugins/arm/python/v7/processor.c108
-rw-r--r--plugins/arm/python/v7/processor.h42
7 files changed, 449 insertions, 0 deletions
diff --git a/plugins/arm/python/v7/Makefile.am b/plugins/arm/python/v7/Makefile.am
new file mode 100644
index 0000000..f4f6df4
--- /dev/null
+++ b/plugins/arm/python/v7/Makefile.am
@@ -0,0 +1,16 @@
+
+noinst_LTLIBRARIES = libarmpythonv7.la
+
+libarmpythonv7_la_SOURCES = \
+ instruction.h instruction.c \
+ module.h module.c \
+ processor.h processor.c
+
+
+libarmpythonv7_la_LDFLAGS =
+
+
+AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) $(LIBPYTHON_CFLAGS) $(LIBPYGOBJECT_CFLAGS) \
+ -I$(top_srcdir)/src
+
+AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
diff --git a/plugins/arm/python/v7/instruction.c b/plugins/arm/python/v7/instruction.c
new file mode 100644
index 0000000..25a49bb
--- /dev/null
+++ b/plugins/arm/python/v7/instruction.c
@@ -0,0 +1,109 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * instruction.c - équivalent Python du fichier "arch/arm/v7/instruction.c"
+ *
+ * Copyright (C) 2015-2017 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#include "instruction.h"
+
+
+#include <pygobject.h>
+
+
+#include <plugins/pychrysa/helpers.h>
+
+
+#include "../instruction.h"
+#include "../../v7/instruction.h"
+
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Fournit un accès à une définition de type à diffuser. *
+* *
+* Retour : Définition d'objet pour Python. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+PyTypeObject *get_python_armv7_instruction_type(void)
+{
+ static PyMethodDef py_armv7_instruction_methods[] = {
+ { NULL }
+ };
+
+ static PyGetSetDef py_armv7_instruction_getseters[] = {
+ { NULL }
+ };
+
+ static PyTypeObject py_armv7_instruction_type = {
+
+ PyVarObject_HEAD_INIT(NULL, 0)
+
+ .tp_name = "pychrysalide.arch.arm.v7.ArmV7Instruction",
+ .tp_basicsize = sizeof(PyGObject),
+
+ .tp_flags = Py_TPFLAGS_DEFAULT,
+
+ .tp_doc = "PyChrysalide instruction for an ARMv7 architecture.",
+
+ .tp_methods = py_armv7_instruction_methods,
+ .tp_getset = py_armv7_instruction_getseters,
+
+ };
+
+ return &py_armv7_instruction_type;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : module = module dont la définition est à compléter. *
+* *
+* Description : Prend en charge l'objet 'pychrysalide....arm.ArmInstruction'.*
+* *
+* Retour : Bilan de l'opération. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool register_python_armv7_instruction(PyObject *module)
+{
+ PyTypeObject *py_armv7_instruction_type;/* Type Python 'BinContent' */
+ PyObject *dict; /* Dictionnaire du module */
+
+ py_armv7_instruction_type = get_python_armv7_instruction_type();
+
+ dict = PyModule_GetDict(module);
+
+ if (!register_class_for_pygobject(dict, G_TYPE_ARMV7_INSTRUCTION,
+ py_armv7_instruction_type, get_python_arm_instruction_type()))
+ return false;
+
+ return true;
+
+}
diff --git a/plugins/arm/python/v7/instruction.h b/plugins/arm/python/v7/instruction.h
new file mode 100644
index 0000000..a1a04be
--- /dev/null
+++ b/plugins/arm/python/v7/instruction.h
@@ -0,0 +1,42 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * instruction.h - prototypes pour l'équivalent Python du fichier "arch/arm/v7/instruction.h"
+ *
+ * Copyright (C) 2015-2017 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#ifndef _PLUGINS_ARM_PYTHON_V7_INSTRUCTION_H
+#define _PLUGINS_ARM_PYTHON_V7_INSTRUCTION_H
+
+
+#include <Python.h>
+#include <stdbool.h>
+
+
+
+/* Fournit un accès à une définition de type à diffuser. */
+PyTypeObject *get_python_armv7_instruction_type(void);
+
+/* Prend en charge l'objet 'pychrysalide.arch.arm.v7.ArmV7Instruction'. */
+bool register_python_armv7_instruction(PyObject *);
+
+
+
+#endif /* _PLUGINS_ARM_PYTHON_V7_INSTRUCTION_H */
diff --git a/plugins/arm/python/v7/module.c b/plugins/arm/python/v7/module.c
new file mode 100644
index 0000000..9188ae4
--- /dev/null
+++ b/plugins/arm/python/v7/module.c
@@ -0,0 +1,93 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * module.c - intégration du répertoire v7 en tant que module
+ *
+ * Copyright (C) 2015-2017 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#include "module.h"
+
+
+#include "instruction.h"
+#include "processor.h"
+
+
+
+/******************************************************************************
+* *
+* Paramètres : module = module dont la définition est à compléter. *
+* *
+* Description : Ajoute le module 'arm' au module Python. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool add_arch_arm_v7_module_to_python_module(PyObject *super)
+{
+ bool result; /* Bilan à retourner */
+ PyObject *module; /* Sous-module mis en place */
+ int ret; /* Bilan d'un appel */
+
+ static PyModuleDef py_chrysalide_v7_module = {
+
+ .m_base = PyModuleDef_HEAD_INIT,
+
+ .m_name = "pychrysalide.arch.arm.v7",
+ .m_doc = "Python module for Chrysalide.arch.arm.v7",
+
+ .m_size = -1,
+
+ };
+
+ result = false;
+
+ module = PyModule_Create(&py_chrysalide_v7_module);
+ if (module == NULL) return false;
+
+ ret = PyState_AddModule(super, &py_chrysalide_v7_module);
+ if (ret != 0) goto aaamtpm_exit;
+
+ ret = _PyImport_FixupBuiltin(module, "pychrysalide.arch.arm.v7");
+ if (ret != 0) goto aaamtpm_exit;
+
+ Py_INCREF(module);
+ ret = PyModule_AddObject(super, "v7", module);
+ if (ret != 0) goto aaamtpm_exit;
+
+ result = true;
+
+ result &= register_python_armv7_instruction(module);
+ result &= register_python_armv7_processor(module);
+
+ aaamtpm_exit:
+
+ if (!result)
+ {
+ printf("something went wrong in %s...\n", __FUNCTION__);
+ /* ... */
+
+ }
+
+ return result;
+
+}
diff --git a/plugins/arm/python/v7/module.h b/plugins/arm/python/v7/module.h
new file mode 100644
index 0000000..fc5ba8c
--- /dev/null
+++ b/plugins/arm/python/v7/module.h
@@ -0,0 +1,39 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * module.h - prototypes pour l'intégration du répertoire v7 en tant que module
+ *
+ * Copyright (C) 2015-2017 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#ifndef _PLUGINS_ARM_PYTHON_V7_MODULE_H
+#define _PLUGINS_ARM_PYTHON_V7_MODULE_H
+
+
+#include <Python.h>
+#include <stdbool.h>
+
+
+
+/* Ajoute le module 'arm' au module Python. */
+bool add_arch_arm_v7_module_to_python_module(PyObject *);
+
+
+
+#endif /* _PLUGINS_ARM_PYTHON_V7_MODULE_H */
diff --git a/plugins/arm/python/v7/processor.c b/plugins/arm/python/v7/processor.c
new file mode 100644
index 0000000..9a0911c
--- /dev/null
+++ b/plugins/arm/python/v7/processor.c
@@ -0,0 +1,108 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * processor.c - équivalent Python du fichier "arch/arm/v7/processor.c"
+ *
+ * Copyright (C) 2015-2017 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#include "processor.h"
+
+
+#include <pygobject.h>
+
+
+#include <plugins/pychrysa/helpers.h>
+
+
+#include "../processor.h"
+#include "../../v7/processor.h"
+
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Fournit un accès à une définition de type à diffuser. *
+* *
+* Retour : Définition d'objet pour Python. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+PyTypeObject *get_python_armv7_processor_type(void)
+{
+ static PyMethodDef py_armv7_processor_methods[] = {
+ { NULL }
+ };
+
+ static PyGetSetDef py_armv7_processor_getseters[] = {
+ { NULL }
+ };
+
+ static PyTypeObject py_armv7_processor_type = {
+
+ PyVarObject_HEAD_INIT(NULL, 0)
+
+ .tp_name = "pychrysalide.arch.arm.v7.ArmV7Processor",
+ .tp_basicsize = sizeof(PyGObject),
+
+ .tp_flags = Py_TPFLAGS_DEFAULT,
+
+ .tp_doc = "PyChrysalide processor for an ARMv7 architecture.",
+
+ .tp_methods = py_armv7_processor_methods,
+ .tp_getset = py_armv7_processor_getseters,
+
+ };
+
+ return &py_armv7_processor_type;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : module = module dont la définition est à compléter. *
+* *
+* Description : Prend en charge l'objet 'pychrysalide.arch.arm.ArmProcessor'.*
+* *
+* Retour : Bilan de l'opération. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool register_python_armv7_processor(PyObject *module)
+{
+ PyTypeObject *py_armv7_processor_type; /* Type Python 'BinContent' */
+ PyObject *dict; /* Dictionnaire du module */
+
+ py_armv7_processor_type = get_python_armv7_processor_type();
+
+ dict = PyModule_GetDict(module);
+
+ if (!register_class_for_pygobject(dict, G_TYPE_ARMV7_PROCESSOR, py_armv7_processor_type, get_python_arm_processor_type()))
+ return false;
+
+ return true;
+
+}
diff --git a/plugins/arm/python/v7/processor.h b/plugins/arm/python/v7/processor.h
new file mode 100644
index 0000000..3226abd
--- /dev/null
+++ b/plugins/arm/python/v7/processor.h
@@ -0,0 +1,42 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * processor.h - prototypes pour l'équivalent Python du fichier "arch/arm/v7/processor.h"
+ *
+ * Copyright (C) 2015-2017 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#ifndef _PLUGINS_ARM_PYTHON_V7_PROCESSOR_H
+#define _PLUGINS_ARM_PYTHON_V7_PROCESSOR_H
+
+
+#include <Python.h>
+#include <stdbool.h>
+
+
+
+/* Fournit un accès à une définition de type à diffuser. */
+PyTypeObject *get_python_armv7_processor_type(void);
+
+/* Prend en charge l'objet 'pychrysalide.arch.arm.v7.ArmV7Processor'. */
+bool register_python_armv7_processor(PyObject *);
+
+
+
+#endif /* _PLUGINS_ARM_PYTHON_V7_PROCESSOR_H */