From fbf4078d650e9d3581c957b1121fad71ebe3eb5a Mon Sep 17 00:00:00 2001 From: lazymio Date: Tue, 26 Apr 2022 00:12:32 +0200 Subject: [PATCH] Fix wrong python binding for UC_CTL_TB_REMOVE_CACHE --- bindings/python/unicorn/unicorn.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bindings/python/unicorn/unicorn.py b/bindings/python/unicorn/unicorn.py index e4ac4e49..5c02e944 100644 --- a/bindings/python/unicorn/unicorn.py +++ b/bindings/python/unicorn/unicorn.py @@ -717,6 +717,11 @@ class Uc(object): arg = ctp(val) self.ctl(self.__ctl_w(ctl, 1), arg) + def __ctl_w_2_arg(self, ctl, val1, val2, ctp1, ctp2): + arg1 = ctp1(val1) + arg2 = ctp2(val2) + self.ctl(self.__ctl_w(ctl, 2), arg1, arg2) + def __ctl_rw_1_1_arg(self, ctl, val, ctp1, ctp2): arg1 = ctp1(val) arg2 = ctp2() @@ -762,8 +767,8 @@ class Uc(object): def ctl_set_cpu_model(self, val): self.__ctl_w_1_arg(uc.UC_CTL_CPU_MODEL, val, ctypes.c_int) - def ctl_remove_cache(self, addr): - self.__ctl_w_1_arg(uc.UC_CTL_TB_REMOVE_CACHE, addr, ctypes.c_uint64) + def ctl_remove_cache(self, addr, len): + self.__ctl_w_2_arg(uc.UC_CTL_TB_REMOVE_CACHE, addr, len, ctypes.c_uint64, ctypes.c_uint64) def ctl_request_cache(self, addr): return self.__ctl_rw_1_1_arg(uc.UC_CTL_TB_REQUEST_CACHE, addr, ctypes.c_uint64, uc_tb)