about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAjax <commial@gmail.com>2015-11-17 15:43:16 +0100
committerAjax <commial@gmail.com>2015-11-17 16:04:43 +0100
commit0d9d0b98b017a418b538187127ae5af7594870d5 (patch)
tree5811966bf41eb6be140c96b359791c7de5ba4a90
parentc7cb2e669362d4029484ba015bb246bf561dedf6 (diff)
downloadmiasm-0d9d0b98b017a418b538187127ae5af7594870d5.tar.gz
miasm-0d9d0b98b017a418b538187127ae5af7594870d5.zip
x86/sem: add 'iret[d]' user-land
Diffstat (limited to '')
-rw-r--r--miasm2/arch/x86/sem.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/miasm2/arch/x86/sem.py b/miasm2/arch/x86/sem.py
index 324145a6..800a1fa2 100644
--- a/miasm2/arch/x86/sem.py
+++ b/miasm2/arch/x86/sem.py
@@ -3422,6 +3422,18 @@ def ucomiss(ir, instr, a, b):
 
     return e, []
 
+
+def iret(ir, instr):
+    """IRET implementation
+    XXX: only support "no-privilege change"
+    """
+    size = instr.v_opmode()
+    exprs, _ = retf(ir, instr, m2_expr.ExprInt(size / 8, size=size))
+    tmp = mRSP[instr.mode][:size] + m2_expr.ExprInt((2 * size) / 8, size=size)
+    exprs += _tpl_eflags(tmp)
+    return exprs, []
+
+
 mnemo_func = {'mov': mov,
               'xchg': xchg,
               'movzx': movzx,
@@ -3518,6 +3530,8 @@ mnemo_func = {'mov': mov,
               'call': call,
               'ret': ret,
               'retf': retf,
+              'iret': iret,
+              'iretd': iret,
               'leave': leave,
               'enter': enter,
               'jmp': jmp,