diff options
| author | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2014-10-06 13:34:26 +0200 |
|---|---|---|
| committer | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2014-10-06 13:34:26 +0200 |
| commit | 35bde6dab646a60562ce0c17255bac34e0343660 (patch) | |
| tree | a0a55a649a4809ba4c1085999cd7c14942e671cd /miasm2/arch/x86/sem.py | |
| parent | c50b122faf42d146c084525ac3c1b03cec4bda20 (diff) | |
| download | miasm-35bde6dab646a60562ce0c17255bac34e0343660.tar.gz miasm-35bde6dab646a60562ce0c17255bac34e0343660.zip | |
Arm: fix carry flag in sub operation; update reg tests
Diffstat (limited to 'miasm2/arch/x86/sem.py')
| -rw-r--r-- | miasm2/arch/x86/sem.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/miasm2/arch/x86/sem.py b/miasm2/arch/x86/sem.py index 781b3321..b192ee2c 100644 --- a/miasm2/arch/x86/sem.py +++ b/miasm2/arch/x86/sem.py @@ -123,13 +123,14 @@ def arith_flag(a, b, c): # checked: ok for adc add because b & c before +cf +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_cf(a, b, c): - return ExprAff(cf, (((a ^ b) ^ c) ^ ((a ^ c) & (~(a ^ b)))).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 |