about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorserpilliere <devnull@localhost>2014-08-01 14:53:29 +0200
committerserpilliere <devnull@localhost>2014-08-01 14:53:29 +0200
commita845de1faf31228bd8279d11d780f80def64af9d (patch)
tree8218b8640a384aee020f715a73c0c62bb8a04a12
parenta38102f1a05a36e95950785e1b2a9354eeef02f2 (diff)
downloadmiasm-a845de1faf31228bd8279d11d780f80def64af9d.tar.gz
miasm-a845de1faf31228bd8279d11d780f80def64af9d.zip
Arm arch: add sxtb/sxth (tx to t.pourcelot)
-rw-r--r--miasm2/arch/arm/arch.py3
-rw-r--r--miasm2/arch/arm/sem.py19
2 files changed, 22 insertions, 0 deletions
diff --git a/miasm2/arch/arm/arch.py b/miasm2/arch/arm/arch.py
index dd0cf665..348820db 100644
--- a/miasm2/arch/arm/arch.py
+++ b/miasm2/arch/arm/arch.py
@@ -1470,6 +1470,9 @@ armop("qadd",
 
 armop("uxtb", [bs('01101110'), bs('1111'), rd, rot_rm, bs('00'), bs('0111'), rm_noarg])
 armop("uxth", [bs('01101111'), bs('1111'), rd, rot_rm, bs('00'), bs('0111'), rm_noarg])
+armop("sxtb", [bs('01101010'), bs('1111'), rd, rot_rm, bs('00'), bs('0111'), rm_noarg])
+armop("sxth", [bs('01101011'), bs('1111'), rd, rot_rm, bs('00'), bs('0111'), rm_noarg])
+
 
 class arm_widthm1(arm_imm, m_arg):
     def decode(self, v):
diff --git a/miasm2/arch/arm/sem.py b/miasm2/arch/arm/sem.py
index 07db3cfb..9608c1f0 100644
--- a/miasm2/arch/arm/sem.py
+++ b/miasm2/arch/arm/sem.py
@@ -826,6 +826,23 @@ def uxth(ir, instr, a, b):
         dst = PC
     return dst, e
 
+def sxtb(ir, instr, a, b):
+    e = []
+    e.append(ExprAff(a, b[:8].signExtend(32)))
+    dst = None
+    if PC in a.get_r():
+        dst = PC
+    return dst, e
+
+def sxth(ir, instr, a, b):
+    e = []
+    e.append(ExprAff(a, b[:16].signExtend(32)))
+    dst = None
+    if PC in a.get_r():
+        dst = PC
+    return dst, e
+
+
 def ubfx(ir, instr, a, b, c, d):
     e = []
     c = int(c.arg)
@@ -966,6 +983,8 @@ mnemo_condm0 = {'add': add,
                 'ldsh': ldrsh,
                 'uxtb': uxtb,
                 'uxth': uxth,
+                'sxtb': sxtb,
+                'sxth': sxth,
                 'ubfx': ubfx,
                 }