diff --git a/bindings/python/unicorn/unicorn_py3/arch/arm.py b/bindings/python/unicorn/unicorn_py3/arch/arm.py index 46c00c7a..6df9ec98 100644 --- a/bindings/python/unicorn/unicorn_py3/arch/arm.py +++ b/bindings/python/unicorn/unicorn_py3/arch/arm.py @@ -1,5 +1,5 @@ -# AArch32 classes and structures. -# +"""AArch32 classes and structures. +""" # @author elicn from typing import Any, Tuple diff --git a/bindings/python/unicorn/unicorn_py3/arch/arm64.py b/bindings/python/unicorn/unicorn_py3/arch/arm64.py index c2b94f59..8e066ace 100644 --- a/bindings/python/unicorn/unicorn_py3/arch/arm64.py +++ b/bindings/python/unicorn/unicorn_py3/arch/arm64.py @@ -1,5 +1,5 @@ -# AArch64 classes and structures. -# +"""AArch64 classes and structures. +""" # @author elicn from typing import Any, Callable, NamedTuple, Tuple diff --git a/bindings/python/unicorn/unicorn_py3/arch/intel.py b/bindings/python/unicorn/unicorn_py3/arch/intel.py index ea341bc3..8198429a 100644 --- a/bindings/python/unicorn/unicorn_py3/arch/intel.py +++ b/bindings/python/unicorn/unicorn_py3/arch/intel.py @@ -1,5 +1,5 @@ -# Intel architecture classes and structures. -# +"""Intel architecture classes and structures. +""" # @author elicn from typing import Any, Callable, Sequence, Tuple @@ -37,6 +37,9 @@ class UcRegMMR(UcTupledReg[X86MMRReg]): class UcRegMSR(UcTupledReg[X86MSRReg]): + """Intel Model Specific Register + """ + _fields_ = ( ('rid', ctypes.c_uint32), ('val', ctypes.c_uint64) @@ -48,6 +51,9 @@ class UcRegMSR(UcTupledReg[X86MSRReg]): class UcRegFPR(UcTupledReg[X86FPReg]): + """Intel Floating Point Register + """ + _fields_ = ( ('mantissa', ctypes.c_uint64), ('exponent', ctypes.c_uint16) diff --git a/bindings/python/unicorn/unicorn_py3/arch/types.py b/bindings/python/unicorn/unicorn_py3/arch/types.py index 8c0a9b63..8e7114c6 100644 --- a/bindings/python/unicorn/unicorn_py3/arch/types.py +++ b/bindings/python/unicorn/unicorn_py3/arch/types.py @@ -1,5 +1,5 @@ -# Common types and structures. -# +"""Common types and structures. +""" # @author elicn from abc import abstractmethod @@ -81,14 +81,23 @@ class UcLargeReg(UcReg): class UcReg128(UcLargeReg): + """Large register holding a 128-bit value. + """ + _fields_ = [('qwords', ctypes.c_uint64 * 2)] class UcReg256(UcLargeReg): + """Large register holding a 256-bit value. + """ + _fields_ = [('qwords', ctypes.c_uint64 * 4)] class UcReg512(UcLargeReg): + """Large register holding a 512-bit value. + """ + _fields_ = [('qwords', ctypes.c_uint64 * 8)] diff --git a/bindings/python/unicorn/unicorn_py3/unicorn.py b/bindings/python/unicorn/unicorn_py3/unicorn.py index 7460edb9..11df76a0 100644 --- a/bindings/python/unicorn/unicorn_py3/unicorn.py +++ b/bindings/python/unicorn/unicorn_py3/unicorn.py @@ -1,3 +1,7 @@ +"""New and improved Unicorn Python bindings by elicn +based on Nguyen Anh Quynnh's work +""" + from __future__ import annotations from typing import TYPE_CHECKING, Any, Callable, Iterable, Iterator, Mapping, MutableMapping, Optional, Sequence, Tuple, Type, TypeVar @@ -111,7 +115,7 @@ def __load_uc_lib() -> ctypes.CDLL: T = TypeVar('T') def __pick_first_valid(iter: Iterable[T]) -> Optional[T]: - """Iterate till encountering a non-None element + """Iterate till encountering a non-None element and return it. """ return next((elem for elem in iter if elem is not None), None)