diff options
| -rw-r--r-- | README.md | 37 | ||||
| -rw-r--r-- | miasm2/arch/arm/arch.py | 1 | ||||
| -rw-r--r-- | miasm2/arch/arm/sem.py | 23 | ||||
| -rw-r--r-- | miasm2/expression/expression.py | 2 | ||||
| -rw-r--r-- | miasm2/jitter/Jittcc.c | 2 | ||||
| -rw-r--r-- | test/arch/arm/arch.py | 3 |
6 files changed, 38 insertions, 30 deletions
diff --git a/README.md b/README.md index 2a097305..e50ff3ba 100644 --- a/README.md +++ b/README.md @@ -456,34 +456,15 @@ sudo python setup.py install ``` * To use the jitter, TCC or LLVM is recommended -* LibTCC needs a little fix in the `Makefile`: - * remove libtcc-dev from the system to avoid conflicts - * clone [tinycc release_0_9_26](http://repo.or.cz/w/tinycc.git/snapshot/d5e22108a0dc48899e44a158f91d5b3215eb7fe6.tar.gz) - * edit the `Makefile` - * add option `-fPIC` to the `CFLAGS` definition: `CFLAGS+= -fPIC` - -``` -# -# Tiny C Compiler Makefile -# - -TOP ?= . -include $(TOP)/config.mak -VPATH = $(top_srcdir) - -CPPFLAGS = -I$(TOP) # for config.h - -# ADD NEXT LINE: -CFLAGS+= -fPIC -... -``` - - * `./configure && make && make install` - * LLVM - * Debian (testing/unstable): install python-llvm - * Debian stable/Ubuntu/Kali/whatever: install from [llvmpy](http://www.llvmpy.org/) - * Windows: python-llvm is not supported :/ - * Build and install Miasm: +* LibTCC needs to be configured with the `--disable-static` option + * remove `libtcc-dev` from the system to avoid conflicts + * clone [TinyCC](http://repo.or.cz/tinycc.git) + * `./configure --disable-static && make && make install` +* LLVM + * Debian (testing/unstable): install python-llvm + * Debian stable/Ubuntu/Kali/whatever: install from [llvmpy](http://www.llvmpy.org/) + * Windows: python-llvm is not supported :/ +* Build and install Miasm: ``` $ cd miasm_directory $ python setup.py build 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/miasm2/expression/expression.py b/miasm2/expression/expression.py index af932512..74d67b5d 100644 --- a/miasm2/expression/expression.py +++ b/miasm2/expression/expression.py @@ -525,7 +525,7 @@ class ExprCond(Expr): self._size = self.src1.size def __str__(self): - return "%s?(%s,%s)" % (str(self.cond), str(self.src1), str(self.src2)) + return "(%s?(%s,%s))" % (str(self.cond), str(self.src1), str(self.src2)) def get_r(self, mem_read=False, cst_read=False): out_src1 = self.src1.get_r(mem_read, cst_read) diff --git a/miasm2/jitter/Jittcc.c b/miasm2/jitter/Jittcc.c index 476b2048..a1310477 100644 --- a/miasm2/jitter/Jittcc.c +++ b/miasm2/jitter/Jittcc.c @@ -168,7 +168,7 @@ PyObject* tcc_compil(PyObject* self, PyObject* args) fprintf(stderr, "%s\n", func_code); exit(1); } - /* XXX use tinycc devel with -fPIC patch in makefile */ + /* XXX configure tinycc install with --disable-static */ if (tcc_relocate(tcc_state, TCC_RELOCATE_AUTO) < 0) { fprintf(stderr, "tcc relocate error\n"); exit(1); 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() |