Changeset 40086 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Feb 13, 2012 12:58:44 AM (13 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAllInstructions.cpp.h
r40083 r40086 10368 10368 10369 10369 10370 /** Opcode 0xd9 /0 stN */ 10370 /** Opcode 0xd9 !11/2 mem32real */ 10371 FNIEMOP_STUB_1(iemOp_fst_m32r, uint8_t, bRm); 10372 10373 /** Opcode 0xd9 !11/3 */ 10374 FNIEMOP_STUB_1(iemOp_fstp_m32r, uint8_t, bRm); 10375 10376 /** Opcode 0xd9 !11/4 */ 10377 FNIEMOP_STUB_1(iemOp_fldenv, uint8_t, bRm); 10378 10379 /** Opcode 0xd9 !11/5 */ 10380 FNIEMOP_STUB_1(iemOp_fldcw, uint8_t, bRm); 10381 10382 /** Opcode 0xd9 !11/6 */ 10383 FNIEMOP_STUB_1(iemOp_fstenv, uint8_t, bRm); 10384 10385 /** Opcode 0xd9 !11/7 */ 10386 FNIEMOP_STUB_1(iemOp_fstcw, uint8_t, bRm); 10387 10388 /** Opcode 0xd9 0xc9, 0xd9 0xd8-0xdf, ++?. */ 10389 FNIEMOP_DEF(iemOp_fnop) 10390 { 10391 /* Note! This updates the FPU instruction pointer but leaves the opcode alone. */ 10392 RTAssertMsg1(NULL, __LINE__, __FILE__, __FUNCTION__); 10393 iemOpStubMsg2(pIemCpu); 10394 RTAssertPanic(); 10395 return VERR_IEM_INSTR_NOT_IMPLEMENTED; 10396 } 10397 10398 /** Opcode 0xd9 11/0 stN */ 10371 10399 FNIEMOP_STUB_1(iemOp_fld_stN, uint8_t, bRm); 10372 10400 10373 /** Opcode 0xd9 /2 mem32real */ 10374 FNIEMOP_STUB_1(iemOp_fst_m32r, uint8_t, bRm); 10375 10376 /** Opcode 0xd9 /3 stN */ 10401 /** Opcode 0xd9 11/3 stN */ 10377 10402 FNIEMOP_STUB_1(iemOp_fxch_stN, uint8_t, bRm); 10378 10403 10379 /** Opcode 0xd9 /3 */ 10380 FNIEMOP_STUB_1(iemOp_fstp_m32r, uint8_t, bRm); 10381 10382 /** Opcode 0xd9 /4 */ 10383 FNIEMOP_STUB_1(iemOp_fldenv, uint8_t, bRm); 10384 10385 /** Opcode 0xd9 /5 */ 10386 FNIEMOP_STUB_1(iemOp_fldcw, uint8_t, bRm); 10387 10388 /** Opcode 0xd9 /6 */ 10389 FNIEMOP_STUB_1(iemOp_fstenv, uint8_t, bRm); 10390 10391 /** Opcode 0xd9 /7 */ 10392 FNIEMOP_STUB_1(iemOp_fstcw, uint8_t, bRm); 10393 10394 /** Opcode 0xd9 0xc9, 0xd9 0xd8-0xdf. */ 10395 FNIEMOP_STUB(iemOp_fnop); 10404 /** Opcode 0xd9 11/4, 0xdd 11/2. */ 10405 FNIEMOP_STUB_1(iemOp_fstp_stN, uint8_t, bRm); 10396 10406 10397 10407 /** Opcode 0xd9 0xe0. */ … … 10530 10540 return FNIEMOP_CALL(iemOp_fnop); 10531 10541 return IEMOP_RAISE_INVALID_OPCODE(); 10532 case 3: 10533 return FNIEMOP_CALL(iemOp_fnop); /* AMD says reserved; tests on intel indicates FNOP. */ 10542 case 3: return FNIEMOP_CALL_1(iemOp_fstp_stN, bRm); /* Reserved. Intel behavior seems to be FSTP ST(i) though. */ 10534 10543 case 4: 10535 10544 case 5: … … 10830 10839 case 0: return FNIEMOP_CALL_1(iemOp_fadd_stN_st0, bRm); 10831 10840 case 1: return FNIEMOP_CALL_1(iemOp_fmul_stN_st0, bRm); 10832 case 2: return FNIEMOP_CALL (iemOp_fnop);10833 case 3: return FNIEMOP_CALL (iemOp_fnop);10841 case 2: return FNIEMOP_CALL_1(iemOp_fcom_stN, bRm); /* Marked reserved, intel behavior is that of FCOM ST(i). */ 10842 case 3: return FNIEMOP_CALL_1(iemOp_fcomp_stN, bRm); /* Marked reserved, intel behavior is that of FCOMP ST(i). */ 10834 10843 case 4: return FNIEMOP_CALL_1(iemOp_fsubr_stN_st0, bRm); 10835 10844 case 5: return FNIEMOP_CALL_1(iemOp_fsub_stN_st0, bRm); … … 10879 10888 10880 10889 /** Opcode 0xdd 11/0. */ 10881 FNIEMOP_STUB_1(iemOp_ffree_stN, uint8_t, bRm);10890 FNIEMOP_STUB_1(iemOp_ffree_stN, uint8_t, bRm); 10882 10891 10883 10892 /** Opcode 0xdd 11/1. */ 10884 FNIEMOP_STUB_1(iemOp_fst_stN, uint8_t, bRm); 10885 10886 /** Opcode 0xdd 11/2. */ 10887 FNIEMOP_STUB_1(iemOp_fstp_stN, uint8_t, bRm); 10893 FNIEMOP_STUB_1(iemOp_fst_stN, uint8_t, bRm); 10888 10894 10889 10895 /** Opcode 0xdd 11/3. */ 10890 FNIEMOP_STUB_1(iemOp_fucom_stN ,uint8_t, bRm);10896 FNIEMOP_STUB_1(iemOp_fucom_stN_st0, uint8_t, bRm); 10891 10897 10892 10898 /** Opcode 0xdd 11/4. */ 10893 FNIEMOP_STUB_1(iemOp_fucomp_stN, uint8_t, bRm);10899 FNIEMOP_STUB_1(iemOp_fucomp_stN, uint8_t, bRm); 10894 10900 10895 10901 /** Opcode 0xdd. */ 10896 10902 FNIEMOP_DEF(iemOp_EscF5) 10897 10903 { 10904 pIemCpu->offFpuOpcode = pIemCpu->offOpcode - 1; 10898 10905 uint8_t bRm; IEM_OPCODE_GET_NEXT_U8(&bRm); 10899 10906 if ((bRm & X86_MODRM_MOD_MASK) == (3 << X86_MODRM_MOD_SHIFT)) … … 10901 10908 switch ((bRm >> X86_MODRM_REG_SHIFT) & X86_MODRM_REG_SMASK) 10902 10909 { 10903 case 0: return FNIEMOP_CALL_1(iemOp_ffree_stN, bRm);10910 case 0: return FNIEMOP_CALL_1(iemOp_ffree_stN, bRm); 10904 10911 case 1: return FNIEMOP_CALL( iemOp_fnop); 10905 case 2: return FNIEMOP_CALL_1(iemOp_fst_stN, bRm);10906 case 3: return FNIEMOP_CALL_1(iemOp_fstp_stN, bRm);10907 case 4: return FNIEMOP_CALL_1(iemOp_fucom_stN ,bRm);10908 case 5: return FNIEMOP_CALL_1(iemOp_fucomp_stN, bRm);10912 case 2: return FNIEMOP_CALL_1(iemOp_fst_stN, bRm); 10913 case 3: return FNIEMOP_CALL_1(iemOp_fstp_stN, bRm); 10914 case 4: return FNIEMOP_CALL_1(iemOp_fucom_stN_st0,bRm); 10915 case 5: return FNIEMOP_CALL_1(iemOp_fucomp_stN, bRm); 10909 10916 case 6: return IEMOP_RAISE_INVALID_OPCODE(); 10910 10917 case 7: return IEMOP_RAISE_INVALID_OPCODE(); … … 10930 10937 10931 10938 10939 /** Opcode 0xde 11/0. */ 10940 FNIEMOP_STUB_1(iemOp_faddp_stN_st0, uint8_t, bRm); 10941 10942 /** Opcode 0xde 11/0. */ 10943 FNIEMOP_STUB_1(iemOp_fmulp_stN_st0, uint8_t, bRm); 10944 10932 10945 /** Opcode 0xde 0xd9. */ 10933 10946 FNIEMOP_STUB(iemOp_fcompp); 10934 10947 10948 /** Opcode 0xde 11/4. */ 10949 FNIEMOP_STUB_1(iemOp_fsubrp_stN_st0, uint8_t, bRm); 10950 10951 /** Opcode 0xde 11/5. */ 10952 FNIEMOP_STUB_1(iemOp_fsubp_stN_st0, uint8_t, bRm); 10953 10954 /** Opcode 0xde 11/6. */ 10955 FNIEMOP_STUB_1(iemOp_fdivrp_stN_st0, uint8_t, bRm); 10956 10957 /** Opcode 0xde 11/7. */ 10958 FNIEMOP_STUB_1(iemOp_fdivp_stN_st0, uint8_t, bRm); 10959 10960 /** Opcode 0xde !11/0. */ 10961 FNIEMOP_STUB_1(iemOp_fiadd_m16i, uint8_t, bRm); 10962 10963 /** Opcode 0xde !11/1. */ 10964 FNIEMOP_STUB_1(iemOp_fimul_m16i, uint8_t, bRm); 10965 10966 /** Opcode 0xde !11/2. */ 10967 FNIEMOP_STUB_1(iemOp_ficom_m16i, uint8_t, bRm); 10968 10969 /** Opcode 0xde !11/3. */ 10970 FNIEMOP_STUB_1(iemOp_ficomp_m16i, uint8_t, bRm); 10971 10972 /** Opcode 0xde !11/4. */ 10973 FNIEMOP_STUB_1(iemOp_fisub_m16i, uint8_t, bRm); 10974 10975 /** Opcode 0xde !11/5. */ 10976 FNIEMOP_STUB_1(iemOp_fisubr_m16i, uint8_t, bRm); 10977 10978 /** Opcode 0xde !11/6. */ 10979 FNIEMOP_STUB_1(iemOp_fidiv_m16i, uint8_t, bRm); 10980 10981 /** Opcode 0xde !11/7. */ 10982 FNIEMOP_STUB_1(iemOp_fidivr_m16i, uint8_t, bRm); 10983 10984 10935 10985 /** Opcode 0xde. */ 10936 10986 FNIEMOP_DEF(iemOp_EscF6) 10937 10987 { 10988 pIemCpu->offFpuOpcode = pIemCpu->offOpcode - 1; 10938 10989 uint8_t bRm; IEM_OPCODE_GET_NEXT_U8(&bRm); 10939 10990 if ((bRm & X86_MODRM_MOD_MASK) == (3 << X86_MODRM_MOD_SHIFT)) 10940 10991 { 10941 switch ( bRm & 0xf8)10992 switch ((bRm >> X86_MODRM_REG_SHIFT) & X86_MODRM_REG_SMASK) 10942 10993 { 10943 case 0xc0: AssertFailedReturn(VERR_IEM_INSTR_NOT_IMPLEMENTED); // fiaddp 10944 case 0xc8: AssertFailedReturn(VERR_IEM_INSTR_NOT_IMPLEMENTED); // fimulp 10945 case 0xd0: return IEMOP_RAISE_INVALID_OPCODE(); 10946 case 0xd8: 10947 switch (bRm) 10948 { 10949 case 0xd9: return FNIEMOP_CALL(iemOp_fcompp); 10950 default: return IEMOP_RAISE_INVALID_OPCODE(); 10951 } 10952 case 0xe0: AssertFailedReturn(VERR_IEM_INSTR_NOT_IMPLEMENTED); // fsubrp 10953 case 0xe8: AssertFailedReturn(VERR_IEM_INSTR_NOT_IMPLEMENTED); // fsubp 10954 case 0xf0: AssertFailedReturn(VERR_IEM_INSTR_NOT_IMPLEMENTED); // fdivrp 10955 case 0xf8: AssertFailedReturn(VERR_IEM_INSTR_NOT_IMPLEMENTED); // fdivp 10994 case 0: return FNIEMOP_CALL_1(iemOp_faddp_stN_st0, bRm); 10995 case 1: return FNIEMOP_CALL_1(iemOp_fmulp_stN_st0, bRm); 10996 case 2: return FNIEMOP_CALL(iemOp_fnop); 10997 case 3: if (bRm == 0xd9) 10998 return FNIEMOP_CALL(iemOp_fcompp); 10999 return IEMOP_RAISE_INVALID_OPCODE(); 11000 case 4: return FNIEMOP_CALL_1(iemOp_fsubrp_stN_st0, bRm); 11001 case 5: return FNIEMOP_CALL_1(iemOp_fsubp_stN_st0, bRm); 11002 case 6: return FNIEMOP_CALL_1(iemOp_fdivrp_stN_st0, bRm); 11003 case 7: return FNIEMOP_CALL_1(iemOp_fdivp_stN_st0, bRm); 10956 11004 IEM_NOT_REACHED_DEFAULT_CASE_RET(); 10957 11005 } … … 10959 11007 else 10960 11008 { 10961 #if 010962 11009 switch ((bRm >> X86_MODRM_REG_SHIFT) & X86_MODRM_REG_SMASK) 10963 11010 { 10964 case 0: return FNIEMOP_CALL_1(iemOp_fiadd_ w, bRm);10965 case 1: return FNIEMOP_CALL_1(iemOp_fimul_ w, bRm);10966 case 2: return FNIEMOP_CALL_1(iemOp_ficom_ w, bRm);10967 case 3: return FNIEMOP_CALL_1(iemOp_ficomp_ w, bRm);10968 case 4: return FNIEMOP_CALL_1(iemOp_fisub_ w, bRm);10969 case 5: return FNIEMOP_CALL_1(iemOp_fisubr_ w, bRm);10970 case 6: return FNIEMOP_CALL_1(iemOp_fidiv_ w, bRm);10971 case 7: return FNIEMOP_CALL_1(iemOp_fidivr_ w, bRm);11011 case 0: return FNIEMOP_CALL_1(iemOp_fiadd_m16i, bRm); 11012 case 1: return FNIEMOP_CALL_1(iemOp_fimul_m16i, bRm); 11013 case 2: return FNIEMOP_CALL_1(iemOp_ficom_m16i, bRm); 11014 case 3: return FNIEMOP_CALL_1(iemOp_ficomp_m16i, bRm); 11015 case 4: return FNIEMOP_CALL_1(iemOp_fisub_m16i, bRm); 11016 case 5: return FNIEMOP_CALL_1(iemOp_fisubr_m16i, bRm); 11017 case 6: return FNIEMOP_CALL_1(iemOp_fidiv_m16i, bRm); 11018 case 7: return FNIEMOP_CALL_1(iemOp_fidivr_m16i, bRm); 10972 11019 IEM_NOT_REACHED_DEFAULT_CASE_RET(); 10973 11020 } 10974 #endif 10975 AssertFailedReturn(VERR_IEM_INSTR_NOT_IMPLEMENTED); 10976 } 10977 } 11021 } 11022 } 11023 11024 11025 /** Opcode 0xdf 11/0. */ 11026 FNIEMOP_STUB_1(iemOp_ffreep_stN, uint8_t, bRm); 10978 11027 10979 11028 … … 10995 11044 10996 11045 11046 /** Opcode 0xdf 11/5. */ 11047 FNIEMOP_STUB_1(iemOp_fucomip_st0_stN, uint8_t, bRm); 11048 11049 /** Opcode 0xdf 11/6. */ 11050 FNIEMOP_STUB_1(iemOp_fcomip_st0_stN, uint8_t, bRm); 11051 11052 /** Opcode 0xdf !11/0. */ 11053 FNIEMOP_STUB_1(iemOp_fild_m16i, uint8_t, bRm); 11054 11055 /** Opcode 0xdf !11/1. */ 11056 FNIEMOP_STUB_1(iemOp_fisttp_m16i, uint8_t, bRm); 11057 11058 /** Opcode 0xdf !11/2. */ 11059 FNIEMOP_STUB_1(iemOp_fist_m16i, uint8_t, bRm); 11060 11061 /** Opcode 0xdf !11/3. */ 11062 FNIEMOP_STUB_1(iemOp_fistp_m16i, uint8_t, bRm); 11063 11064 /** Opcode 0xdf !11/4. */ 11065 FNIEMOP_STUB_1(iemOp_fbld_m80d, uint8_t, bRm); 11066 11067 /** Opcode 0xdf !11/5. */ 11068 FNIEMOP_STUB_1(iemOp_fild_m64i, uint8_t, bRm); 11069 11070 /** Opcode 0xdf !11/6. */ 11071 FNIEMOP_STUB_1(iemOp_fbstp_m80d, uint8_t, bRm); 11072 11073 /** Opcode 0xdf !11/7. */ 11074 FNIEMOP_STUB_1(iemOp_fistp_m64i, uint8_t, bRm); 11075 11076 10997 11077 /** Opcode 0xdf. */ 10998 11078 FNIEMOP_DEF(iemOp_EscF7) … … 11001 11081 if ((bRm & X86_MODRM_MOD_MASK) == (3 << X86_MODRM_MOD_SHIFT)) 11002 11082 { 11003 switch ( bRm & 0xf8)11083 switch ((bRm >> X86_MODRM_REG_SHIFT) & X86_MODRM_REG_SMASK) 11004 11084 { 11005 case 0xc0: return IEMOP_RAISE_INVALID_OPCODE(); 11006 case 0xc8: return IEMOP_RAISE_INVALID_OPCODE(); 11007 case 0xd0: return IEMOP_RAISE_INVALID_OPCODE(); 11008 case 0xd8: return IEMOP_RAISE_INVALID_OPCODE(); 11009 case 0xe0: 11010 switch (bRm) 11011 { 11012 case 0xe0: return FNIEMOP_CALL(iemOp_fnstsw_ax); 11013 default: return IEMOP_RAISE_INVALID_OPCODE(); 11014 } 11015 case 0xe8: AssertFailedReturn(VERR_IEM_INSTR_NOT_IMPLEMENTED); // fucomip 11016 case 0xf0: AssertFailedReturn(VERR_IEM_INSTR_NOT_IMPLEMENTED); // fcomip 11017 case 0xf8: return IEMOP_RAISE_INVALID_OPCODE(); 11085 case 0: return FNIEMOP_CALL_1(iemOp_ffreep_stN, bRm); /* ffree + pop afterwards, since forever according to AMD. */ 11086 case 1: return FNIEMOP_CALL(iemOp_fnop); 11087 case 2: return FNIEMOP_CALL(iemOp_fnop); 11088 case 3: return FNIEMOP_CALL(iemOp_fnop); 11089 case 4: if (bRm == 0xe0) 11090 return FNIEMOP_CALL(iemOp_fnstsw_ax); 11091 return IEMOP_RAISE_INVALID_OPCODE(); 11092 case 5: return FNIEMOP_CALL_1(iemOp_fucomip_st0_stN, bRm); 11093 case 6: return FNIEMOP_CALL_1(iemOp_fcomip_st0_stN, bRm); 11094 case 7: return IEMOP_RAISE_INVALID_OPCODE(); 11018 11095 IEM_NOT_REACHED_DEFAULT_CASE_RET(); 11019 11096 } … … 11021 11098 else 11022 11099 { 11023 AssertFailedReturn(VERR_IEM_INSTR_NOT_IMPLEMENTED); 11100 switch ((bRm >> X86_MODRM_REG_SHIFT) & X86_MODRM_REG_SMASK) 11101 { 11102 case 0: return FNIEMOP_CALL_1(iemOp_fild_m16i, bRm); 11103 case 1: return FNIEMOP_CALL_1(iemOp_fisttp_m16i, bRm); 11104 case 2: return FNIEMOP_CALL_1(iemOp_fist_m16i, bRm); 11105 case 3: return FNIEMOP_CALL_1(iemOp_fistp_m16i, bRm); 11106 case 4: return FNIEMOP_CALL_1(iemOp_fbld_m80d, bRm); 11107 case 5: return FNIEMOP_CALL_1(iemOp_fild_m64i, bRm); 11108 case 6: return FNIEMOP_CALL_1(iemOp_fbstp_m80d, bRm); 11109 case 7: return FNIEMOP_CALL_1(iemOp_fistp_m64i, bRm); 11110 IEM_NOT_REACHED_DEFAULT_CASE_RET(); 11111 } 11024 11112 } 11025 11113 } -
trunk/src/VBox/VMM/testcase/tstX86-1A.asm
r40083 r40086 1354 1354 1355 1355 1356 ;; 1357 ; Tests an reserved FPU encoding, checking that it does not affect the FPU or 1358 ; CPU state in any way. 1359 ; 1360 ; @uses stack 1361 %macro FpuNopEncoding 1+ 1362 fnclex 1363 call SetFSW_C0_thru_C3 1364 1365 push xBP 1366 mov xBP, xSP 1367 sub xSP, 1024 1368 and xSP, ~0fh 1369 call SaveFPUAndGRegsToStack 1370 %1 1371 call CompareFPUAndGRegsOnStack 1372 leave 1373 1374 jz %%ok 1375 add eax, __LINE__ 1376 jmp .return 1377 %%ok: 1378 %endmacro 1379 1380 ;; 1381 ; Used for marking encodings which has a meaning other than FNOP and 1382 ; needs investigating. 1383 %macro FpuUnknownEncoding 1+ 1384 %1 1385 %endmacro 1386 1387 1388 ;; 1389 ; Saves the FPU and general registers to the stack area right next to the 1390 ; return address. 1391 ; 1392 ; The required area size is 512 + 80h = 640. 1393 ; 1394 ; @uses Nothing, except stack. 1395 ; 1396 SaveFPUAndGRegsToStack: 1397 ; Must clear the FXSAVE area. 1398 pushf 1399 push xCX 1400 push xAX 1401 push xDI 1402 1403 lea xDI, [xSP + xS * 5] 1404 mov xCX, 512 / 4 1405 mov eax, 0cccccccch 1406 cld 1407 rep stosd 1408 1409 pop xDI 1410 pop xAX 1411 pop xCX 1412 popf 1413 1414 ; Save the FPU state. 1415 fxsave [xSP + xS] 1416 1417 ; Save GRegs (80h bytes). 1418 %ifdef RT_ARCH_AMD64 1419 mov [xSP + 512 + xS + 000h], xAX 1420 mov [xSP + 512 + xS + 008h], xBX 1421 mov [xSP + 512 + xS + 010h], xCX 1422 mov [xSP + 512 + xS + 018h], xDX 1423 mov [xSP + 512 + xS + 020h], xDI 1424 mov [xSP + 512 + xS + 028h], xSI 1425 mov [xSP + 512 + xS + 030h], xBP 1426 mov [xSP + 512 + xS + 038h], r8 1427 mov [xSP + 512 + xS + 040h], r9 1428 mov [xSP + 512 + xS + 048h], r10 1429 mov [xSP + 512 + xS + 050h], r11 1430 mov [xSP + 512 + xS + 058h], r12 1431 mov [xSP + 512 + xS + 060h], r13 1432 mov [xSP + 512 + xS + 068h], r14 1433 mov [xSP + 512 + xS + 070h], r15 1434 pushf 1435 pop rax 1436 mov [xSP + 512 + xS + 078h], rax 1437 mov rax, [xSP + 512 + xS + 000h] 1438 %else 1439 mov [xSP + 512 + xS + 000h], eax 1440 mov [xSP + 512 + xS + 004h], eax 1441 mov [xSP + 512 + xS + 008h], ebx 1442 mov [xSP + 512 + xS + 00ch], ebx 1443 mov [xSP + 512 + xS + 010h], ecx 1444 mov [xSP + 512 + xS + 014h], ecx 1445 mov [xSP + 512 + xS + 018h], edx 1446 mov [xSP + 512 + xS + 01ch], edx 1447 mov [xSP + 512 + xS + 020h], edi 1448 mov [xSP + 512 + xS + 024h], edi 1449 mov [xSP + 512 + xS + 028h], esi 1450 mov [xSP + 512 + xS + 02ch], esi 1451 mov [xSP + 512 + xS + 030h], ebp 1452 mov [xSP + 512 + xS + 034h], ebp 1453 mov [xSP + 512 + xS + 038h], eax 1454 mov [xSP + 512 + xS + 03ch], eax 1455 mov [xSP + 512 + xS + 040h], eax 1456 mov [xSP + 512 + xS + 044h], eax 1457 mov [xSP + 512 + xS + 048h], eax 1458 mov [xSP + 512 + xS + 04ch], eax 1459 mov [xSP + 512 + xS + 050h], eax 1460 mov [xSP + 512 + xS + 054h], eax 1461 mov [xSP + 512 + xS + 058h], eax 1462 mov [xSP + 512 + xS + 05ch], eax 1463 mov [xSP + 512 + xS + 060h], eax 1464 mov [xSP + 512 + xS + 064h], eax 1465 mov [xSP + 512 + xS + 068h], eax 1466 mov [xSP + 512 + xS + 06ch], eax 1467 mov [xSP + 512 + xS + 070h], eax 1468 mov [xSP + 512 + xS + 074h], eax 1469 pushf 1470 pop eax 1471 mov [xSP + 512 + xS + 078h], eax 1472 mov [xSP + 512 + xS + 07ch], eax 1473 mov eax, [xSP + 512 + xS + 000h] 1474 %endif 1475 ret 1476 1477 ;; 1478 ; Compares the current FPU and general registers to that found in the stack 1479 ; area prior to the return address. 1480 ; 1481 ; @uses Stack, flags and eax/rax. 1482 ; @returns eax is zero on success, eax is 1000000 * offset on failure. 1483 ; ZF reflects the eax value to save a couple of instructions... 1484 ; 1485 CompareFPUAndGRegsOnStack: 1486 lea xSP, [xSP - (1024 - xS)] 1487 call SaveFPUAndGRegsToStack 1488 1489 push xSI 1490 push xDI 1491 push xCX 1492 1493 mov xCX, 640 1494 lea xSI, [xSP + xS*3] 1495 lea xDI, [xSI + 1024] 1496 1497 mov dword [xSI + 0x8], 0 ; ignore FPUIP 1498 mov dword [xDI + 0x8], 0 ; ignore FPUIP 1499 1500 cld 1501 repe cmpsb 1502 je .ok 1503 1504 ;int3 1505 lea xAX, [xSP + xS*3] 1506 xchg xAX, xSI 1507 sub xAX, xSI 1508 1509 push xDX 1510 mov xDX, 1000000 1511 mul xDX 1512 pop xDX 1513 jmp .return 1514 .ok: 1515 xor eax, eax 1516 .return: 1517 pop xCX 1518 pop xDI 1519 pop xSI 1520 lea xSP, [xSP + (1024 - xS)] 1521 or eax, eax 1522 ret 1523 1524 1525 SetFSW_C0_thru_C3: 1526 sub xSP, 20h 1527 fstenv [xSP] 1528 or word [xSP + 4], X86_FSW_C0 | X86_FSW_C1 | X86_FSW_C2 | X86_FSW_C3 1529 fldenv [xSP] 1530 add xSP, 20h 1531 ret 1532 1356 1533 1357 1534 ;; … … 1365 1542 fld qword REF(.r64V1) 1366 1543 fld tword REF(.r80V1) 1544 fld qword REF(.r64V1) 1545 fld dword REF(.r32V1) 1546 fld qword REF(.r64V1) 1547 1548 ; Test the nop check. 1549 FpuNopEncoding fnop 1550 1551 ;FpuNopEncoding db 0dch, 0d8h 1552 ;int3 1553 ;db 0dch, 0d0h 1554 ; fld dword REF(.r32V1) 1555 ; fld dword REF(.r32D0) 1556 ;int3 1557 ;db 0dch, 0d9h ; fnop? 1558 ;int3 1559 1367 1560 1368 1561 ; the 0xd9 block … … 1383 1576 ShouldTrap X86_XCPT_UD, db 0d9h, 0d6h 1384 1577 ShouldTrap X86_XCPT_UD, db 0d9h, 0d7h 1385 db 0d9h, 0d8h ; fnop?1386 db 0d9h, 0d9h ; fnop?1387 db 0d9h, 0dah ; fnop?1388 db 0d9h, 0dbh ; fnop?1389 db 0d9h, 0dch ; fnop?1390 db 0d9h, 0ddh ; fnop?1391 db 0d9h, 0deh ; fnop?1392 db 0d9h, 0dfh ; fnop?1578 ;FpuUnknownEncoding db 0d9h, 0d8h ; fstp st(0),st(0)? 1579 ;FpuUnknownEncoding db 0d9h, 0d9h ; fstp st(1),st(0)? 1580 ;FpuUnknownEncoding db 0d9h, 0dah ; fstp st(2),st(0)? 1581 ;FpuUnknownEncoding db 0d9h, 0dbh ; fstp st(3),st(0)? 1582 ;FpuUnknownEncoding db 0d9h, 0dch ; fstp st(4),st(0)? 1583 ;FpuUnknownEncoding db 0d9h, 0ddh ; fstp st(5),st(0)? 1584 ;FpuUnknownEncoding db 0d9h, 0deh ; fstp st(6),st(0)? 1585 ;FpuUnknownEncoding db 0d9h, 0dfh ; fstp st(7),st(0)? 1393 1586 ShouldTrap X86_XCPT_UD, db 0d9h, 0e2h 1394 1587 ShouldTrap X86_XCPT_UD, db 0d9h, 0e3h … … 1433 1626 1434 1627 ; the 0xdb block 1435 db 0dbh, 0e0h ; fneni1436 db 0dbh, 0e1h ; fndisi1437 db 0dbh, 0e4h ; fnsetpm1628 FpuNopEncoding db 0dbh, 0e0h ; fneni 1629 FpuNopEncoding db 0dbh, 0e1h ; fndisi 1630 FpuNopEncoding db 0dbh, 0e4h ; fnsetpm 1438 1631 ShouldTrap X86_XCPT_UD, db 0dbh, 0e5h 1439 1632 ShouldTrap X86_XCPT_UD, db 0dbh, 0e6h … … 1453 1646 1454 1647 ; the 0xdc block 1455 db 0dbh, 0d0h ; fnop?1456 db 0dbh, 0d1h ; fnop?1457 db 0dbh, 0d2h ; fnop?1458 db 0dbh, 0d3h ; fnop?1459 db 0dbh, 0d4h ; fnop?1460 db 0dbh, 0d5h ; fnop?1461 db 0dbh, 0d6h ; fnop?1462 db 0dbh, 0d7h ; fnop?1463 db 0dbh, 0d8h ; fnop?1464 db 0dbh, 0d9h ; fnop?1465 db 0dbh, 0dah ; fnop?1466 db 0dbh, 0dbh ; fnop?1467 db 0dbh, 0dch ; fnop?1468 db 0dbh, 0ddh ; fnop?1469 db 0dbh, 0deh ; fnop?1470 db 0dbh, 0dfh ; fnop?1648 ;FpuNopEncoding db 0dch, 0d0h ; fcom? 1649 ;FpuNopEncoding db 0dch, 0d1h ; fcom? 1650 ;FpuNopEncoding db 0dch, 0d2h ; fcom? 1651 ;FpuNopEncoding db 0dch, 0d3h ; fcom? 1652 ;FpuNopEncoding db 0dch, 0d4h ; fcom? 1653 ;FpuNopEncoding db 0dch, 0d5h ; fcom? 1654 ;FpuNopEncoding db 0dch, 0d6h ; fcom? 1655 ;FpuNopEncoding db 0dch, 0d7h ; fcom? 1656 ;FpuNopEncoding db 0dch, 0d8h ; fcomp? 1657 ;FpuNopEncoding db 0dch, 0d9h ; fcomp? 1658 ;FpuNopEncoding db 0dch, 0dah ; fcomp? 1659 ;FpuNopEncoding db 0dch, 0dbh ; fcomp? 1660 ;FpuNopEncoding db 0dch, 0dch ; fcomp? 1661 ;FpuNopEncoding db 0dch, 0ddh ; fcomp? 1662 ;FpuNopEncoding db 0dch, 0deh ; fcomp? 1663 ;FpuNopEncoding db 0dch, 0dfh ; fcomp? 1471 1664 1472 1665 ; the 0xdd block 1473 db 0ddh, 0c0h ; fnop?1474 db 0ddh, 0c1h ; fnop?1475 db 0ddh, 0c2h ; fnop?1476 db 0ddh, 0c3h ; fnop?1477 db 0ddh, 0c4h ; fnop?1478 db 0ddh, 0c5h ; fnop?1479 db 0ddh, 0c6h ; fnop?1480 db 0ddh, 0c7h ; fnop?1666 FpuNopEncoding db 0ddh, 0c8h ; fnop? 1667 FpuUnknownEncoding db 0ddh, 0c9h ; fnop? 1668 FpuUnknownEncoding db 0ddh, 0cah ; fnop? 1669 FpuUnknownEncoding db 0ddh, 0cbh ; fnop? 1670 FpuUnknownEncoding db 0ddh, 0cch ; fnop? 1671 FpuUnknownEncoding db 0ddh, 0cdh ; fnop? 1672 FpuUnknownEncoding db 0ddh, 0ceh ; fnop? 1673 FpuUnknownEncoding db 0ddh, 0cfh ; fnop? 1481 1674 ShouldTrap X86_XCPT_UD, db 0ddh, 0f0h 1482 1675 ShouldTrap X86_XCPT_UD, db 0ddh, 0f1h … … 1498 1691 ShouldTrap X86_XCPT_UD, db 0ddh, 02fh 1499 1692 1693 ; the 0xde block 1694 FpuUnknownEncoding db 0deh, 0d0h ; fnop? 1695 FpuUnknownEncoding db 0deh, 0d1h ; fnop? 1696 FpuUnknownEncoding db 0deh, 0d2h ; fnop? 1697 FpuUnknownEncoding db 0deh, 0d3h ; fnop? 1698 FpuUnknownEncoding db 0deh, 0d4h ; fnop? 1699 FpuUnknownEncoding db 0deh, 0d5h ; fnop? 1700 FpuUnknownEncoding db 0deh, 0d6h ; fnop? 1701 FpuUnknownEncoding db 0deh, 0d7h ; fnop? 1702 ShouldTrap X86_XCPT_UD, db 0deh, 0d8h 1703 ShouldTrap X86_XCPT_UD, db 0deh, 0dah 1704 ShouldTrap X86_XCPT_UD, db 0deh, 0dbh 1705 ShouldTrap X86_XCPT_UD, db 0deh, 0dch 1706 ShouldTrap X86_XCPT_UD, db 0deh, 0ddh 1707 ShouldTrap X86_XCPT_UD, db 0deh, 0deh 1708 ShouldTrap X86_XCPT_UD, db 0deh, 0dfh 1709 1710 ; the 0xdf block 1711 FpuUnknownEncoding db 0dfh, 0c8h ; fnop? 1712 FpuUnknownEncoding db 0dfh, 0c9h ; fnop? 1713 FpuUnknownEncoding db 0dfh, 0cah ; fnop? 1714 FpuUnknownEncoding db 0dfh, 0cbh ; fnop? 1715 FpuUnknownEncoding db 0dfh, 0cch ; fnop? 1716 FpuUnknownEncoding db 0dfh, 0cdh ; fnop? 1717 FpuUnknownEncoding db 0dfh, 0ceh ; fnop? 1718 FpuUnknownEncoding db 0dfh, 0cfh ; fnop? 1719 FpuUnknownEncoding db 0dfh, 0d0h ; fnop? 1720 FpuUnknownEncoding db 0dfh, 0d1h ; fnop? 1721 FpuUnknownEncoding db 0dfh, 0d2h ; fnop? 1722 FpuUnknownEncoding db 0dfh, 0d3h ; fnop? 1723 FpuUnknownEncoding db 0dfh, 0d4h ; fnop? 1724 FpuUnknownEncoding db 0dfh, 0d5h ; fnop? 1725 FpuUnknownEncoding db 0dfh, 0d6h ; fnop? 1726 FpuUnknownEncoding db 0dfh, 0d7h ; fnop? 1727 FpuUnknownEncoding db 0dfh, 0d8h ; fnop? 1728 FpuUnknownEncoding db 0dfh, 0d9h ; fnop? 1729 FpuUnknownEncoding db 0dfh, 0dah ; fnop? 1730 FpuUnknownEncoding db 0dfh, 0dbh ; fnop? 1731 FpuUnknownEncoding db 0dfh, 0dch ; fnop? 1732 FpuUnknownEncoding db 0dfh, 0ddh ; fnop? 1733 FpuUnknownEncoding db 0dfh, 0deh ; fnop? 1734 FpuUnknownEncoding db 0dfh, 0dfh ; fnop? 1735 ShouldTrap X86_XCPT_UD, db 0dfh, 0e1h 1736 ShouldTrap X86_XCPT_UD, db 0dfh, 0e2h 1737 ShouldTrap X86_XCPT_UD, db 0dfh, 0e3h 1738 ShouldTrap X86_XCPT_UD, db 0dfh, 0e4h 1739 ShouldTrap X86_XCPT_UD, db 0dfh, 0e5h 1740 ShouldTrap X86_XCPT_UD, db 0dfh, 0e6h 1741 ShouldTrap X86_XCPT_UD, db 0dfh, 0e7h 1742 ShouldTrap X86_XCPT_UD, db 0dfh, 0f8h 1743 ShouldTrap X86_XCPT_UD, db 0dfh, 0f9h 1744 ShouldTrap X86_XCPT_UD, db 0dfh, 0fah 1745 ShouldTrap X86_XCPT_UD, db 0dfh, 0fbh 1746 ShouldTrap X86_XCPT_UD, db 0dfh, 0fch 1747 ShouldTrap X86_XCPT_UD, db 0dfh, 0fdh 1748 ShouldTrap X86_XCPT_UD, db 0dfh, 0feh 1749 ShouldTrap X86_XCPT_UD, db 0dfh, 0ffh 1750 1500 1751 1501 1752 .success: … … 1508 1759 .r64V1: dq 6.4 1509 1760 .r80V1: dt 8.0 1761 1762 ; Denormal numbers. 1763 .r32D0: dd 0200000h 1510 1764 1511 1765 ENDPROC x861_Test5
Note:
See TracChangeset
for help on using the changeset viewer.