Class: YTLJit::GeneratorIABinary
- Includes:
- AssemblerUtilIA
- Defined in:
- lib/ytljit/instruction_ia.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Generator
Instance Method Summary collapse
- #adc(dst, src) ⇒ Object
- #add(dst, src) ⇒ Object
- #addsd(dst, src) ⇒ Object
- #addss(dst, src) ⇒ Object
- #and(dst, src) ⇒ Object
- #call(addr) ⇒ Object
- #call_stephandler ⇒ Object
- #cdq ⇒ Object
- #cmp(dst, src) ⇒ Object
- #comisd(dst, src) ⇒ Object
- #comiss(dst, src) ⇒ Object
- #cvtsd2si(dst, src) ⇒ Object
- #cvtsi2sd(dst, src) ⇒ Object
- #cvtsi2ss(dst, src) ⇒ Object
- #cvtss2si(dst, src) ⇒ Object
- #cvttsd2si(dst, src) ⇒ Object
- #cvttss2si(dst, src) ⇒ Object
- #divsd(dst, src) ⇒ Object
- #divss(dst, src) ⇒ Object
- #fstpl(dst) ⇒ Object
- #idiv(src) ⇒ Object
- #imul(dst, src = nil, src2 = nil) ⇒ Object
-
#initialize(asm, handler = "ytl_step_handler") ⇒ GeneratorIABinary
constructor
A new instance of GeneratorIABinary.
- #int3 ⇒ Object
- #ja(addr) ⇒ Object
- #jae(addr) ⇒ Object
- #jb(addr) ⇒ Object
- #jbe(addr) ⇒ Object
- #jl(addr) ⇒ Object
- #jle(addr) ⇒ Object
- #jmp(addr) ⇒ Object
- #jna(addr) ⇒ Object
- #jnae(addr) ⇒ Object
- #jnb(addr) ⇒ Object
- #jnbe(addr) ⇒ Object
- #jnc(addr) ⇒ Object
- #jnle(addr) ⇒ Object
- #jno(addr) ⇒ Object
- #jnz(addr) ⇒ Object
- #jo(addr) ⇒ Object
- #jz(addr) ⇒ Object
- #lea(dst, src) ⇒ Object
- #mov(dst, src) ⇒ Object
- #movsd(dst, src) ⇒ Object
- #movss(dst, src) ⇒ Object
- #mulsd(dst, src) ⇒ Object
- #mulss(dst, src) ⇒ Object
- #neg(src) ⇒ Object
- #or(dst, src) ⇒ Object
- #pop(dst) ⇒ Object
- #push(dst) ⇒ Object
- #rcl(dst, shftnum = 1) ⇒ Object
- #rcr(dst, shftnum = 1) ⇒ Object
- #ret ⇒ Object
- #rol(dst, shftnum = 1) ⇒ Object
- #ror(dst, shftnum = 1) ⇒ Object
- #sal(dst, shftnum = 1) ⇒ Object
- #sar(dst, shftnum = 1) ⇒ Object
- #sbb(dst, src) ⇒ Object
- #seta(dst) ⇒ Object
- #setae(dst) ⇒ Object
- #setb(dst) ⇒ Object
- #setbe(dst) ⇒ Object
- #setg(dst) ⇒ Object
- #setge(dst) ⇒ Object
- #setl(dst) ⇒ Object
- #setle(dst) ⇒ Object
- #setna(dst) ⇒ Object
- #setnae(dst) ⇒ Object
- #setnb(dst) ⇒ Object
- #setnbe(dst) ⇒ Object
- #setnc(dst) ⇒ Object
- #setnle(dst) ⇒ Object
- #setno(dst) ⇒ Object
- #setnz(dst) ⇒ Object
- #seto(dst) ⇒ Object
- #setz(dst) ⇒ Object
- #shl(dst, shftnum = 1) ⇒ Object
- #shr(dst, shftnum = 1) ⇒ Object
- #sub(dst, src) ⇒ Object
- #subsd(dst, src) ⇒ Object
- #subss(dst, src) ⇒ Object
- #ud2 ⇒ Object
- #xor(dst, src) ⇒ Object
Methods included from AssemblerUtilIA
#common_arithxmm, #common_cvt, #common_cvt2, #common_jcc, #common_movssd, #common_operand_80, #common_operand_80_imm8, #common_setcc, #common_shift, #nosupported_addressing_mode
Methods included from AssemblerUtilIAModrm
#modrm, #modrm_indirect, #modrm_indirect_off32, #modrm_indirect_off8, #small_integer_32bit?, #small_integer_8bit?
Constructor Details
#initialize(asm, handler = "ytl_step_handler") ⇒ GeneratorIABinary
Returns a new instance of GeneratorIABinary.
828 829 830 831 |
# File 'lib/ytljit/instruction_ia.rb', line 828 def initialize(asm, handler = "ytl_step_handler") super(asm) @step_handler = YTLJit.address_of(handler) end |
Instance Method Details
#adc(dst, src) ⇒ Object
849 850 851 |
# File 'lib/ytljit/instruction_ia.rb', line 849 def adc(dst, src) common_operand_80(dst, src, 0x10, 0x2, :adc) end |
#add(dst, src) ⇒ Object
841 842 843 |
# File 'lib/ytljit/instruction_ia.rb', line 841 def add(dst, src) common_operand_80(dst, src, 0x00, 0x0, :add) end |
#addsd(dst, src) ⇒ Object
1367 1368 1369 |
# File 'lib/ytljit/instruction_ia.rb', line 1367 def addsd(dst, src) common_arithxmm(dst, src, 0xF2, 0x58, :addsd) end |
#addss(dst, src) ⇒ Object
1363 1364 1365 |
# File 'lib/ytljit/instruction_ia.rb', line 1363 def addss(dst, src) common_arithxmm(dst, src, 0xF3, 0x58, :addss) end |
#and(dst, src) ⇒ Object
857 858 859 |
# File 'lib/ytljit/instruction_ia.rb', line 857 def and(dst, src) common_operand_80(dst, src, 0x20, 0x4, :and) end |
#call(addr) ⇒ Object
1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 |
# File 'lib/ytljit/instruction_ia.rb', line 1187 def call(addr) offset = 0 case addr when Integer offset = addr - @asm.current_address - 5 immidiate_call(addr, offset) when OpMemory offset = addr.value - @asm.current_address - 5 immidiate_call(addr, offset) else rexseq, rexfmt = rex(addr, nil) modseq, modfmt = modrm(:call, 2, addr, nil, addr) (rexseq + [0xff] + modseq).pack("#{rexfmt}C#{modfmt}") end end |
#call_stephandler ⇒ Object
833 834 835 836 837 838 839 |
# File 'lib/ytljit/instruction_ia.rb', line 833 def call_stephandler if @asm.step_mode call(@step_handler) else "" end end |
#cdq ⇒ Object
1351 1352 1353 |
# File 'lib/ytljit/instruction_ia.rb', line 1351 def cdq [0x99].pack("C") end |
#cmp(dst, src) ⇒ Object
869 870 871 |
# File 'lib/ytljit/instruction_ia.rb', line 869 def cmp(dst, src) common_operand_80(dst, src, 0x38, 0x7, :cmp) end |
#comisd(dst, src) ⇒ Object
1400 1401 1402 |
# File 'lib/ytljit/instruction_ia.rb', line 1400 def comisd(dst, src) common_arithxmm(dst, src, 0x66, 0x2F, :comisd) end |
#comiss(dst, src) ⇒ Object
1396 1397 1398 |
# File 'lib/ytljit/instruction_ia.rb', line 1396 def comiss(dst, src) common_arithxmm(dst, src, nil, 0x2F, :comiss) end |
#cvtsd2si(dst, src) ⇒ Object
1412 1413 1414 |
# File 'lib/ytljit/instruction_ia.rb', line 1412 def cvtsd2si(dst, src) common_cvt2(dst, src, 0xf2, 0x2d, :cvtsd2si) end |
#cvtsi2sd(dst, src) ⇒ Object
1404 1405 1406 |
# File 'lib/ytljit/instruction_ia.rb', line 1404 def cvtsi2sd(dst, src) common_cvt(dst, src, 0xf2, 0x2a, :cvtsi2sd) end |
#cvtsi2ss(dst, src) ⇒ Object
1408 1409 1410 |
# File 'lib/ytljit/instruction_ia.rb', line 1408 def cvtsi2ss(dst, src) common_cvt(dst, src, 0xf3, 0x2a, :cvtsi2ss) end |
#cvtss2si(dst, src) ⇒ Object
1420 1421 1422 |
# File 'lib/ytljit/instruction_ia.rb', line 1420 def cvtss2si(dst, src) common_cvt2(dst, src, 0xf3, 0x2d, :cvtss2si) end |
#cvttsd2si(dst, src) ⇒ Object
1416 1417 1418 |
# File 'lib/ytljit/instruction_ia.rb', line 1416 def cvttsd2si(dst, src) common_cvt2(dst, src, 0xf2, 0x2c, :cvttsd2si) end |
#cvttss2si(dst, src) ⇒ Object
1424 1425 1426 |
# File 'lib/ytljit/instruction_ia.rb', line 1424 def cvttss2si(dst, src) common_cvt2(dst, src, 0xf3, 0x2c, :cvttss2si) end |
#divsd(dst, src) ⇒ Object
1392 1393 1394 |
# File 'lib/ytljit/instruction_ia.rb', line 1392 def divsd(dst, src) common_arithxmm(dst, src, 0xF2, 0x5E, :divsd) end |
#divss(dst, src) ⇒ Object
1388 1389 1390 |
# File 'lib/ytljit/instruction_ia.rb', line 1388 def divss(dst, src) common_arithxmm(dst, src, 0xF3, 0x5E, :divss) end |
#fstpl(dst) ⇒ Object
1341 1342 1343 1344 1345 1346 1347 1348 1349 |
# File 'lib/ytljit/instruction_ia.rb', line 1341 def fstpl(dst) case dst when OpIndirect modseq, modfmt = modrm(:fstpl, 3, dst, dst, nil) return ([0xDD] + modseq).pack("C#{modfmt}") end return nosupported_addressing_mode(:neg, src, nil, nil) end |
#idiv(src) ⇒ Object
1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 |
# File 'lib/ytljit/instruction_ia.rb', line 1303 def idiv(src) rexseq, rexfmt = rex(src, nil) case src when OpReg8, OpMem8 modseq, modfmt = modrm(:idiv, 7, src, src, nil) return ([0xF6] + modseq).pack("C#{modfmt}") when OpIndirect, OpMem32 modseq, modfmt = modrm(:idiv, 7, src, src, nil) return (rexseq + [0xF7] + modseq).pack("#{rexfmt}C#{modfmt}") when OpReg32, OpReg64 modseq, modfmt = modrm(:idiv, 7, src, src, nil) return (rexseq + [0xF7] + modseq).pack("#{rexfmt}C#{modfmt}") end return nosupported_addressing_mode(:idiv, src, nil, nil) end |
#imul(dst, src = nil, src2 = nil) ⇒ Object
1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 |
# File 'lib/ytljit/instruction_ia.rb', line 1241 def imul(dst, src = nil, src2 = nil) rexseq, rexfmt = rex(dst, src) case dst when OpReg8, OpMem8 if src == nil then modseq, modfmt = modrm(:imul, 5, dst, dst, src) return ([0xF6] + modseq).pack("C#{modfmt}") end when OpIndirect, OpMem32 if src == nil then modseq, modfmt = modrm(:imul, 5, dst, dst, src) return (rexseq + [0xF7] + modseq).pack("#{rexfmt}C#{modfmt}") end when OpReg32, OpReg64 case src when nil modseq, modfmt = modrm(:imul, 5, dst, dst, src) return (rexseq + [0xF7] + modseq).pack("#{rexfmt}C#{modfmt}") when OpReg32, OpMem32, OpIndirect, OpReg64 modseq, modfmt = modrm(:imul, dst, src, dst, src, src2) case src2 when nil return (rexseq + [0x0F, 0xAF] + modseq).pack("#{rexfmt}C2#{modfmt}") when OpImmidiate8 fmt = "#{rexfmt}C#{modfmt}C" return (rexseq + [0x6B] + modseq + [src2.value]).pack(fmt) when OpImmidiate32 fmt = "#{rexfmt}C#{modfmt}L" return (rexseq + [0x69] + modseq + [src2.value]).pack(fmt) when Integer fmt = "#{rexfmt}C#{modfmt}L" return (rexseq + [0x69] + modseq + [src2]).pack(fmt) end when OpImmidiate8 modseq, modfmt = modrm(:imul, dst, dst, dst, src) fmt = "#{rexfmt}C#{modfmt}C" return (rexseq + [0x6B] + modseq + [src.value]).pack(fmt) when OpImmidiate32 modseq, modfmt = modrm(:imul, dst, dst, dst, src) fmt = "#{rexfmt}C#{modfmt}L" return (rexseq + [0x69] + modseq + [src.value]).pack(fmt) when Integer modseq, modfmt = modrm(:imul, dst, dst, dst, src) fmt = "#{rexfmt}C#{modfmt}L" return (rexseq + [0x69] + modseq + [src]).pack(fmt) end end return nosupported_addressing_mode(:imul, dst, src, src2) end |
#int3 ⇒ Object
1428 1429 1430 |
# File 'lib/ytljit/instruction_ia.rb', line 1428 def int3 [0xcc].pack("C") end |
#ja(addr) ⇒ Object
1031 1032 1033 |
# File 'lib/ytljit/instruction_ia.rb', line 1031 def ja(addr) common_jcc(addr, 0x77, 0x87, :ja) end |
#jae(addr) ⇒ Object
1035 1036 1037 |
# File 'lib/ytljit/instruction_ia.rb', line 1035 def jae(addr) common_jcc(addr, 0x73, 0x83, :jae) end |
#jb(addr) ⇒ Object
1039 1040 1041 |
# File 'lib/ytljit/instruction_ia.rb', line 1039 def jb(addr) common_jcc(addr, 0x72, 0x82, :jb) end |
#jbe(addr) ⇒ Object
1043 1044 1045 |
# File 'lib/ytljit/instruction_ia.rb', line 1043 def jbe(addr) common_jcc(addr, 0x76, 0x86, :jbe) end |
#jl(addr) ⇒ Object
1047 1048 1049 |
# File 'lib/ytljit/instruction_ia.rb', line 1047 def jl(addr) common_jcc(addr, 0x7c, 0x8c, :jl) end |
#jle(addr) ⇒ Object
1051 1052 1053 |
# File 'lib/ytljit/instruction_ia.rb', line 1051 def jle(addr) common_jcc(addr, 0x7e, 0x8e, :jle) end |
#jmp(addr) ⇒ Object
1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 |
# File 'lib/ytljit/instruction_ia.rb', line 1167 def jmp(addr) addr2 = addr if addr.is_a?(OpMemory) then addr2 = addr.value end case addr2 when Integer offset = addr2 - @asm.current_address - 2 if offset > -128 and offset < 127 and false then [0xeb, offset].pack("C2") else offset = addr2 - @asm.current_address - 5 [0xe9, offset].pack("CL") end else modseq, modfmt = modrm(:jmp, 4, addr2, addr2, nil) ([0xff] + modseq).pack("C#{modfmt}") end end |
#jna(addr) ⇒ Object
1055 1056 1057 |
# File 'lib/ytljit/instruction_ia.rb', line 1055 def jna(addr) common_jcc(addr, 0x76, 0x86, :jna) end |
#jnae(addr) ⇒ Object
1059 1060 1061 |
# File 'lib/ytljit/instruction_ia.rb', line 1059 def jnae(addr) common_jcc(addr, 0x72, 0x82, :jnae) end |
#jnb(addr) ⇒ Object
1063 1064 1065 |
# File 'lib/ytljit/instruction_ia.rb', line 1063 def jnb(addr) common_jcc(addr, 0x73, 0x83, :jnb) end |
#jnbe(addr) ⇒ Object
1067 1068 1069 |
# File 'lib/ytljit/instruction_ia.rb', line 1067 def jnbe(addr) common_jcc(addr, 0x77, 0x87, :jnbe) end |
#jnc(addr) ⇒ Object
1071 1072 1073 |
# File 'lib/ytljit/instruction_ia.rb', line 1071 def jnc(addr) common_jcc(addr, 0x73, 0x83, :jnc) end |
#jnle(addr) ⇒ Object
1075 1076 1077 |
# File 'lib/ytljit/instruction_ia.rb', line 1075 def jnle(addr) common_jcc(addr, 0x7f, 0x8f, :jnle) end |
#jno(addr) ⇒ Object
1079 1080 1081 |
# File 'lib/ytljit/instruction_ia.rb', line 1079 def jno(addr) common_jcc(addr, 0x71, 0x81, :jno) end |
#jnz(addr) ⇒ Object
1091 1092 1093 |
# File 'lib/ytljit/instruction_ia.rb', line 1091 def jnz(addr) common_jcc(addr, 0x75, 0x85, :jnz) end |
#jo(addr) ⇒ Object
1083 1084 1085 |
# File 'lib/ytljit/instruction_ia.rb', line 1083 def jo(addr) common_jcc(addr, 0x70, 0x80, :jo) end |
#jz(addr) ⇒ Object
1087 1088 1089 |
# File 'lib/ytljit/instruction_ia.rb', line 1087 def jz(addr) common_jcc(addr, 0x74, 0x84, :jz) end |
#lea(dst, src) ⇒ Object
987 988 989 990 991 992 993 994 995 996 997 998 999 |
# File 'lib/ytljit/instruction_ia.rb', line 987 def lea(dst, src) unless dst.is_a?(OpReg32) or dst.is_a?(OpReg64) return nosupported_addressing_mode(:lea, dst, src) end if !src.is_a?(OpIndirect) return nosupported_addressing_mode(:lea, dst, src) end rexseq, rexfmt = rex(src, dst) modseq, modfmt = modrm(:lea, dst, src, dst, src) (rexseq + [0x8D] + modseq).pack("#{rexfmt}C#{modfmt}") end |
#mov(dst, src) ⇒ Object
873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 |
# File 'lib/ytljit/instruction_ia.rb', line 873 def mov(dst, src) case dst when OpReg8 case src when OpImmidiate8 [0xB0 + (dst.reg_no & 7), src.value].pack("C2") when Integer [0xB0 + (dst.reg_no & 7), src].pack("C2") when OpReg8 modseq, modfmt = modrm(:mov, dst, src, dst, src) ([0x88] + modseq).pack("C#{modfmt}") when OpIndirect modseq, modfmt = modrm(:mov, dst, src, dst, src) ([0x8A] + modseq).pack("C#{modfmt}") else return nosupported_addressing_mode(:mov, dst, src) end when OpReg32 case src when OpImmidiate32 [0xB8 + (dst.reg_no & 7), src.value].pack("CL") when Integer [0xB8 + (dst.reg_no & 7), src].pack("CL") when OpReg32, OpReg64 rexseq, rexfmt = rex(dst, src) modseq, modfmt = modrm(:mov, src, dst, dst, src) (rexseq + [0x89] + modseq).pack("#{rexfmt}C#{modfmt}") when OpIndirect rexseq, rexfmt = rex(dst, src) modseq, modfmt = modrm(:mov, dst, src, dst, src) (rexseq + [0x8B] + modseq).pack("#{rexfmt}C#{modfmt}") else return nosupported_addressing_mode(:mov, dst, src) end when OpReg64 case src when OpImmidiate32 rexseq, rexfmt = rex(dst, src) modseq, modfmt = modrm(:mov, 0, dst, dst, src) (rexseq + [0xC7] + modseq + [src.value]).pack("#{rexfmt}C#{modfmt}L") when Integer rexseq, rexfmt = rex(dst, src) if small_integer_32bit?(src) then modseq, modfmt = modrm(:mov, 0, dst, dst, src) (rexseq + [0xC7] + modseq + [src]).pack("#{rexfmt}C#{modfmt}L") else [*rexseq, 0xB8 + (dst.reg_no & 7), src].pack("#{rexfmt}CQ") end when OpImmidiate64 rexseq, rexfmt = rex(dst, src) [*rexseq, 0xB8 + (dst.reg_no & 7), src.value].pack("#{rexfmt}CQ") when OpReg32, OpReg64 rexseq, rexfmt = rex(dst, src) modseq, modfmt = modrm(:mov, src, dst, dst, src) (rexseq + [0x89] + modseq).pack("#{rexfmt}C#{modfmt}") when OpIndirect rexseq, rexfmt = rex(src, dst) modseq, modfmt = modrm(:mov, dst, src, dst, src) (rexseq + [0x8B] + modseq).pack("#{rexfmt}C#{modfmt}") else return nosupported_addressing_mode(:mov, dst, src) end when OpIndirect case src when OpReg8 rexseq, rexfmt = rex(dst, src) modseq, modfmt = modrm(:mov, src, dst, dst, src) (rexseq + [0x88] + modseq).pack("#{rexfmt}C#{modfmt}") when OpReg32, OpReg64 rexseq, rexfmt = rex(dst, src) modseq, modfmt = modrm(:mov, src, dst, dst, src) (rexseq + [0x89] + modseq).pack("#{rexfmt}C#{modfmt}") when OpImmidiate8 rexseq, rexfmt = rex(dst, 0) modseq, modfmt = modrm(:mov, 0, dst, dst, src) (rexseq + [0xC6] + modseq + [src.value]).pack("#{rexfmt}C#{modfmt}C") when OpImmidiate32 rexseq, rexfmt = rex(dst, 0) modseq, modfmt = modrm(:mov, 0, dst, dst, src) (rexseq + [0xC7] + modseq + [src.value]).pack("#{rexfmt}C#{modfmt}L") when Integer rexseq, rexfmt = rex(dst, 0) modseq, modfmt = modrm(:mov, 0, dst, dst, src) (rexseq + [0xC7] + modseq + [src]).pack("#{rexfmt}C#{modfmt}L") else return nosupported_addressing_mode(:mov, dst, src) end else return nosupported_addressing_mode(:mov, dst, src) end end |
#movsd(dst, src) ⇒ Object
1359 1360 1361 |
# File 'lib/ytljit/instruction_ia.rb', line 1359 def movsd(dst, src) common_movssd(dst, src, 0xF2, :movsd) end |
#movss(dst, src) ⇒ Object
1355 1356 1357 |
# File 'lib/ytljit/instruction_ia.rb', line 1355 def movss(dst, src) common_movssd(dst, src, 0xF3, :movss) end |
#mulsd(dst, src) ⇒ Object
1384 1385 1386 |
# File 'lib/ytljit/instruction_ia.rb', line 1384 def mulsd(dst, src) common_arithxmm(dst, src, 0xF2, 0x59, :mulsd) end |
#mulss(dst, src) ⇒ Object
1380 1381 1382 |
# File 'lib/ytljit/instruction_ia.rb', line 1380 def mulss(dst, src) common_arithxmm(dst, src, 0xF3, 0x59, :mulss) end |
#neg(src) ⇒ Object
1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 |
# File 'lib/ytljit/instruction_ia.rb', line 1322 def neg(src) rexseq, rexfmt = rex(src, nil) case src when OpReg8, OpMem8 modseq, modfmt = modrm(:neg, 3, src, src, nil) return ([0xF6] + modseq).pack("C#{modfmt}") when OpIndirect, OpMem32 modseq, modfmt = modrm(:neg, 3, src, src, nil) return (rexseq + [0xF7] + modseq).pack("#{rexfmt}C#{modfmt}") when OpReg32, OpReg64 modseq, modfmt = modrm(:neg, 3, src, src, nil) return (rexseq + [0xF7] + modseq).pack("#{rexfmt}C#{modfmt}") end return nosupported_addressing_mode(:neg, src, nil, nil) end |
#or(dst, src) ⇒ Object
845 846 847 |
# File 'lib/ytljit/instruction_ia.rb', line 845 def or(dst, src) common_operand_80(dst, src, 0x08, 0x1, :or) end |
#pop(dst) ⇒ Object
1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 |
# File 'lib/ytljit/instruction_ia.rb', line 1016 def pop(dst) rexseq, rexfmt = rex(dst, nil) case dst when OpReg32, OpReg64 [*rexseq, 0x58 + (dst.reg_no & 7)].pack("#{rexfmt}C") when OpIndirect modseq, modfmt = modrm(:pop, 0, dst, dst, nil) ([0x8F] + modseq).pack("C#{modfmt}") else return nosupported_addressing_mode(:pop, dst, nil) end end |
#push(dst) ⇒ Object
1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 |
# File 'lib/ytljit/instruction_ia.rb', line 1001 def push(dst) rexseq, rexfmt = rex(dst, nil) case dst when OpReg32, OpReg64 [*rexseq, 0x50 + (dst.reg_no & 7)].pack("#{rexfmt}C") when OpIndirect modseq, modfmt = modrm(:push, 6, dst, dst, nil) (rexseq + [0xFF] + modseq).pack("#{rexfmt}C#{modfmt}") else return nosupported_addressing_mode(:push, dst, nil) end end |
#rcl(dst, shftnum = 1) ⇒ Object
1225 1226 1227 |
# File 'lib/ytljit/instruction_ia.rb', line 1225 def rcl(dst, shftnum = 1) common_shift(dst, 2, shftnum, :rcl) end |
#rcr(dst, shftnum = 1) ⇒ Object
1229 1230 1231 |
# File 'lib/ytljit/instruction_ia.rb', line 1229 def rcr(dst, shftnum = 1) common_shift(dst, 3, shftnum, :rcr) end |
#ret ⇒ Object
1205 1206 1207 |
# File 'lib/ytljit/instruction_ia.rb', line 1205 def ret [0xc3].pack("C") end |
#rol(dst, shftnum = 1) ⇒ Object
1233 1234 1235 |
# File 'lib/ytljit/instruction_ia.rb', line 1233 def rol(dst, shftnum = 1) common_shift(dst, 0, shftnum, :rol) end |
#ror(dst, shftnum = 1) ⇒ Object
1237 1238 1239 |
# File 'lib/ytljit/instruction_ia.rb', line 1237 def ror(dst, shftnum = 1) common_shift(dst, 1, shftnum, :ror) end |
#sal(dst, shftnum = 1) ⇒ Object
1209 1210 1211 |
# File 'lib/ytljit/instruction_ia.rb', line 1209 def sal(dst, shftnum = 1) common_shift(dst, 4, shftnum, :sal) end |
#sar(dst, shftnum = 1) ⇒ Object
1213 1214 1215 |
# File 'lib/ytljit/instruction_ia.rb', line 1213 def sar(dst, shftnum = 1) common_shift(dst, 7, shftnum, :sar) end |
#sbb(dst, src) ⇒ Object
853 854 855 |
# File 'lib/ytljit/instruction_ia.rb', line 853 def sbb(dst, src) common_operand_80(dst, src, 0x18, 0x3, :sbb) end |
#seta(dst) ⇒ Object
1095 1096 1097 |
# File 'lib/ytljit/instruction_ia.rb', line 1095 def seta(dst) common_setcc(dst, 0x97, :seta) end |
#setae(dst) ⇒ Object
1099 1100 1101 |
# File 'lib/ytljit/instruction_ia.rb', line 1099 def setae(dst) common_setcc(dst, 0x93, :setae) end |
#setb(dst) ⇒ Object
1103 1104 1105 |
# File 'lib/ytljit/instruction_ia.rb', line 1103 def setb(dst) common_setcc(dst, 0x92, :setb) end |
#setbe(dst) ⇒ Object
1107 1108 1109 |
# File 'lib/ytljit/instruction_ia.rb', line 1107 def setbe(dst) common_setcc(dst, 0x96, :setbe) end |
#setg(dst) ⇒ Object
1111 1112 1113 |
# File 'lib/ytljit/instruction_ia.rb', line 1111 def setg(dst) common_setcc(dst, 0x9f, :setg) end |
#setge(dst) ⇒ Object
1115 1116 1117 |
# File 'lib/ytljit/instruction_ia.rb', line 1115 def setge(dst) common_setcc(dst, 0x9d, :setge) end |
#setl(dst) ⇒ Object
1119 1120 1121 |
# File 'lib/ytljit/instruction_ia.rb', line 1119 def setl(dst) common_setcc(dst, 0x9c, :setl) end |
#setle(dst) ⇒ Object
1123 1124 1125 |
# File 'lib/ytljit/instruction_ia.rb', line 1123 def setle(dst) common_setcc(dst, 0x9e, :setle) end |
#setna(dst) ⇒ Object
1127 1128 1129 |
# File 'lib/ytljit/instruction_ia.rb', line 1127 def setna(dst) common_setcc(dst, 0x96, :setna) end |
#setnae(dst) ⇒ Object
1131 1132 1133 |
# File 'lib/ytljit/instruction_ia.rb', line 1131 def setnae(dst) common_setcc(dst, 0x92, :setnae) end |
#setnb(dst) ⇒ Object
1135 1136 1137 |
# File 'lib/ytljit/instruction_ia.rb', line 1135 def setnb(dst) common_setcc(dst, 0x93, :setnb) end |
#setnbe(dst) ⇒ Object
1139 1140 1141 |
# File 'lib/ytljit/instruction_ia.rb', line 1139 def setnbe(dst) common_setcc(dst, 0x97, :setnbe) end |
#setnc(dst) ⇒ Object
1143 1144 1145 |
# File 'lib/ytljit/instruction_ia.rb', line 1143 def setnc(dst) common_setcc(dst, 0x93, :setnc) end |
#setnle(dst) ⇒ Object
1147 1148 1149 |
# File 'lib/ytljit/instruction_ia.rb', line 1147 def setnle(dst) common_setcc(dst, 0x9f, :setnle) end |
#setno(dst) ⇒ Object
1151 1152 1153 |
# File 'lib/ytljit/instruction_ia.rb', line 1151 def setno(dst) common_setcc(dst, 0x91, :setno) end |
#setnz(dst) ⇒ Object
1163 1164 1165 |
# File 'lib/ytljit/instruction_ia.rb', line 1163 def setnz(dst) common_setcc(dst, 0x95, :setnz) end |
#seto(dst) ⇒ Object
1155 1156 1157 |
# File 'lib/ytljit/instruction_ia.rb', line 1155 def seto(dst) common_setcc(dst, 0x90, :seto) end |
#setz(dst) ⇒ Object
1159 1160 1161 |
# File 'lib/ytljit/instruction_ia.rb', line 1159 def setz(dst) common_setcc(dst, 0x94, :setz) end |
#shl(dst, shftnum = 1) ⇒ Object
1217 1218 1219 |
# File 'lib/ytljit/instruction_ia.rb', line 1217 def shl(dst, shftnum = 1) common_shift(dst, 4, shftnum, :shl) end |
#shr(dst, shftnum = 1) ⇒ Object
1221 1222 1223 |
# File 'lib/ytljit/instruction_ia.rb', line 1221 def shr(dst, shftnum = 1) common_shift(dst, 5, shftnum, :shr) end |
#sub(dst, src) ⇒ Object
861 862 863 |
# File 'lib/ytljit/instruction_ia.rb', line 861 def sub(dst, src) common_operand_80(dst, src, 0x28, 0x5, :sub) end |
#subsd(dst, src) ⇒ Object
1375 1376 1377 |
# File 'lib/ytljit/instruction_ia.rb', line 1375 def subsd(dst, src) common_arithxmm(dst, src, 0xF2, 0x5C, :subsd) end |
#subss(dst, src) ⇒ Object
1371 1372 1373 |
# File 'lib/ytljit/instruction_ia.rb', line 1371 def subss(dst, src) common_arithxmm(dst, src, 0xF3, 0x5C, :subss) end |
#ud2 ⇒ Object
1432 1433 1434 |
# File 'lib/ytljit/instruction_ia.rb', line 1432 def ud2 [0x0f, 0x0b].pack("CC") end |
#xor(dst, src) ⇒ Object
865 866 867 |
# File 'lib/ytljit/instruction_ia.rb', line 865 def xor(dst, src) common_operand_80(dst, src, 0x30, 0x6, :xor) end |