1
- # Intel architecture classes and structures.
2
- #
1
+ """ Intel architecture classes and structures.
2
+ """
3
3
# @author elicn
4
4
5
- from typing import Any , Callable , Tuple
5
+ from typing import Any , Callable , Sequence , Tuple
6
6
7
7
import ctypes
8
8
9
- from .. import Uc , UcError
10
- from .. import x86_const as const
11
-
12
- from unicorn .unicorn_py3 import uccallback
9
+ # traditional unicorn imports
10
+ from unicorn import x86_const as const
13
11
from unicorn .unicorn_const import UC_ERR_ARG , UC_HOOK_INSN
12
+
13
+ # newly introduced unicorn imports
14
+ from ..unicorn import Uc , UcError , uccallback
14
15
from .types import uc_engine , UcTupledReg , UcReg128 , UcReg256 , UcReg512
15
16
16
17
X86MMRReg = Tuple [int , int , int , int ]
@@ -36,6 +37,9 @@ class UcRegMMR(UcTupledReg[X86MMRReg]):
36
37
37
38
38
39
class UcRegMSR (UcTupledReg [X86MSRReg ]):
40
+ """Intel Model Specific Register
41
+ """
42
+
39
43
_fields_ = (
40
44
('rid' , ctypes .c_uint32 ),
41
45
('val' , ctypes .c_uint64 )
@@ -47,6 +51,9 @@ def value(self) -> int:
47
51
48
52
49
53
class UcRegFPR (UcTupledReg [X86FPReg ]):
54
+ """Intel Floating Point Register
55
+ """
56
+
50
57
_fields_ = (
51
58
('mantissa' , ctypes .c_uint64 ),
52
59
('exponent' , ctypes .c_uint16 )
@@ -176,3 +183,11 @@ def msr_read(self, msr_id: int) -> int:
176
183
177
184
def msr_write (self , msr_id : int , value : int ) -> None :
178
185
self ._reg_write (const .UC_X86_REG_MSR , UcRegMSR , (msr_id , value ))
186
+
187
+ def reg_read_batch (self , reg_ids : Sequence [int ]) -> Tuple :
188
+ reg_types = [UcIntel .__select_reg_class (rid ) or self ._DEFAULT_REGTYPE for rid in reg_ids ]
189
+
190
+ return self ._reg_read_batch (reg_ids , reg_types )
191
+
192
+
193
+ __all__ = ['UcRegMMR' , 'UcRegMSR' , 'UcRegFPR' , 'UcIntel' ]
0 commit comments