about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorserpilliere <serpilliere@users.noreply.github.com>2018-03-02 16:47:19 +0100
committerGitHub <noreply@github.com>2018-03-02 16:47:19 +0100
commita3013003b9f77b017036bd1d46797052d875efbe (patch)
treed09df6e2e33e9dfe096c2801fc160e1b444cfbc5
parent00e567eacd167047de5b088a94f554473e7ca505 (diff)
parent88d495e26474935cb656e2d84747b37568baa9a3 (diff)
downloadmiasm-a3013003b9f77b017036bd1d46797052d875efbe.tar.gz
miasm-a3013003b9f77b017036bd1d46797052d875efbe.zip
Merge pull request #689 from a-vincent/fix-ppc-branch
Fix semantics of conditional jumps
-rw-r--r--miasm2/arch/ppc/sem.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/miasm2/arch/ppc/sem.py b/miasm2/arch/ppc/sem.py
index 76a1a27e..3c9d0e83 100644
--- a/miasm2/arch/ppc/sem.py
+++ b/miasm2/arch/ppc/sem.py
@@ -704,11 +704,11 @@ def mn_do_cond_branch(ir, instr, dest):
     bo = instr.additional_info.bo
     bi = instr.additional_info.bi
     ret = []
-    if not (bo & 0b00100):
-        ret.append(ExprAff(CTR, CTR - ExprInt(1, 32)))
-    if (bo & 0b10100) == 0b10100:
+
+    if bo & 0b00100:
         ctr_cond = True
     else:
+        ret.append(ExprAff(CTR, CTR - ExprInt(1, 32)))
         ctr_cond = ExprCond(CTR ^ ExprInt(1, 32), ExprInt(1, 1), ExprInt(0, 1))
         if bo & 0b00010:
             ctr_cond = ~ctr_cond