@@ -103,7 +103,7 @@ def _load_lib(path, lib_name):
103103    for  _path  in  _path_list :
104104        if  _path  is  None :
105105            continue 
106-          
106+ 
107107        _uc  =  _load_lib (_path , "libunicorn.so" )
108108        if  _uc  is  not None :
109109            # In this case, show a warning for users 
@@ -153,16 +153,16 @@ class uc_tb(ctypes.Structure):
153153_setup_prototype (_uc , "uc_errno" , ucerr , uc_engine )
154154_setup_prototype (_uc , "uc_reg_read" , ucerr , uc_engine , ctypes .c_int , ctypes .c_void_p )
155155_setup_prototype (_uc , "uc_reg_write" , ucerr , uc_engine , ctypes .c_int , ctypes .c_void_p )
156- _setup_prototype (_uc , "uc_mem_read" , ucerr , uc_engine , ctypes .c_uint64 , ctypes .POINTER (ctypes .c_char ), ctypes .c_size_t )
157- _setup_prototype (_uc , "uc_mem_write" , ucerr , uc_engine , ctypes .c_uint64 , ctypes .POINTER (ctypes .c_char ), ctypes .c_size_t )
156+ _setup_prototype (_uc , "uc_mem_read" , ucerr , uc_engine , ctypes .c_uint64 , ctypes .POINTER (ctypes .c_char ), ctypes .c_uint64 )
157+ _setup_prototype (_uc , "uc_mem_write" , ucerr , uc_engine , ctypes .c_uint64 , ctypes .POINTER (ctypes .c_char ), ctypes .c_uint64 )
158158_setup_prototype (_uc , "uc_emu_start" , ucerr , uc_engine , ctypes .c_uint64 , ctypes .c_uint64 , ctypes .c_uint64 , ctypes .c_size_t )
159159_setup_prototype (_uc , "uc_emu_stop" , ucerr , uc_engine )
160160_setup_prototype (_uc , "uc_hook_del" , ucerr , uc_engine , uc_hook_h )
161- _setup_prototype (_uc , "uc_mmio_map" , ucerr , uc_engine , ctypes .c_uint64 , ctypes .c_size_t , ctypes .c_void_p , ctypes .c_void_p , ctypes .c_void_p , ctypes .c_void_p )
162- _setup_prototype (_uc , "uc_mem_map" , ucerr , uc_engine , ctypes .c_uint64 , ctypes .c_size_t , ctypes .c_uint32 )
163- _setup_prototype (_uc , "uc_mem_map_ptr" , ucerr , uc_engine , ctypes .c_uint64 , ctypes .c_size_t , ctypes .c_uint32 , ctypes .c_void_p )
164- _setup_prototype (_uc , "uc_mem_unmap" , ucerr , uc_engine , ctypes .c_uint64 , ctypes .c_size_t )
165- _setup_prototype (_uc , "uc_mem_protect" , ucerr , uc_engine , ctypes .c_uint64 , ctypes .c_size_t , ctypes .c_uint32 )
161+ _setup_prototype (_uc , "uc_mmio_map" , ucerr , uc_engine , ctypes .c_uint64 , ctypes .c_uint64 , ctypes .c_void_p , ctypes .c_void_p , ctypes .c_void_p , ctypes .c_void_p )
162+ _setup_prototype (_uc , "uc_mem_map" , ucerr , uc_engine , ctypes .c_uint64 , ctypes .c_uint64 , ctypes .c_uint32 )
163+ _setup_prototype (_uc , "uc_mem_map_ptr" , ucerr , uc_engine , ctypes .c_uint64 , ctypes .c_uint64 , ctypes .c_uint32 , ctypes .c_void_p )
164+ _setup_prototype (_uc , "uc_mem_unmap" , ucerr , uc_engine , ctypes .c_uint64 , ctypes .c_uint64 )
165+ _setup_prototype (_uc , "uc_mem_protect" , ucerr , uc_engine , ctypes .c_uint64 , ctypes .c_uint64 , ctypes .c_uint32 )
166166_setup_prototype (_uc , "uc_query" , ucerr , uc_engine , ctypes .c_uint32 , ctypes .POINTER (ctypes .c_size_t ))
167167_setup_prototype (_uc , "uc_context_alloc" , ucerr , uc_engine , ctypes .POINTER (uc_context ))
168168_setup_prototype (_uc , "uc_free" , ucerr , ctypes .c_void_p )
@@ -593,7 +593,7 @@ def _mmio_map_write_cb(self, handle, offset, size, value, user_data):
593593        (cb , data ) =  self ._callbacks [user_data ]
594594        cb (self , offset , size , value , data )
595595
596-     def  mmio_map (self , address : int , size : int ,  
596+     def  mmio_map (self , address : int , size : int ,
597597                 read_cb : UC_MMIO_READ_TYPE , user_data_read : Any ,
598598                 write_cb : UC_MMIO_WRITE_TYPE , user_data_write : Any ):
599599        internal_read_cb  =  ctypes .cast (UC_MMIO_READ_CB (self ._mmio_map_read_cb ), UC_MMIO_READ_CB )
@@ -609,7 +609,7 @@ def mmio_map(self, address: int, size: int,
609609        status  =  _uc .uc_mmio_map (self ._uch , address , size , internal_read_cb , read_count , internal_write_cb , write_count )
610610        if  status  !=  uc .UC_ERR_OK :
611611            raise  UcError (status )
612-          
612+ 
613613        # https://docs.python.org/3/library/ctypes.html#callback-functions 
614614        self ._ctype_cbs .append (internal_read_cb )
615615        self ._ctype_cbs .append (internal_write_cb )
@@ -731,12 +731,12 @@ def __ctl(self, ctl, nr, rw):
731731
732732    def  __ctl_r (self , ctl , nr ):
733733        return  self .__ctl (ctl , nr , uc .UC_CTL_IO_READ )
734-      
734+ 
735735    def  __ctl_w (self , ctl , nr ):
736736        return  self .__ctl (ctl , nr , uc .UC_CTL_IO_WRITE )
737-      
737+ 
738738    def  __ctl_rw (self , ctl , nr ):
739-         return  self .__ctl (ctl , nr , uc .UC_CTL_IO_READ_WRITE )  
739+         return  self .__ctl (ctl , nr , uc .UC_CTL_IO_READ_WRITE )
740740
741741    def  __ctl_r_1_arg (self , ctl , ctp ):
742742        arg  =  ctp ()
@@ -746,7 +746,7 @@ def __ctl_r_1_arg(self, ctl, ctp):
746746    def  __ctl_w_1_arg (self , ctl , val , ctp ):
747747        arg  =  ctp (val )
748748        self .ctl (self .__ctl_w (ctl , 1 ), arg )
749-      
749+ 
750750    def  __ctl_w_2_arg (self , ctl , val1 , val2 , ctp1 , ctp2 ):
751751        arg1  =  ctp1 (val1 )
752752        arg2  =  ctp2 (val2 )
@@ -763,7 +763,7 @@ def ctl_get_mode(self):
763763
764764    def  ctl_get_page_size (self ):
765765        return  self .__ctl_r_1_arg (uc .UC_CTL_UC_PAGE_SIZE , ctypes .c_uint32 )
766-      
766+ 
767767    def  ctl_set_page_size (self , val : int ):
768768        self .__ctl_w_1_arg (uc .UC_CTL_UC_PAGE_SIZE , val , ctypes .c_uint32 )
769769
@@ -772,10 +772,10 @@ def ctl_get_arch(self):
772772
773773    def  ctl_get_timeout (self ):
774774        return  self .__ctl_r_1_arg (uc .UC_CTL_UC_TIMEOUT , ctypes .c_uint64 )
775-      
775+ 
776776    def  ctl_exits_enabled (self , val : bool ):
777777        self .__ctl_w_1_arg (uc .UC_CTL_UC_USE_EXITS , val , ctypes .c_int )
778-      
778+ 
779779    def  ctl_get_exits_cnt (self ):
780780        return  self .__ctl_r_1_arg (uc .UC_CTL_UC_EXITS_CNT , ctypes .c_size_t )
781781
@@ -793,7 +793,7 @@ def ctl_set_exits(self, exits: List[int]):
793793
794794    def  ctl_get_cpu_model (self ):
795795        return  self .__ctl_r_1_arg (uc .UC_CTL_CPU_MODEL , ctypes .c_int )
796-      
796+ 
797797    def  ctl_set_cpu_model (self , val : int ):
798798        self .__ctl_w_1_arg (uc .UC_CTL_CPU_MODEL , val , ctypes .c_int )
799799
@@ -802,7 +802,7 @@ def ctl_remove_cache(self, addr: int, end: int):
802802
803803    def  ctl_request_cache (self , addr : int ):
804804        return  self .__ctl_rw_1_1_arg (uc .UC_CTL_TB_REQUEST_CACHE , addr , ctypes .c_uint64 , uc_tb )
805-      
805+ 
806806    def  ctl_flush_tb (self ):
807807        self .ctl (self .__ctl_w (uc .UC_CTL_TB_FLUSH , 0 ))
808808
@@ -963,7 +963,7 @@ def size(self):
963963    @property  
964964    def  arch (self ):
965965        return  self ._arch 
966-      
966+ 
967967    @property  
968968    def  mode (self ):
969969        return  self ._mode 
@@ -1012,11 +1012,11 @@ def __del__(self):
10121012UC_HOOK_TCG_OPCODE_TYPE  =  Callable [[Uc , int , int , int , Any ], None ]
10131013
10141014UC_HOOK_CALLBACK_TYPE  =  Union [
1015-     UC_HOOK_CODE_TYPE ,  
1016-     UC_HOOK_INSN_INVALID_TYPE ,  
1017-     UC_HOOK_MEM_INVALID_TYPE ,  
1018-     UC_HOOK_MEM_ACCESS_TYPE ,  
1019-     UC_HOOK_INSN_IN_TYPE ,  
1015+     UC_HOOK_CODE_TYPE ,
1016+     UC_HOOK_INSN_INVALID_TYPE ,
1017+     UC_HOOK_MEM_INVALID_TYPE ,
1018+     UC_HOOK_MEM_ACCESS_TYPE ,
1019+     UC_HOOK_INSN_IN_TYPE ,
10201020    UC_HOOK_INSN_OUT_TYPE ,
10211021    UC_HOOK_INSN_SYSCALL_TYPE ,
10221022    UC_HOOK_INSN_SYS_TYPE ,
0 commit comments