node/lib/metasm/metasm/cpu/x86_64/parse.rb
# check if the argument matches the opcode's argument spec
check if the argument matches the opcode's argument spec
check if the argument matches the opcode ' s argument spec
def parse_arg_valid?(o, spec, arg)
		return if arg.kind_of? ModRM and ((arg.b and arg.b.val == 16 and arg.i) or (arg.i and arg.i.val == 16 and (arg.b or arg.s != 1)))
		return if arg.kind_of? Reg and arg.sz >= 32 and arg.val == 16	
		return if o.props[:auto64] and arg.respond_to? :sz and arg.sz == 32
		return if o.fields[:vex_r] and not o.fields[:vex_b] and (spec == :modrm or spec == :modrmxmm or spec == :modrmymm) and (((arg.kind_of?(SimdReg) or arg.kind_of?(Reg)) and arg.val >= 8) or (arg.kind_of?(ModRM) and ((arg.b and arg.b.val >= 8) or (arg.i and arg.i.val >= 8))))
		if o.name == 'movsxd'
			return if not arg.kind_of? Reg and not arg.kind_of? ModRM
			arg.sz ||= 32
			if spec == :reg
				return if not arg.kind_of? Reg
				return arg.sz >= 32
			else
				return arg.sz == 32
			end
		end
		return if o.name == 'xchg' and spec == :reg and o.args.include?(:reg_eax) and arg.kind_of?(Reg) and arg.sz == 32 and arg.val == 0
		super(o, spec, arg)
	end
def parse_arg_valid? ( o , spec , arg ) return if arg . kind_of? ModRM and ( ( arg . b and arg . b . val == 16 and arg . i ) or ( arg . i and arg . i . val == 16 and ( arg . b or arg . s != 1 ) ) ) return if arg . kind_of? Reg and arg . sz >= 32 and arg . val == 16 return if o . props [ :auto64 ] and arg . respond_to? :sz and arg . sz == 32 return if o . fields [ :vex_r ] and not o . fields [ :vex_b ] and ( spec == :modrm or spec == :modrmxmm or spec == :modrmymm ) and ( ( ( arg . kind_of? ( SimdReg ) or arg . kind_of? ( Reg ) ) and arg . val >= 8 ) or ( arg . kind_of? ( ModRM ) and ( ( arg . b and arg . b . val >= 8 ) or ( arg . i and arg . i . val >= 8 ) ) ) ) if o . name == 'movsxd' return if not arg . kind_of? Reg and not arg . kind_of? ModRM arg . sz ||= 32 if spec == :reg return if not arg . kind_of? Reg return arg . sz >= 32 else return arg . sz == 32 end end return if o . name == 'xchg' and spec == :reg and o . args . include? ( :reg_eax ) and arg . kind_of? ( Reg ) and arg . sz == 32 and arg . val == 0 super ( o , spec , arg ) end
check if the argument matches the opcode's argument spec
check if the argument matches the opcode ' s argument spec
# eip/rip only in modrm # vex c4/c5
o
spec
arg