about summary refs log tree commit diff stats
path: root/miasm2/arch/arm/sem.py
diff options
context:
space:
mode:
Diffstat (limited to 'miasm2/arch/arm/sem.py')
-rw-r--r--miasm2/arch/arm/sem.py23
1 files changed, 7 insertions, 16 deletions
diff --git a/miasm2/arch/arm/sem.py b/miasm2/arch/arm/sem.py
index 8f176947..72625eab 100644
--- a/miasm2/arch/arm/sem.py
+++ b/miasm2/arch/arm/sem.py
@@ -12,22 +12,13 @@ EXCEPT_PRIV_INSN = (1 << 17)
 
 
 def update_flag_zf(a):
-    return [ExprAff(zf, ExprCond(a, ExprInt_from(zf, 0), ExprInt_from(zf, 1)))]
+    return [ExprAff(zf, ExprCond(a, ExprInt1(0), ExprInt1(1)))]
 
 
 def update_flag_nf(a):
     return [ExprAff(nf, a.msb())]
 
 
-def update_flag_pf(a):
-    return [ExprAff(pf, ExprOp('parity', a))]
-
-
-def update_flag_af(a):
-    return [ExprAff(af, ExprCond(a & ExprInt_from(a, 0x10),
-                                 ExprInt_from(af, 1), ExprInt_from(af, 0)))]
-
-
 def update_flag_zn(a):
     e = []
     e += update_flag_zf(a)
@@ -61,14 +52,14 @@ def arith_flag(a, b, c):
 
 # checked: ok for adc add because b & c before +cf
 
-
-def update_flag_add_cf(a, b, c):
-    return ExprAff(cf,
-        ((((a ^ b) ^ c) ^ ((a ^ c) & (~(a ^ b)))).msb()) ^ ExprInt1(1))
+def update_flag_add_cf(op1, op2, res):
+    "Compute cf in @res = @op1 + @op2"
+    return ExprAff(cf, (((op1 ^ op2) ^ res) ^ ((op1 ^ res) & (~(op1 ^ op2)))).msb())
 
 
-def update_flag_add_of(a, b, c):
-    return ExprAff(of, (((a ^ c) & (~(a ^ b)))).msb())
+def update_flag_add_of(op1, op2, res):
+    "Compute of in @res = @op1 + @op2"
+    return ExprAff(of, (((op1 ^ res) & (~(op1 ^ op2)))).msb())
 
 
 # checked: ok for sbb add because b & c before +cf