that the format word is valid. If the format word is valid, the FPCP returns the same format
word that was written; if the format word is not valid, an illegal format word ($02xx) is
returned. If the format word is successfully verified, the MPU begins to transfer the state
frame, four bytes at a time, from memory to the FPCP operand CIR.
When transferring the state frame from memory to the FPCP, the MPU first transfers the
format word and, after it is verified, transfers the remainder of the state frame. The order
of transfer is the same for both the postincrement and the control addressing modes. The
long word at the lowest address is transferred first, followed by the long words at suc-
cessively higher addresses. For the postincrement addressing mode, the specified address
register is not updated by the MPU until the entire frame has been successfully transferred.
Thus, a fault during an FRESTORE instruction generates a stack frame that does not overwrite
any part of the FPCP state frame.
After the entire state frame has been transferred to the FPCP, the MPU continues with the
execution of the next instruction (it does not read the response CIR). If an exception related
to the FPCP caused the suspension of the task earlier, an RTE instruction is eventually
executed to return to the original context. Depending on the exception type, the RTE may
re-establish the MCU/coprocessor protocol of the suspended operation or begin the exe-
cution of a new FPCP instruction.
6.4.5 Context Switching Summary
To perform a complete context save or restore operation, three FPCP instructions are
required. First, the FSAVE and FRESTORE instructions are used to transfer the nonuser-
visible portion of the machine state between the FPCP and memory. Second, the FMOVEM
instruction may be used to transfer the user-visible portion of the machine, including the
floating-point data and control registers.
An important aspect of the FMOVEM instruction is that it cannot cause an exception or
report a pending exception; thus the context of the FPCP, including pending exceptions,
can be saved and restored in a manner that is completely transparent to a user program.
Note that if an FSAVE instruction stores a null state frame, the floating-point data and
control registers are reset to their default states, and the FMOVEM instructions are not
needed. Figur e 6-7 illustrates the manner in which a full context switch might be performed.
MC68881/MC68882 USER'S MANUAL
FREESCALE
6-39