about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorserpilliere <fabrice.desclaux@cea.fr>2015-10-17 23:51:20 +0200
committerFabrice Desclaux <fabrice.desclaux@cea.fr>2015-10-23 10:47:24 +0200
commit7c20bce0f4c97b21e9e2bf553c72585914531f69 (patch)
tree402a73ed6f0b23af80dd1ad126c89071025f7486
parent13ded7507b895f470f94dbc267c5e6409a96eaf8 (diff)
downloadmiasm-7c20bce0f4c97b21e9e2bf553c72585914531f69.tar.gz
miasm-7c20bce0f4c97b21e9e2bf553c72585914531f69.zip
Arch/x86/sem: add rdmsr/wrmsr
Diffstat (limited to '')
-rw-r--r--miasm2/arch/x86/sem.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/miasm2/arch/x86/sem.py b/miasm2/arch/x86/sem.py
index 93852a8e..1c5cd472 100644
--- a/miasm2/arch/x86/sem.py
+++ b/miasm2/arch/x86/sem.py
@@ -3105,6 +3105,21 @@ def xorps(ir, instr, a, b):
     e.append(m2_expr.ExprAff(a, m2_expr.ExprOp('^', a, b)))
     return e, []
 
+def rdmsr(ir, instr):
+    msr_addr = m2_expr.ExprId('MSR') + m2_expr.ExprInt32(8) * mRCX[instr.mode][:32]
+    e = []
+    e.append(m2_expr.ExprAff(mRAX[instr.mode][:32], m2_expr.ExprMem(msr_addr, 32)))
+    e.append(m2_expr.ExprAff(mRDX[instr.mode][:32], m2_expr.ExprMem(msr_addr + m2_expr.ExprInt_from(msr_addr, 4), 32)))
+    return e, []
+
+def wrmsr(ir, instr):
+    msr_addr = m2_expr.ExprId('MSR') + m2_expr.ExprInt32(8) * mRCX[instr.mode][:32]
+    e = []
+    src = m2_expr.ExprCompose([(mRAX[instr.mode][:32], 0, 32),
+                               (mRDX[instr.mode][:32], 32, 64)])
+    e.append(m2_expr.ExprAff(m2_expr.ExprMem(msr_addr, 64), src))
+    return e, []
+
 ### MMX/SSE/AVX operations
 ###
 
@@ -3597,7 +3612,10 @@ mnemo_func = {'mov': mov,
               ### Logical (floating-point)
               ###
 
-              "pand": pand
+              "pand": pand,
+
+              "rdmsr": rdmsr,
+              "wrmsr": wrmsr,
 
               }