FRSTPM is a little-known instruction introduced with Intel’s 80287XL and M80287 coprocessors, intended to reverse FSETPM’s switch to protected-mode floating-point state handling. FSETPM mattered because the 80287 needed software to tell it when the 286 entered protected mode; unlike the CPU, the coprocessor could not detect that change itself. FRSTPM had little practical purpose: a 286 returned to real mode by resetting the CPU, which was expected to reset the FPU too, while on a 386 the CPU handled address tracking and state formats automatically. The 287XL also arrived late in the 286’s life, and existing software generally did not recognize the instruction.
Documentation adds to the mystery. Intel datasheets specify FRSTPM’s encoding as DB F4, while many references and Solaris/Illumos use DB E5; Intel manuals also gave inconsistent accounts of how related legacy instructions behave on newer processors. To investigate, the author tested two 287XL chips in a repaired 286 system, comparing saved FPU environments before and after FSETPM and trying both candidate FRSTPM encodings. The test confirmed that FSETPM changes the saved environment to the protected-mode format even while the CPU remains in real mode. The described material also notes that 286/287 tests require careful synchronization: an FWAIT after saving the environment prevents the CPU from reading data before the coprocessor has written it.
Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.