Fix ctl_remove_cache for python2

This commit is contained in:
lazymio 2023-08-09 14:11:21 +08:00
parent 247d643f2f
commit 3c89d0c3ce
No known key found for this signature in database
GPG Key ID: DFF27E34A47CB873

View File

@ -719,6 +719,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()
@ -764,8 +769,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, end):
self.__ctl_w_2_arg(uc.UC_CTL_TB_REMOVE_CACHE, addr, end, 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)