Issue created by Sebastian Huber: https://gitlab.rtems.org/rtems/rtos/rtems/-/work_items/5764
The MIPS port gives the floating point unit a context of its own. `CPU_HARDWARE_FP` is true and `CPU_ALL_TASKS_ARE_FP` follows it. `CPU_USE_DEFERRED_FP_SWITCH` is true. `cpu.h` declares a `Context_Control_fp`, and `cpu_asm.S` defines `_CPU_Context_save_fp()` and `_CPU_Context_restore_fp()` for it. Three of the thirteen ports still set the deferred switch. They are m68k, mips and or1k, and or1k has no floating point context at all. aarch64, arm, microblaze, moxie, nios2 and riscv carry none of the four settings. powerpc and riscv hold the call-saved floating point registers in `Context_Control` and switch them in `_CPU_Context_switch()`. The context switch keeps the coprocessor enable of the unit as a bit of the task. A task without the floating point attribute therefore runs with the unit off. `setjmp()` of a hard float ABI saves the call-saved registers of the unit, so every task reaches it. Such a task takes a coprocessor unusable exception inside `setjmp()`. `spfatal31`, `ts-fatal-extension` and `ts-validation-acfg-0` end that way on `mips/malta`. `_ISR_Handler` takes the interrupt path where the exception code of the cause register is zero. That path saves the call-used integer registers. It saves no floating point register and it leaves coprocessor 1 enabled. An interrupt handler which uses the unit therefore changes `$f0` to `$f19` of the interrupted context. The ABI marks those registers call-used, so interrupt processing owes them to the interrupted context. The exception path saves all 32 registers into the frame. `_CPU_Exception_resume()` restores none of them. Move the call-saved floating point registers into `Context_Control` and switch them in `_CPU_Context_switch()`. Save the call-used floating point registers on the interrupt path. Keep every user-visible register in the exception frame and restore it in `_CPU_Exception_resume()`. Enable the coprocessor globally. Set `CPU_HARDWARE_FP`, `CPU_ALL_TASKS_ARE_FP` and `CPU_USE_DEFERRED_FP_SWITCH` to false. Delete `Context_Control_fp` with its save and restore functions. RTEMS builds an `msoft-float` multilib on every ISA level, so every floating point path needs a hard float guard. Found in the repair of the Malta BSP for the test suite. This description was created with Claude Code assistance. -- View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/work_items/5764 You're receiving this email because of your account on gitlab.rtems.org. Unsubscribe from this thread: https://gitlab.rtems.org/-/namespace/49/sent_notifications/5-1ka4scb09xjfxfy7bnxyd7yvr-1d/unsubscribe | Manage all notifications: https://gitlab.rtems.org/-/profile/notifications | Help: https://gitlab.rtems.org/help
_______________________________________________ bugs mailing list [email protected] http://lists.rtems.org/mailman/listinfo/bugs
