node/lib/metasm/metasm/cpu/x86_64/opcodes.rb
# all x86_64 cpu understand <= sse2 instrs
all x86_64 cpu understand <= sse2 instrs
all x86_64 cpu understand < = sse2 instrs
def init_x8664_only
		init_386_common_only
		init_386_only
		init_387_only
		init_486_only
		init_pentium_only
		init_p6_only
		init_sse_only
		init_sse2_only
		@opcode_list.delete_if { |o|
			o.args.include?(:seg2) or
			o.args.include?(:seg2A) or
			o.args.include?(:farptr) or
			%w[aaa aad aam aas bound daa das into jcxz jecxz
			 lds les loadall arpl pusha pushad popa
			 popad].include?(o.name.split('.')[0])
		}
		@opcode_list.each { |o|
			o.props[:auto64] = true if o.name =~ /^(enter|leave|[sl]gdt|[sl]idt|[sl]ldt|[sl]tr|push|pop|syscall)$/
		}
		addop('cmpxchg16b', [0x0F, 0xC7], 1) { |o| o.props[:opsz] = 64 ; o.props[:argsz] = 128 }
		addop('iretq', [0xCF], nil, :stopexec, :setip) { |o| o.props[:opsz] = 64 } ; opcode_list.unshift opcode_list.pop
		addop 'swapgs', [0x0F, 0x01, 0xF8]
		addop('movq',  [0x0F, 0x6E], :mrmmmx, {:d => [1, 4]}) { |o| o.args = [:modrm, :regmmx] ; o.props[:opsz] = o.props[:argsz] = 64 }
		addop('movq',  [0x0F, 0x6E], :mrmxmm, {:d => [1, 4]}) { |o| o.args = [:modrm, :regxmm] ; o.props[:opsz] = o.props[:argsz] = 64 ; o.props[:needpfx] = 0x66 }
		addop('jcxz', [0xE3], nil, :setip, :i8) { |o| o.props[:adsz] = 32 }	
		addop('jrcxz', [0xE3], nil, :setip, :i8) { |o| o.props[:adsz] = 64 }
	end
def init_x8664_only init_386_common_only init_386_only init_387_only init_486_only init_pentium_only init_p6_only init_sse_only init_sse2_only @opcode_list . delete_if { | o | o . args . include? ( :seg2 ) or o . args . include? ( :seg2A ) or o . args . include? ( :farptr ) or %w[ aaa aad aam aas bound daa das into jcxz jecxz lds les loadall arpl pusha pushad popa popad ] . include? ( o . name . split ( '.' ) [ 0 ] ) } @opcode_list . each { | o | o . props [ :auto64 ] = true if o . name =~ / ^(enter|leave|[sl]gdt|[sl]idt|[sl]ldt|[sl]tr|push|pop|syscall)$ / } addop ( 'cmpxchg16b' , [ 0x0F , 0xC7 ] , 1 ) { | o | o . props [ :opsz ] = 64 ; o . props [ :argsz ] = 128 } addop ( 'iretq' , [ 0xCF ] , nil , :stopexec , :setip ) { | o | o . props [ :opsz ] = 64 } ; opcode_list . unshift opcode_list . pop addop 'swapgs' , [ 0x0F , 0x01 , 0xF8 ] addop ( 'movq' , [ 0x0F , 0x6E ] , :mrmmmx , { :d => [ 1 , 4 ] } ) { | o | o . args = [ :modrm , :regmmx ] ; o . props [ :opsz ] = o . props [ :argsz ] = 64 } addop ( 'movq' , [ 0x0F , 0x6E ] , :mrmxmm , { :d => [ 1 , 4 ] } ) { | o | o . args = [ :modrm , :regxmm ] ; o . props [ :opsz ] = o . props [ :argsz ] = 64 ; o . props [ :needpfx ] = 0x66 } addop ( 'jcxz' , [ 0xE3 ] , nil , :setip , :i8 ) { | o | o . props [ :adsz ] = 32 } addop ( 'jrcxz' , [ 0xE3 ] , nil , :setip , :i8 ) { | o | o . props [ :adsz ] = 64 } end
all x86_64 cpu understand <= sse2 instrs
all x86_64 cpu understand < = sse2 instrs
# split needed for lds.a32 # actually 16 (cx), but x64 in general says pfx 0x67 => adsz = 32