kernel: Rename USE_FP and USE_SSE symbols
Symbols now use the K_ prefix which is now standard for the unified kernel. Legacy support for these symbols is retained to allow existing applications to build successfully. Change-Id: I3ff12c96f729b535eecc940502892cbaa52526b6 Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
This commit is contained in:
parent
27ecd5d8f3
commit
f48f263665
13 changed files with 55 additions and 46 deletions
|
@ -145,7 +145,8 @@ typedef struct callee_saved tCalleeSaved;
|
|||
#define K_DUMMY 0x00020000 /* Not a real thread */
|
||||
#define K_EXECUTION_MASK (K_TIMING | K_PENDING | K_PRESTART | \
|
||||
K_DEAD | K_SUSPENDED | K_DUMMY)
|
||||
#define USE_FP 0x010 /* 1 = thread uses floating point unit */
|
||||
|
||||
#define K_FP_REGS 0x010 /* 1 = thread uses floating point registers */
|
||||
#define K_ESSENTIAL 0x200 /* 1 = system thread that must not abort */
|
||||
#define NO_METRICS 0x400 /* 1 = _Swap() not to update task metrics */
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ static ALWAYS_INLINE void thread_monitor_init(struct tcs *tcs)
|
|||
* @param parameter2 entry point to the second param
|
||||
* @param parameter3 entry point to the third param
|
||||
* @param priority thread priority
|
||||
* @param options thread options: K_ESSENTIAL, USE_FP
|
||||
* @param options thread options: K_ESSENTIAL, K_FP_REGS
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
|
|
|
@ -107,7 +107,7 @@ typedef struct preempt tPreempt;
|
|||
#define K_EXECUTION_MASK (K_TIMING | K_PENDING | K_PRESTART | \
|
||||
K_DEAD | K_SUSPENDED | K_DUMMY)
|
||||
|
||||
#define USE_FP 0x010 /* 1 = thread uses floating point unit */
|
||||
#define K_FP_REGS 0x010 /* 1 = thread uses floating point registers */
|
||||
#define K_ESSENTIAL 0x200 /* 1 = system thread that must not abort */
|
||||
#define NO_METRICS 0x400 /* 1 = _Swap() not to update task metrics */
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ extern "C" {
|
|||
|
||||
#define INT_ACTIVE 0x002 /* 1 = executing context is interrupt handler */
|
||||
#define EXC_ACTIVE 0x004 /* 1 = executing context is exception handler */
|
||||
#define USE_FP 0x010 /* 1 = thread uses floating point unit */
|
||||
#define K_FP_REGS 0x010 /* 1 = thread uses floating point registers */
|
||||
#define K_ESSENTIAL 0x200 /* 1 = system thread that must not abort */
|
||||
#define NO_METRICS 0x400 /* 1 = _Swap() not to update task metrics */
|
||||
|
||||
|
|
|
@ -43,10 +43,10 @@
|
|||
*
|
||||
* The 'options' parameter is used to specify what non-integer capabilities are
|
||||
* being used. The same options accepted by fiber_fiber_start() are used in the
|
||||
* aforementioned APIs, namely USE_FP and USE_SSE.
|
||||
* aforementioned APIs, namely K_FP_REGS and K_SSE_REGS.
|
||||
*
|
||||
* If the nanokernel has been built without SSE instruction support
|
||||
* (CONFIG_SSE), the system treats USE_SSE as if it was USE_FP.
|
||||
* (CONFIG_SSE), the system treats K_SSE_REGS as if it was K_FP_REGS.
|
||||
*
|
||||
* If the nanokernel has been built without floating point resource sharing
|
||||
* support (CONFIG_FP_SHARING), the aforementioned APIs and capabilities do not
|
||||
|
@ -102,7 +102,7 @@ extern uint32_t _sse_mxcsr_default_value; /* SSE control/status register default
|
|||
*/
|
||||
static void _FpCtxSave(struct tcs *tcs)
|
||||
{
|
||||
_do_fp_ctx_save(tcs->flags & USE_SSE, &tcs->preempFloatReg);
|
||||
_do_fp_ctx_save(tcs->flags & K_SSE_REGS, &tcs->preempFloatReg);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -117,7 +117,7 @@ static void _FpCtxSave(struct tcs *tcs)
|
|||
*/
|
||||
static inline void _FpCtxInit(struct tcs *tcs)
|
||||
{
|
||||
_do_fp_ctx_init(tcs->flags & USE_SSE);
|
||||
_do_fp_ctx_init(tcs->flags & K_SSE_REGS);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -129,8 +129,8 @@ static inline void _FpCtxInit(struct tcs *tcs)
|
|||
* other tasks/fibers. The <options> parameter indicates which floating point
|
||||
* register sets will be used by the specified task/fiber:
|
||||
*
|
||||
* a) USE_FP indicates x87 FPU and MMX registers only
|
||||
* b) USE_SSE indicates x87 FPU and MMX and SSEx registers
|
||||
* a) K_FP_REGS indicates x87 FPU and MMX registers only
|
||||
* b) K_SSE_REGS indicates x87 FPU and MMX and SSEx registers
|
||||
*
|
||||
* Invoking this routine creates a floating point thread for the task/fiber
|
||||
* that corresponds to an FPU that has been reset. The system will thereafter
|
||||
|
@ -142,7 +142,7 @@ static inline void _FpCtxInit(struct tcs *tcs)
|
|||
* task/fiber that does not currently have such support enabled already.
|
||||
*
|
||||
* @param tcs TDB
|
||||
* @param options set to either USE_FP or USE_SSE
|
||||
* @param options set to either K_FP_REGS or K_SSE_REGS
|
||||
*
|
||||
* @return N/A
|
||||
*
|
||||
|
@ -173,7 +173,7 @@ void _FpEnable(struct tcs *tcs, unsigned int options)
|
|||
|
||||
/* Indicate task/fiber requires non-integer context saving */
|
||||
|
||||
tcs->flags |= options | USE_FP; /* USE_FP is treated as a "dirty bit" */
|
||||
tcs->flags |= options | K_FP_REGS;
|
||||
|
||||
/*
|
||||
* Current task/fiber might not allow FP instructions, so clear CR0[TS]
|
||||
|
@ -219,7 +219,7 @@ void _FpEnable(struct tcs *tcs, unsigned int options)
|
|||
* of the FPU to them (unless we need it ourselves).
|
||||
*/
|
||||
|
||||
if ((_nanokernel.current->flags & USE_FP) != USE_FP) {
|
||||
if ((_nanokernel.current->flags & K_FP_REGS) != K_FP_REGS) {
|
||||
/*
|
||||
* We are not FP-capable, so mark FPU as owned by the
|
||||
* thread
|
||||
|
@ -319,7 +319,7 @@ void _FpDisable(struct tcs *tcs)
|
|||
* of the options specified at the time support was enabled.
|
||||
*/
|
||||
|
||||
tcs->flags &= ~(USE_FP | USE_SSE);
|
||||
tcs->flags &= ~(K_FP_REGS | K_SSE_REGS);
|
||||
|
||||
if (tcs == _nanokernel.current) {
|
||||
_FpAccessDisable();
|
||||
|
@ -357,8 +357,8 @@ FUNC_ALIAS(_FpDisable, k_float_disable, void);
|
|||
*
|
||||
* The processor will generate this exception if any x87 FPU, MMX, or SSEx
|
||||
* instruction is executed while CR0[TS]=1. The handler then enables the
|
||||
* current task or fiber with the USE_FP option (or the USE_SSE option if the
|
||||
* SSE configuration option has been enabled).
|
||||
* current task or fiber with the K_FP_REGS option (or the K_SSE_REGS option
|
||||
* if the SSE configuration option has been enabled).
|
||||
*
|
||||
* @param pEsf this value is not used for this architecture
|
||||
*
|
||||
|
@ -382,9 +382,9 @@ void _FpNotAvailableExcHandler(NANO_ESF * pEsf)
|
|||
/* Enable highest level of FP capability configured into the kernel */
|
||||
|
||||
#ifdef CONFIG_SSE
|
||||
enableOption = USE_SSE;
|
||||
enableOption = K_SSE_REGS;
|
||||
#else
|
||||
enableOption = USE_FP;
|
||||
enableOption = K_FP_REGS;
|
||||
#endif
|
||||
|
||||
_FpEnable(_nanokernel.current, enableOption);
|
||||
|
|
|
@ -70,7 +70,7 @@
|
|||
*
|
||||
* Floating point registers are handled using a lazy save/restore
|
||||
* mechanism since it's expected relatively few threads will be created
|
||||
* with the USE_FP or USE_SSE option bits. The nanokernel data structure
|
||||
* with the K_FP_REGS or K_SSE_REGS option bits. The nanokernel data structure
|
||||
* maintains a 'current_fp' field to keep track of the thread that "owns"
|
||||
* the floating point registers. Floating point registers consist of
|
||||
* ST0->ST7 (x87 FPU and MMX registers) and XMM0 -> XMM7.
|
||||
|
@ -167,7 +167,7 @@ SECTION_FUNC(TEXT, _Swap)
|
|||
* out preemptively.
|
||||
*/
|
||||
|
||||
testl $USE_FP, __tTCS_flags_OFFSET (%eax)
|
||||
testl $K_FP_REGS, __tTCS_flags_OFFSET (%eax)
|
||||
je restoreContext_NoFloatSwap
|
||||
|
||||
|
||||
|
@ -208,7 +208,7 @@ SECTION_FUNC(TEXT, _Swap)
|
|||
|
||||
|
||||
#ifdef CONFIG_SSE
|
||||
testl $USE_SSE, __tTCS_flags_OFFSET (%ebx)
|
||||
testl $K_SSE_REGS, __tTCS_flags_OFFSET (%ebx)
|
||||
je x87FloatSave
|
||||
|
||||
/*
|
||||
|
@ -247,7 +247,7 @@ restoreContext_NoFloatSave:
|
|||
je restoreContext_NoFloatRestore
|
||||
|
||||
#ifdef CONFIG_SSE
|
||||
testl $USE_SSE, __tTCS_flags_OFFSET (%eax)
|
||||
testl $K_SSE_REGS, __tTCS_flags_OFFSET (%eax)
|
||||
je x87FloatRestore
|
||||
|
||||
fxrstor __tTCS_preempFloatReg_OFFSET (%eax)
|
||||
|
@ -272,7 +272,7 @@ restoreContext_NoFloatRestore:
|
|||
/*
|
||||
* Branch point when none of the non-integer registers need to be
|
||||
* swapped either due to a) the incoming thread does not
|
||||
* USE_FP | USE_SSE, or b) the incoming thread is the same as
|
||||
* K_FP_REGS | K_SSE_REGS, or b) the incoming thread is the same as
|
||||
* the last thread that utilized the non-integer registers.
|
||||
*/
|
||||
|
||||
|
@ -283,7 +283,7 @@ restoreContext_NoFloatSwap:
|
|||
* instructions
|
||||
*/
|
||||
|
||||
testl $USE_FP, __tTCS_flags_OFFSET (%eax)
|
||||
testl $K_FP_REGS, __tTCS_flags_OFFSET (%eax)
|
||||
jne CROHandlingDone
|
||||
|
||||
/*
|
||||
|
|
|
@ -75,7 +75,7 @@ static ALWAYS_INLINE void thread_monitor_init(struct tcs *tcs)
|
|||
* @param pStackMem pointer to thread stack memory
|
||||
* @param stackSize size of a stack in bytes
|
||||
* @param priority thread priority
|
||||
* @param options thread options: K_ESSENTIAL, USE_FP, USE_SSE
|
||||
* @param options thread options: K_ESSENTIAL, K_FP_REGS, K_SSE_REGS
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
|
@ -94,9 +94,9 @@ static void _new_thread_internal(char *pStackMem, unsigned stackSize,
|
|||
|
||||
/* k_q_node initialized upon first insertion in a list */
|
||||
#ifdef CONFIG_FP_SHARING
|
||||
/* ensure USE_FP is set when USE_SSE is set */
|
||||
if (options & USE_SSE) {
|
||||
options |= USE_FP;
|
||||
/* ensure K_FP_REGS is set when K_SSE_REGS is set */
|
||||
if (options & K_SSE_REGS) {
|
||||
options |= K_FP_REGS;
|
||||
}
|
||||
#endif
|
||||
tcs->flags = options | K_PRESTART;
|
||||
|
@ -144,6 +144,7 @@ static void _new_thread_internal(char *pStackMem, unsigned stackSize,
|
|||
|
||||
tcs->coopReg.esp = (unsigned long)pInitialCtx;
|
||||
PRINTK("\nInitial context ESP = 0x%x\n", tcs->coopReg.esp);
|
||||
|
||||
PRINTK("\nstruct tcs * = 0x%x", tcs);
|
||||
|
||||
thread_monitor_init(tcs);
|
||||
|
@ -248,7 +249,7 @@ __asm__("\t.globl _thread_entry\n"
|
|||
* @param parameter2 second param to entry point
|
||||
* @param parameter3 third param to entry point
|
||||
* @param priority thread priority
|
||||
* @param options thread options: K_ESSENTIAL, USE_FP, USE_SSE
|
||||
* @param options thread options: K_ESSENTIAL, K_FP_REGS, K_SSE_REGS
|
||||
*
|
||||
*
|
||||
* @return opaque pointer to initialized TCS structure
|
||||
|
|
|
@ -53,13 +53,13 @@
|
|||
/*
|
||||
* Bitmask definitions for the struct tcs->flags bit field
|
||||
*
|
||||
* The USE_FP flag bit will be set whenever a thread uses any non-integer
|
||||
* The K_FP_REGS flag bit will be set whenever a thread uses any non-integer
|
||||
* capability, whether it's just the x87 FPU capability, SSE instructions, or
|
||||
* a combination of both. The USE_SSE flag bit will only be set if a thread
|
||||
* a combination of both. The K_SSE_REGS flag bit will only be set if a thread
|
||||
* uses SSE instructions.
|
||||
*
|
||||
* Note: Any change to the definitions USE_FP and USE_SSE must also be made to
|
||||
* nanokernel/x86/arch.h.
|
||||
* Note: Any change to the definitions K_FP_REGS and K_SSE_REGS must also
|
||||
* be made to nanokernel/x86/arch.h.
|
||||
*/
|
||||
|
||||
#define K_STATIC 0x00000800
|
||||
|
@ -76,8 +76,8 @@
|
|||
|
||||
#define INT_ACTIVE 0x2 /* 1 = executing context is interrupt handler */
|
||||
#define EXC_ACTIVE 0x4 /* 1 = executing context is exception handler */
|
||||
#define USE_FP 0x10 /* 1 = thread uses floating point unit */
|
||||
#define USE_SSE 0x20 /* 1 = thread uses SSEx instructions */
|
||||
#define K_FP_REGS 0x10 /* 1 = thread uses floating point registers */
|
||||
#define K_SSE_REGS 0x20 /* 1 = thread uses SSEx registers */
|
||||
#define K_ESSENTIAL 0x200 /* 1 = system thread that must not abort */
|
||||
#define NO_METRICS 0x400 /* 1 = _Swap() not to update task metrics */
|
||||
#define NO_METRICS_BIT_OFFSET 0xa /* Bit position of NO_METRICS */
|
||||
|
@ -606,9 +606,9 @@ typedef struct s_coopFloatReg {
|
|||
|
||||
typedef struct s_preempFloatReg {
|
||||
union {
|
||||
/* threads with USE_FP utilize this format */
|
||||
/* threads with K_FP_REGS utilize this format */
|
||||
tFpRegSet fpRegs;
|
||||
/* threads with USE_SSE utilize this format */
|
||||
/* threads with K_SSE_REGS utilize this format */
|
||||
tFpRegSetEx fpRegsEx;
|
||||
} floatRegsUnion;
|
||||
} tPreempFloatReg;
|
||||
|
|
|
@ -101,14 +101,15 @@ handling overhead involved in auto-tagging threads, it is possible to
|
|||
pre-tag a thread using one of the techniques listed below.
|
||||
|
||||
* A statically-spawned x86 thread can be pre-tagged by passing the
|
||||
:c:macro:`USE_FP` or :c:macro:`USE_SSE` option to
|
||||
:c:macro:`K_FP_REGS` or :c:macro:`K_SSE_REGS` option to
|
||||
:c:macro:`K_THREAD_DEFINE()`.
|
||||
|
||||
* A dynamically-spawned x86 thread can be pre-tagged by passing the
|
||||
:c:macro:`USE_FP` or :c:macro:`USE_SSE` option to :c:func:`k_thread_spawn()`.
|
||||
:c:macro:`K_FP_REGS` or :c:macro:`K_SSE_REGS` option to
|
||||
:c:func:`k_thread_spawn()`.
|
||||
|
||||
* An already-spawned x86 thread can pre-tag itself once it has started
|
||||
by passing the :c:macro:`USE_FP` or :c:macro:`USE_SSE` option to
|
||||
by passing the :c:macro:`K_FP_REGS` or :c:macro:`K_SSE_REGS` option to
|
||||
:c:func:`k_float_enable()`.
|
||||
|
||||
If an x86 thread uses the floating point registers infrequently it can call
|
||||
|
|
|
@ -128,7 +128,7 @@ The following thread options are supported.
|
|||
|
||||
By default, the thread is not considered to be an essential thread.
|
||||
|
||||
:c:macro:`USE_FP` and :c:macro:`USE_SSE`
|
||||
:c:macro:`K_FP_REGS` and :c:macro:`K_SSE_REGS`
|
||||
These x86-specific options indicate that the thread uses the CPU's
|
||||
floating point registers and SSE registers, respectively. This instructs
|
||||
the kernel to take additional steps to save and restore the contents
|
||||
|
|
|
@ -389,11 +389,11 @@ static ALWAYS_INLINE void _arch_irq_unlock(unsigned int key)
|
|||
#ifdef CONFIG_FP_SHARING
|
||||
/* Definitions for the 'options' parameter to the fiber_fiber_start() API */
|
||||
|
||||
/** thread uses floating point unit */
|
||||
#define USE_FP 0x10
|
||||
/** thread uses floating point registers */
|
||||
#define K_FP_REGS 0x10
|
||||
#ifdef CONFIG_SSE
|
||||
/** thread uses SSEx instructions */
|
||||
#define USE_SSE 0x20
|
||||
/** thread uses SSEx registers */
|
||||
#define K_SSE_REGS 0x20
|
||||
#endif /* CONFIG_SSE */
|
||||
#endif /* CONFIG_FP_SHARING */
|
||||
|
||||
|
@ -417,7 +417,7 @@ extern void k_float_disable(k_tid_t thread_id);
|
|||
* @brief Enable floating point hardware resources sharing
|
||||
* Dynamically enable/disable the capability of a thread to share floating
|
||||
* point hardware resources. The same "floating point" options accepted by
|
||||
* fiber_fiber_start() are accepted by these APIs (i.e. USE_FP and USE_SSE).
|
||||
* fiber_fiber_start() are accepted by these APIs (i.e. K_FP_REGS, K_SSE_REGS).
|
||||
*/
|
||||
extern void fiber_float_enable(nano_thread_id_t thread_id,
|
||||
unsigned int options);
|
||||
|
|
|
@ -3064,6 +3064,9 @@ static inline int32_t nano_timer_ticks_remain(struct nano_timer *timer)
|
|||
|
||||
/* floating point services */
|
||||
|
||||
#define USE_FP K_FP_REGS
|
||||
#define USE_SSE K_SSE_REGS
|
||||
|
||||
/**
|
||||
* @brief Enable floating point hardware resources sharing
|
||||
*
|
||||
|
|
|
@ -97,6 +97,9 @@ typedef int nano_context_type_t;
|
|||
#define TICKS_UNLIMITED (-1)
|
||||
#define TICKS_NONE 0
|
||||
|
||||
#define USE_FP K_FP_REGS
|
||||
#define USE_SSE K_SSE_REGS
|
||||
|
||||
/**
|
||||
* @brief Execution contexts APIs
|
||||
* @defgroup execution_contexts Execution Contexts
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue