about summary refs log tree commit diff stats
path: root/src/miasm/arch/x86/sem.py
diff options
context:
space:
mode:
authorTheofilos Augoustis <theofilos.augoustis@gmail.com>2025-10-16 13:26:57 +0000
committerTheofilos Augoustis <theofilos.augoustis@gmail.com>2025-10-16 13:26:57 +0000
commit083c88f096d1b654069eff874356df7b2ecd4606 (patch)
treeba0285a9741808f5912575d887c9ffc93c3f6411 /src/miasm/arch/x86/sem.py
parent2aee2e1313847cfbf88acd07143456e51989860c (diff)
downloadfocaccia-miasm-083c88f096d1b654069eff874356df7b2ecd4606.tar.gz
focaccia-miasm-083c88f096d1b654069eff874356df7b2ecd4606.zip
Add implementation for xgetbv with XCR0 ta/x86-xgetbv
Diffstat (limited to 'src/miasm/arch/x86/sem.py')
-rw-r--r--src/miasm/arch/x86/sem.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/miasm/arch/x86/sem.py b/src/miasm/arch/x86/sem.py
index d19290b6..26b87110 100644
--- a/src/miasm/arch/x86/sem.py
+++ b/src/miasm/arch/x86/sem.py
@@ -5259,6 +5259,17 @@ def fxrstor(_ir, _instr, _dst):
     # Implemented as a NOP for now
     return [], []
 
+# TODO: set initial state for XCR0
+def xgetbv(ir, inst):
+    e = []
+    index = mRCX[32]
+    dst_hi = mRDX[32]
+    dst_lo = mRAX[32]
+
+    e.append(m2_expr.ExprAssign(dst_lo, XCR0[:32]))
+    e.append(m2_expr.ExprAssign(dst_hi, XCR0[32:]))
+
+    return e, []
 
 mnemo_func = {'mov': mov,
               'xchg': xchg,
@@ -5875,6 +5886,10 @@ mnemo_func = {'mov': mov,
               "endbr32": endbr32,
               "fxsave": fxsave,
               "fxrstor": fxrstor,
+
+              # XCR
+              # TODO: is this the right place?
+              "xgetbv": xgetbv,
               }