Home |
RTKernel-32 Programming Manual Function RTKProtect8087 |
Function RTKProtect8087In addition to the main processor, a task can use a math coprocessor, if installed, or an 80387 software emulator. In this case, the state of the coprocessor will also be saved and restored during a task switch. Coprocessor/emulator usage can be turned on or off separately for each task using RTKProtect8087 and RTKFree8087. The initial floating point usage of a task is controlled by the Flags parameter to RTKCreateThread or flag RF_FPCONTEXT in RTKConfig.Flags. RTKProtect8087 turns on coprocessor protection for the calling thread: void RTKProtect8087(void); The exact behavior of floating point context switching is determined by the floating point driver used by RTKernel-32. For further details, please refer to RTKernel-32 Drivers, Floating Point. If tasks use the coprocessor without coprocessor protection enabled, calculations may yield wrong results or the program may crash due to an error exception of the coprocessor. During cooperative scheduling, coprocessor protection is not required at all if it is guaranteed that task switches cannot occur during the evaluation of a floating point expression. If RTKernel-32 finds that no floating point context switching is required by the floating point driver (for example, because the emulator used is reentrant), all calls to RTKProtect8087 are ignored.
|