diff options
| author | Camille Mougey <commial@gmail.com> | 2015-01-13 16:30:03 +0100 |
|---|---|---|
| committer | Camille Mougey <commial@gmail.com> | 2015-01-13 16:30:03 +0100 |
| commit | 5d79d9f9e23dad67e0e78df1723d35ba9f041cbf (patch) | |
| tree | a9b30c494b3e0c6d4df136ac4b44e47a09694a15 | |
| parent | 328c0f8f1c08a6412fe2083bfdc09f941f5ceb2e (diff) | |
| parent | 5c45840909c9ef005bda6952ad270f70953f6d74 (diff) | |
| download | miasm-5d79d9f9e23dad67e0e78df1723d35ba9f041cbf.tar.gz miasm-5d79d9f9e23dad67e0e78df1723d35ba9f041cbf.zip | |
Merge pull request #34 from serpilliere/arm_add_instruction
Arm: add instruction bfc
| -rw-r--r-- | miasm2/arch/arm/arch.py | 1 | ||||
| -rw-r--r-- | miasm2/arch/arm/sem.py | 23 | ||||
| -rw-r--r-- | test/arch/arm/arch.py | 3 |
3 files changed, 27 insertions, 0 deletions
diff --git a/miasm2/arch/arm/arch.py b/miasm2/arch/arm/arch.py index 73b198ba..f0e32834 100644 --- a/miasm2/arch/arm/arch.py +++ b/miasm2/arch/arm/arch.py @@ -1528,6 +1528,7 @@ lsb = bs(l=5, cls=(arm_imm, m_arg)) armop("ubfx", [bs('0111111'), widthm1, rd, lsb, bs('101'), rn], [rd, rn, lsb, widthm1]) +armop("bfc", [bs('0111110'), widthm1, rd, lsb, bs('001'), bs('1111')], [rd, lsb, widthm1]) # # thumnb ####################### # 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, diff --git a/test/arch/arm/arch.py b/test/arch/arm/arch.py index 533b2052..5e3feb1d 100644 --- a/test/arch/arm/arch.py +++ b/test/arch/arm/arch.py @@ -237,6 +237,9 @@ reg_tests_arm = [ ("XXXXXXXX UXTH R0, R2", "7200FFE6"), + ("XXXXXXXX BFC R0, 0x0, 0xD", + "1f00cce7"), + ] ts = time.time() |