2020年12月22日星期二

Possible MASM bug when using math coprocessor

Masm allows different cpu combinations before instructions but certain combinations do not correctly detect coprocessor instructions that require a wait prefix and will cause no wait prefix when a wait prefix is required. The following combinations will cause any math coprocessor instructions after them to have NO wait prefix: code fragments: example 1: .386 .8087 ;now enter math coprocessor instruction example 2: .286 .8087 ;now enter math coprocessor instruction example 3: .386 .287 ;now enter math coprocessor instruction

if a math coprocessor instruction is then used a wait prefix (that is normally created by MASM) will NOT be created. Here are the instructions that will NOT have a wait prefix when they should have one:

FRSTOR,FFREE,FDECSTP,FINCSTP,FLDENV,FLDCW FLD,FST,FSTP,FXCH,FLDZ,FLD1,FLDPI,FLDL2E,FLDL2T, FLDLG2,FLDLN2,FILD,FIST,FISTP,FBLD,FBSTP,FCOM, FCOMP,FCOMPP,FICOM,FICOMP,FXAM,FADD,FADDP, FMUL,FMULP,FSUB,FSUBP,FSUBR,FSUBRP,FDIV,FDIVP, FDIVR,FDIVRP,FABS,FCHS,FSQRT,FRNDINT,FIADD,FIMUL, FISUB,FISUBR,FIDIV,FIDIVR,FPTAN,FPATAN,F2XM1,FSCALE, FYL2X,FYL2XP1,FPREM,FPREM1,FXTRACT,FSETPM and FNOP

These instructions are not are not affected:

FCLEX,FNCLEX,FSAVE,FNSAVE,FENI,FNENI,FDISI,FNDISI, FSTENV,FNSTENV,FINIT,FNINIT,FSTSW,FNSTSW,FSTCW and FNSTCW

Is this a bug? I have found no documentation that mentions this behavior. I do not have a later version of MASM to see if this has been fixed. The version I have is masm v6.

https://stackoverflow.com/questions/65418457/possible-masm-bug-when-using-math-coprocessor December 23, 2020 at 10:58AM

没有评论:

发表评论