node/lib/metasm/metasm/cpu/mips/decode.rb
# converts relative branch offsets to absolute addresses
# else just add the offset +off+ of the instruction + its length (off may be an Expression)
# assumes edata.ptr points just after the instruction (as decode_instr_op left it)
# do not call twice on the same di !
converts relative branch offsets to absolute addresses
else just add the offset +off+ of the instruction + its length (off may be an Expression)
assumes edata.ptr points just after the instruction (as decode_instr_op left it)
do not call twice on the same di !
converts relative branch offsets to absolute addresses else just add the offset + off + of the instruction + its length ( off may be an Expression ) assumes edata . ptr points just after the instruction ( as decode_instr_op left it ) do not call twice on the same di !
def decode_instr_interpret(di, addr)
		if di.opcode.props[:setip] and di.instruction.args.last.kind_of? Expression and di.opcode.name[0] != ?t
			delta = Expression[di.instruction.args.last, :<<, 2].reduce
			if di.opcode.args.include? :i26
				if delta.kind_of? Expression and delta.op == :& and delta.rexpr == 0x3ff_fffc
					arg = Expression[delta.lexpr].reduce
				else
					arg = Expression[[[addr, :+, di.bin_length], :&, 0xfc00_0000], :+, delta].reduce
				end
			else
				arg = Expression[[addr, :+, di.bin_length], :+, delta].reduce
			end
			di.instruction.args[-1] = Expression[arg]
		end
		di
	end
def decode_instr_interpret ( di , addr ) if di . opcode . props [ :setip ] and di . instruction . args . last . kind_of? Expression and di . opcode . name [ 0 ] != ?t delta = Expression [ di . instruction . args . last , :<< , 2 ] . reduce if di . opcode . args . include? :i26 if delta . kind_of? Expression and delta . op == :& and delta . rexpr == 0x3ff_fffc arg = Expression [ delta . lexpr ] . reduce else arg = Expression [ [ [ addr , :+ , di . bin_length ] , :& , 0xfc00_0000 ] , :+ , delta ] . reduce end else arg = Expression [ [ addr , :+ , di . bin_length ] , :+ , delta ] . reduce end di . instruction . args [ - 1 ] = Expression [ arg ] end di end
converts relative branch offsets to absolute addresses
else just add the offset +off+ of the instruction + its length (off may be an Expression)
assumes edata.ptr points just after the instruction (as decode_instr_op left it)
do not call twice on the same di !
converts relative branch offsets to absolute addresses else just add the offset + off + of the instruction + its length ( off may be an Expression ) assumes edata . ptr points just after the instruction ( as decode_instr_op left it ) do not call twice on the same di !
# absolute jump in the 0x3ff_ffff region surrounding next_pc # relocated arg: assume the linker mapped so that instr&target are in the same region
di
addr