about summary refs log tree commit diff stats
path: root/miasm2/jitter/Jitllvm.c
diff options
context:
space:
mode:
authorserpilliere <devnull@localhost>2014-06-03 10:27:56 +0200
committerserpilliere <devnull@localhost>2014-06-03 10:27:56 +0200
commited5c3668cc9f545b52674ad699fc2b0ed1ccb575 (patch)
tree07faf97d7e4d083173a1f7e1bfd249baed2d74f9 /miasm2/jitter/Jitllvm.c
parenta183e1ebd525453710306695daa8c410fd0cb2af (diff)
downloadmiasm-ed5c3668cc9f545b52674ad699fc2b0ed1ccb575.tar.gz
miasm-ed5c3668cc9f545b52674ad699fc2b0ed1ccb575.zip
Miasm v2
* API has changed, so old scripts need updates
* See example for API usage
* Use tcc or llvm for jit emulation
* Go to test and run test_all.py to check install

Enjoy !
Diffstat (limited to 'miasm2/jitter/Jitllvm.c')
-rw-r--r--miasm2/jitter/Jitllvm.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/miasm2/jitter/Jitllvm.c b/miasm2/jitter/Jitllvm.c
new file mode 100644
index 00000000..ab077b05
--- /dev/null
+++ b/miasm2/jitter/Jitllvm.c
@@ -0,0 +1,36 @@
+#include <Python.h>
+
+#include <inttypes.h>
+
+#include <stdint.h>
+
+PyObject* llvm_exec_bloc(PyObject* self, PyObject* args)
+{
+	uint64_t (*func)(void*, void*);
+	uint64_t vm;
+	uint64_t cpu;
+	uint64_t ret;
+
+	if (!PyArg_ParseTuple(args, "KKK", &func, &cpu, &vm))
+		return NULL;
+	ret = func((void*)cpu, (void*)vm);
+	return PyLong_FromUnsignedLongLong( (uint64_t)ret);
+}
+
+
+static PyMethodDef LLVMMethods[] = {
+    {"llvm_exec_bloc",  llvm_exec_bloc, METH_VARARGS,
+     "llvm exec bloc"},
+    {NULL, NULL, 0, NULL}        /* Sentinel */
+};
+
+PyMODINIT_FUNC
+initJitllvm(void)
+{
+    PyObject *m;
+
+    m = Py_InitModule("Jitllvm", LLVMMethods);
+    if (m == NULL)
+	    return;
+
+}