Urgent.News

What's breaking now, across hundreds of outlets.

Tech

FRSTPM, a completely useless 80287 instruction?

FRSTPM is an instruction documented on the Intel 80287XL math coprocessor and the Intel M80287, but it was not present in the original 80287. To grasp the purpose of FRSTPM, it is helpful to understand its older sibling, FSETPM. The original 8087 tracked a 20-bit linear address for floating-point instructions and operands, a limitation of 8086/8088 interfacing.

While 20-bit linear addressing worked in real mode, it was insufficient for protected mode. Intel attempted to extend the linear address to 24 bits on the 80287, but this was impractical. Protected mode required tracking the original segment and offset of floating-point instructions, which the 80287 was redesigned to accomplish.

However, FPU did not have direct access to the 80286 Machine Status Word (MSW) and lacked automatic notification of MSW changes. Hence, system software needed to execute FSETPM after switching the CPU to protected mode, informing the FPU about the need to use the segmented address format for saving and loading the FPU state. The original 80287 lacked any instruction to undo the effect of FSETPM.

When the CPU exited protected mode via reset, the FPU also reset to real mode, making FRSTPM unnecessary. The 80287XL, released in 1990, introduced FRSTPM, presumably to address the gap between the 387's advanced functionality and the 80287's legacy status. The 80287XL essentially combined the features of the 387 FPU within a 287-compatible package.

An interesting observation is that the 80386 could switch modes without resetting the CPU, yet the 80387 did not include FRSTPM. This was because neither FRSTPM nor FSETPM were essential for the 386, as the CPU itself managed the relevant address tracking, and the FPU save/restore format adapted automatically based on the CPU mode.

Therefore, FRSTPM's purpose remains unclear: it is redundant on the 386 and unnecessary on the 286, as a CPU/FPU reset is used to transition between modes. FRSTPM's utility is further limited by the limited availability of the 80287XL in 1990. While new 286 systems were still being sold, existing 286/287 software had a significant installed base to consider.

Intel's own documentation regarding FRSTPM is inconsistent, as it initially described FSETPM as equivalent to FNOP in newer CPUs/FPUs, but later clarified that FSETPM behaves as a NOP. Despite this, the 386 microcode disassembly suggests that the instructions may not be treated as NOPs, as they raise device-not-available faults and are sent to the FPU for processing.

Rewritten by urgent.news; may contain errors — check the original.

Source: os2museum.com

Read the original at os2museum.com →

Report a problem with this story

More in Tech

More from Wednesday 25 November →