Zephyr API Documentation 3.7.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Floating Point APIs

Functions

int k_float_disable (struct k_thread *thread)
 Disable preservation of floating point context information.
 
int k_float_enable (struct k_thread *thread, unsigned int options)
 Enable preservation of floating point context information.
 

Detailed Description

Function Documentation

◆ k_float_disable()

int k_float_disable ( struct k_thread * thread)

#include <zephyr/kernel.h>

Disable preservation of floating point context information.

This routine informs the kernel that the specified thread will no longer be using the floating point registers.

Warning
Some architectures apply restrictions on how the disabling of floating point preservation may be requested, see arch_float_disable.
This routine should only be used to disable floating point support for a thread that currently has such support enabled.
Parameters
threadID of thread.
Return values
0On success.
-ENOTSUPIf the floating point disabling is not implemented. -EINVAL If the floating point disabling could not be performed.

◆ k_float_enable()

int k_float_enable ( struct k_thread * thread,
unsigned int options )

#include <zephyr/kernel.h>

Enable preservation of floating point context information.

This routine informs the kernel that the specified thread will use the floating point registers.

Invoking this routine initializes the thread's floating point context info to that of an FPU that has been reset. The next time the thread is scheduled by z_swap() it will either inherit an FPU that is guaranteed to be in a "sane" state (if the most recent user of the FPU was cooperatively swapped out) or the thread's own floating point context will be loaded (if the most recent user of the FPU was preempted, or if this thread is the first user of the FPU). Thereafter, the kernel will protect the thread's FP context so that it is not altered during a preemptive context switch.

The options parameter indicates which floating point register sets will be used by the specified thread.

For x86 options:

  • K_FP_REGS indicates x87 FPU and MMX registers only
  • K_SSE_REGS indicates SSE registers (and also x87 FPU and MMX registers)
Warning
Some architectures apply restrictions on how the enabling of floating point preservation may be requested, see arch_float_enable.
This routine should only be used to enable floating point support for a thread that currently has such support enabled.
Parameters
threadID of thread.
optionsarchitecture dependent options
Return values
0On success.
-ENOTSUPIf the floating point enabling is not implemented. -EINVAL If the floating point enabling could not be performed.