about summary refs log tree commit diff stats
path: root/miasm2/arch/arm/sem.py
diff options
context:
space:
mode:
authorCamille Mougey <commial@gmail.com>2015-01-13 16:30:03 +0100
committerCamille Mougey <commial@gmail.com>2015-01-13 16:30:03 +0100
commit5d79d9f9e23dad67e0e78df1723d35ba9f041cbf (patch)
treea9b30c494b3e0c6d4df136ac4b44e47a09694a15 /miasm2/arch/arm/sem.py
parent328c0f8f1c08a6412fe2083bfdc09f941f5ceb2e (diff)
parent5c45840909c9ef005bda6952ad270f70953f6d74 (diff)
downloadmiasm-5d79d9f9e23dad67e0e78df1723d35ba9f041cbf.tar.gz
miasm-5d79d9f9e23dad67e0e78df1723d35ba9f041cbf.zip
Merge pull request #34 from serpilliere/arm_add_instruction
Arm: add instruction bfc
Diffstat (limited to '')
-rw-r--r--miasm2/arch/arm/sem.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/miasm2/arch/arm/sem.py b/miasm2/arch/arm/sem.py
index 751891ca..1ef0b624 100644
--- a/miasm2/arch/arm/sem.py
+++ b/miasm2/arch/arm/sem.py
@@ -871,6 +871,28 @@ def ubfx(ir, instr, a, b, c, d):
         e.append(ExprAff(ir.IRDst, r))
     return e
 
+def bfc(ir, instr, a, b, c):
+    e = []
+    start = int(b.arg)
+    stop = start + int(c.arg)
+    out = []
+    last = 0
+    if start:
+        out.append((a[:start], 0, start))
+        last = start
+    if stop - start:
+        out.append((ExprInt32(0)[last:stop], last, stop))
+        last = stop
+    if last < 32:
+        out.append((a[last:], last, 32))
+    r = ExprCompose(out)
+    e.append(ExprAff(a, r))
+    dst = None
+    if PC in a.get_r():
+        dst = PC
+        e.append(ExprAff(ir.IRDst, r))
+    return e
+
 
 
 COND_EQ = 0
@@ -1009,6 +1031,7 @@ mnemo_condm0 = {'add': add,
                 'sxtb': sxtb,
                 'sxth': sxth,
                 'ubfx': ubfx,
+                'bfc': bfc,
                 }
 
 mnemo_condm1 = {'adds': add,