5 Quick implementation of miasm traduction to stp langage
11 b = bin(int(self.arg))[2::][::-1]
13 b = b[:self.size][::-1]
22 return op +
'(' + str(size) +
',' + a +
', ' + b +
')'
26 return op +
'(' + a +
', ' + b +
')'
34 return '(' + op_dct[op].join([x.strcst()
for x
in self.args]) +
')'
35 op_dct = {
"-":
"BVUMINUS"}
37 return op_dct[op] +
'(' + self.args[0].strcst() +
')'
38 op_dct = {
"^": (
"BVXOR", genop_nosize),
39 "+": (
"BVPLUS", genop)}
41 raise ValueError(
'implement op', op)
43 args = [x.strcst()
for x
in self.args][::-1]
46 size = self.args[0].size
47 out = f(op, size, a, b)
49 out = f(op, size, out, args.pop())
54 return '(' + self.arg.strcst() +
')[%d:%d]' % (self.stop - 1, self.start)
58 cond = self.cond.strcst()
59 src1 = self.src1.strcst()
60 src2 = self.src2.strcst()
61 return "(IF %s=(%s) THEN %s ELSE %s ENDIF)" % (
62 "0bin%s" % (
'0' * self.cond.size), cond, src2, src1)
64 ExprInt.strcst = ExprInt_strcst
65 ExprId.strcst = ExprId_strcst
66 ExprOp.strcst = ExprOp_strcst
67 ExprCond.strcst = ExprCond_strcst
68 ExprSlice.strcst = ExprSlice_strcst