def dw_op_breg(obj, data, _num): data = pack(data) result, blen = read_sleb128(data) sz = env.op_ptr.size offset = env.cst(result, blen * 8).signextend(sz) obj.operands = [env.reg("reg%d" % _num, sz) + offset] obj.bytes += data[:blen] obj.type = type_data_processing
def dw_op_bregx(obj, data): data = pack(data) indx, blen = read_leb128(data) sz = env.op_ptr.size r = env.reg("reg%d" % indx, sz) obj.bytes += data[:blen] data = data[blen:] result, blen = read_sleb128(data) offset = env.cst(result, blen * 8).signextend(sz) obj.operands = [r + offset] obj.bytes += data[:blen] obj.type = type_data_processing
def dw_op_block(obj, data): data = pack(data) bt = data[0] if bt == 0x40: obj.bt = 0x40 obj.bytes += data[0:1] elif bt in env.valtype: obj.bt = env.valtype[bt] obj.bytes += data[0:1] else: obj.bt, blen = read_sleb128(data) obj.bytes += data[0:blen] obj.operands = [obj.bt] obj.type = type_control_flow