diff options
Diffstat (limited to '')
| -rw-r--r-- | miasm2/jitter/Jitllvm.c | 23 | ||||
| -rw-r--r-- | miasm2/jitter/jitcore_llvm.py | 9 |
2 files changed, 21 insertions, 11 deletions
diff --git a/miasm2/jitter/Jitllvm.c b/miasm2/jitter/Jitllvm.c index cf2e1324..b46f88e3 100644 --- a/miasm2/jitter/Jitllvm.c +++ b/miasm2/jitter/Jitllvm.c @@ -22,16 +22,35 @@ PyObject* llvm_exec_bloc(PyObject* self, PyObject* args) PyObject* lbl2ptr; PyObject* breakpoints; PyObject* retaddr = NULL; + uint64_t max_exec_per_call = 0; + uint64_t cpt; + int do_cpt; - - if (!PyArg_ParseTuple(args, "OOOO", &retaddr, &jitcpu, &lbl2ptr, &breakpoints)) + if (!PyArg_ParseTuple(args, "OOOO|K", + &retaddr, &jitcpu, &lbl2ptr, &breakpoints, + &max_exec_per_call)) return NULL; + cpu = jitcpu->cpu; vm = &(jitcpu->pyvm->vm_mngr); /* The loop will decref retaddr always once */ Py_INCREF(retaddr); + if (max_exec_per_call == 0) { + do_cpt = 0; + cpt = 1; + } else { + do_cpt = 1; + cpt = max_exec_per_call; + } + for (;;) { + // Handle cpt + if (cpt == 0) + return retaddr; + if (do_cpt) + cpt --; + // Get the expected jitted function address func_py = PyDict_GetItem(lbl2ptr, retaddr); if (func_py) diff --git a/miasm2/jitter/jitcore_llvm.py b/miasm2/jitter/jitcore_llvm.py index 66e835ef..8f58f1da 100644 --- a/miasm2/jitter/jitcore_llvm.py +++ b/miasm2/jitter/jitcore_llvm.py @@ -129,12 +129,3 @@ class JitCore_LLVM(jitcore.JitCore): self.log_regs, block_raw)).hexdigest() return block_hash - - def jit_call(self, label, cpu, _vmmngr, breakpoints): - """Call the function label with cpu and vmmngr states - @label: function's label - @cpu: JitCpu instance - @breakpoints: Dict instance of used breakpoints - """ - return self.exec_wrapper(label, cpu, - self.lbl2jitbloc.data, breakpoints) |