summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-11-13 21:42:10 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-11-13 21:42:10 (GMT)
commit23bc425f9c35c31a80d65d824452c8728614a206 (patch)
tree71b1c9762fee17f85648bf210a88adad5ab60052 /plugins/pychrysalide
parent65e12afde4bd9cd32e206f874cfa378708248918 (diff)
Exported extra processor features.
Diffstat (limited to 'plugins/pychrysalide')
-rw-r--r--plugins/pychrysalide/arch/processor.c113
1 files changed, 113 insertions, 0 deletions
diff --git a/plugins/pychrysalide/arch/processor.c b/plugins/pychrysalide/arch/processor.c
index 6466fc9..7ff374b 100644
--- a/plugins/pychrysalide/arch/processor.c
+++ b/plugins/pychrysalide/arch/processor.c
@@ -49,6 +49,15 @@
/* ---------------------------- DEFINITION DE PROCESSEUR ---------------------------- */
+/* Fournit le boustime du processeur d'une architecture. */
+static PyObject *py_arch_processor_get_endianness(PyObject *, void *);
+
+/* Fournit la taille de l'espace mémoire d'une architecture. */
+static PyObject *py_arch_processor_get_memory_size(PyObject *, void *);
+
+/* Fournit la taille min. des instructions d'une architecture. */
+static PyObject *py_arch_processor_get_instruction_min_size(PyObject *, void *);
+
/* Indique si l'architecture possède un espace virtuel ou non. */
static PyObject *py_arch_processor_has_virtual_space(PyObject *, void *);
@@ -91,10 +100,102 @@ static bool define_python_arch_processor_constants(PyTypeObject *);
+/* ---------------------------------------------------------------------------------- */
+/* DEFINITION DE PROCESSEUR */
+/* ---------------------------------------------------------------------------------- */
+
+/******************************************************************************
+* *
+* Paramètres : self = objet Python concerné par l'appel. *
+* closure = non utilisé ici. *
+* *
+* Description : Fournit le boustime du processeur d'une architecture. *
+* *
+* Retour : Boutisme associé au processeur. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+static PyObject *py_arch_processor_get_endianness(PyObject *self, void *closure)
+{
+ PyObject *result; /* Instance Python à retourner */
+ GArchProcessor *proc; /* Version GLib de l'opérande */
+ SourceEndian endianness; /* Boutisme du processeur */
+ proc = G_ARCH_PROCESSOR(pygobject_get(self));
+ assert(proc != NULL);
+ endianness = g_arch_processor_get_endianness(proc);
+
+ result = Py_BuildValue("I", endianness);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : self = objet Python concerné par l'appel. *
+* closure = non utilisé ici. *
+* *
+* Description : Fournit la taille de l'espace mémoire d'une architecture. *
+* *
+* Retour : Taille de l'espace mémoire. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_arch_processor_get_memory_size(PyObject *self, void *closure)
+{
+ PyObject *result; /* Instance Python à retourner */
+ GArchProcessor *proc; /* Version GLib de l'opérande */
+ MemoryDataSize size; /* Type de donnée représentée */
+
+ proc = G_ARCH_PROCESSOR(pygobject_get(self));
+ assert(proc != NULL);
+
+ size = g_arch_processor_get_memory_size(proc);
+
+ result = Py_BuildValue("I", size);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : self = objet Python concerné par l'appel. *
+* closure = non utilisé ici. *
+* *
+* Description : Fournit la taille min. des instructions d'une architecture. *
+* *
+* Retour : Taille d'encodage des instructions. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_arch_processor_get_instruction_min_size(PyObject *self, void *closure)
+{
+ PyObject *result; /* Instance Python à retourner */
+ GArchProcessor *proc; /* Version GLib de l'opérande */
+ MemoryDataSize size; /* Type de donnée représentée */
+
+ proc = G_ARCH_PROCESSOR(pygobject_get(self));
+ assert(proc != NULL);
+
+ size = g_arch_processor_get_instruction_min_size(proc);
+
+ result = Py_BuildValue("I", size);
+
+ return result;
+
+}
/******************************************************************************
@@ -440,6 +541,18 @@ PyTypeObject *get_python_arch_processor_type(void)
static PyGetSetDef py_arch_processor_getseters[] = {
{
+ "endianness", py_arch_processor_get_endianness, NULL,
+ "Provide the processor endianness.", NULL
+ },
+ {
+ "mem_size", py_arch_processor_get_memory_size, NULL,
+ "Provide the size of memory addresses for the given architecture.", NULL
+ },
+ {
+ "ins_min_size", py_arch_processor_get_instruction_min_size, NULL,
+ "Provide the minimal size of one processor instruction.", NULL
+ },
+ {
"virtual_space", py_arch_processor_has_virtual_space, NULL,
"Tell if the processor provides a virtual address space.", NULL
},