node/lib/metasm/metasm/cpu/ia32/parse.rb
def parse_instruction_fixup(i)
		if m = i.args.grep(ModRM).first and not m.sz
			if i.opname == 'movzx' or i.opname == 'movsx'
				m.sz = 8
			else
				if r = i.args.grep(Reg).first
					m.sz = r.sz
				elsif l = opcode_list_byname[i.opname].map { |o| o.props[:argsz] }.uniq and l.length == 1 and l.first
					m.sz = l.first
				else
					# this is also the size of ctrlreg/dbgreg etc
					# XXX fpu/simd ?
					m.sz = i.prefix[:sz] || @size
				end
			end
		end
		if m and not m.adsz
			if opcode_list_byname[i.opname].all? { |o| o.props[:adsz] }
				m.adsz = opcode_list_byname[i.opname].first.props[:adsz]
			else
				m.adsz = i.prefix[:sz] || @size
			end
		end
	end
# fixup the sz of a modrm argument, defaults to other argument size or current cpu mode
fixup the sz of a modrm argument, defaults to other argument size or current cpu mode
fixup the sz of a modrm argument defaults to other argument size or current cpu mode
def parse_instruction_fixup(i)
		if m = i.args.grep(ModRM).first and not m.sz
			if i.opname == 'movzx' or i.opname == 'movsx'
				m.sz = 8
			else
				if r = i.args.grep(Reg).first
					m.sz = r.sz
				elsif l = opcode_list_byname[i.opname].map { |o| o.props[:argsz] }.uniq and l.length == 1 and l.first
					m.sz = l.first
				else
					m.sz = i.prefix[:sz] || @size
				end
			end
		end
		if m and not m.adsz
			if opcode_list_byname[i.opname].all? { |o| o.props[:adsz] }
				m.adsz = opcode_list_byname[i.opname].first.props[:adsz]
			else
				m.adsz = i.prefix[:sz] || @size
			end
		end
	end
def parse_instruction_fixup ( i ) if m = i . args . grep ( ModRM ) . first and not m . sz if i . opname == 'movzx' or i . opname == 'movsx' m . sz = 8 else if r = i . args . grep ( Reg ) . first m . sz = r . sz elsif l = opcode_list_byname [ i . opname ] . map { | o | o . props [ :argsz ] } . uniq and l . length == 1 and l . first m . sz = l . first else m . sz = i . prefix [ :sz ] || @size end end end if m and not m . adsz if opcode_list_byname [ i . opname ] . all? { | o | o . props [ :adsz ] } m . adsz = opcode_list_byname [ i . opname ] . first . props [ :adsz ] else m . adsz = i . prefix [ :sz ] || @size end end end
fixup the sz of a modrm argument, defaults to other argument size or current cpu mode
fixup the sz of a modrm argument defaults to other argument size or current cpu mode
# this is also the size of ctrlreg/dbgreg etc # XXX fpu/simd ?
i