kernel: Remove redundant type name
struct k_thread already has a pointer type k_tid_t, there is no need for this definition to tcs. Less symbols/names make the code cleaner and more readable. Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
parent
847b7ccbcc
commit
61a1057ea5
8 changed files with 37 additions and 29 deletions
|
@ -76,13 +76,13 @@ extern "C" {
|
|||
|
||||
#endif
|
||||
|
||||
/* save stack pointer in struct tcs */
|
||||
/* save stack pointer in struct k_thread */
|
||||
st sp, [r2, _thread_offset_to_sp]
|
||||
.endm
|
||||
|
||||
/* entering this macro, current is in r2 */
|
||||
.macro _load_callee_saved_regs
|
||||
/* restore stack pointer from struct tcs */
|
||||
/* restore stack pointer from struct k_thread */
|
||||
ld sp, [r2, _thread_offset_to_sp]
|
||||
|
||||
#ifdef CONFIG_FP_SHARING
|
||||
|
|
|
@ -63,7 +63,10 @@ GEN_OFFSET_SYM(NANO_ESF, estatus);
|
|||
GEN_OFFSET_SYM(NANO_ESF, instr);
|
||||
GEN_ABSOLUTE_SYM(__NANO_ESF_SIZEOF, sizeof(NANO_ESF));
|
||||
|
||||
/* size of the struct tcs structure sans save area for floating point regs */
|
||||
/*
|
||||
* size of the struct k_thread structure sans save area for floating
|
||||
* point regs
|
||||
*/
|
||||
GEN_ABSOLUTE_SYM(_K_THREAD_NO_FLOAT_SIZEOF, sizeof(struct k_thread));
|
||||
|
||||
GEN_ABS_SYM_END
|
||||
|
|
|
@ -75,7 +75,10 @@ GEN_OFFSET_SYM(NANO_ESF, lpcount1);
|
|||
*/
|
||||
GEN_ABSOLUTE_SYM(__NANO_ESF_SIZEOF, STACK_ROUND_UP(sizeof(NANO_ESF)));
|
||||
|
||||
/* size of the struct tcs structure sans save area for floating point regs */
|
||||
/*
|
||||
* size of the struct k_thread structure sans save area for floating
|
||||
* point regs
|
||||
*/
|
||||
GEN_ABSOLUTE_SYM(_K_THREAD_NO_FLOAT_SIZEOF,
|
||||
STACK_ROUND_UP(sizeof(struct k_thread)));
|
||||
|
||||
|
|
|
@ -57,15 +57,15 @@ extern u32_t _sse_mxcsr_default_value;
|
|||
* specified thread control block. The SSE registers are saved only if the
|
||||
* thread is actually using them.
|
||||
*/
|
||||
static void _FpCtxSave(struct tcs *tcs)
|
||||
static void _FpCtxSave(struct k_thread *thread)
|
||||
{
|
||||
#ifdef CONFIG_SSE
|
||||
if (tcs->base.user_options & K_SSE_REGS) {
|
||||
_do_fp_and_sse_regs_save(&tcs->arch.preempFloatReg);
|
||||
if (thread->base.user_options & K_SSE_REGS) {
|
||||
_do_fp_and_sse_regs_save(&thread->arch.preempFloatReg);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
_do_fp_regs_save(&tcs->arch.preempFloatReg);
|
||||
_do_fp_regs_save(&thread->arch.preempFloatReg);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -74,11 +74,11 @@ static void _FpCtxSave(struct tcs *tcs)
|
|||
* This routine initializes the system's "live" floating point context.
|
||||
* The SSE registers are initialized only if the thread is actually using them.
|
||||
*/
|
||||
static inline void _FpCtxInit(struct tcs *tcs)
|
||||
static inline void _FpCtxInit(struct k_thread *thread)
|
||||
{
|
||||
_do_fp_regs_init();
|
||||
#ifdef CONFIG_SSE
|
||||
if (tcs->base.user_options & K_SSE_REGS) {
|
||||
if (thread->base.user_options & K_SSE_REGS) {
|
||||
_do_sse_regs_init();
|
||||
}
|
||||
#endif
|
||||
|
@ -93,10 +93,10 @@ static inline void _FpCtxInit(struct tcs *tcs)
|
|||
* The locking isn't really needed when the routine is called by a cooperative
|
||||
* thread (since context switching can't occur), but it is harmless.
|
||||
*/
|
||||
void k_float_enable(struct tcs *tcs, unsigned int options)
|
||||
void k_float_enable(struct k_thread *thread, unsigned int options)
|
||||
{
|
||||
unsigned int imask;
|
||||
struct tcs *fp_owner;
|
||||
struct k_thread *fp_owner;
|
||||
|
||||
/* Ensure a preemptive context switch does not occur */
|
||||
|
||||
|
@ -104,7 +104,7 @@ void k_float_enable(struct tcs *tcs, unsigned int options)
|
|||
|
||||
/* Indicate thread requires floating point context saving */
|
||||
|
||||
tcs->base.user_options |= (u8_t)options;
|
||||
thread->base.user_options |= (u8_t)options;
|
||||
|
||||
/*
|
||||
* The current thread might not allow FP instructions, so clear CR0[TS]
|
||||
|
@ -129,11 +129,11 @@ void k_float_enable(struct tcs *tcs, unsigned int options)
|
|||
|
||||
/* Now create a virgin FP context */
|
||||
|
||||
_FpCtxInit(tcs);
|
||||
_FpCtxInit(thread);
|
||||
|
||||
/* Associate the new FP context with the specified thread */
|
||||
|
||||
if (tcs == _current) {
|
||||
if (thread == _current) {
|
||||
/*
|
||||
* When enabling FP support for the current thread, just claim
|
||||
* ownership of the FPU and leave CR0[TS] unset.
|
||||
|
@ -141,7 +141,7 @@ void k_float_enable(struct tcs *tcs, unsigned int options)
|
|||
* (The FP context is "live" in hardware, not saved in TCS.)
|
||||
*/
|
||||
|
||||
_kernel.current_fp = tcs;
|
||||
_kernel.current_fp = thread;
|
||||
} else {
|
||||
/*
|
||||
* When enabling FP support for someone else, assign ownership
|
||||
|
@ -156,7 +156,7 @@ void k_float_enable(struct tcs *tcs, unsigned int options)
|
|||
* to its original state.
|
||||
*/
|
||||
|
||||
_kernel.current_fp = tcs;
|
||||
_kernel.current_fp = thread;
|
||||
_FpAccessDisable();
|
||||
} else {
|
||||
/*
|
||||
|
@ -176,7 +176,7 @@ void k_float_enable(struct tcs *tcs, unsigned int options)
|
|||
* handling an interrupt or exception.)
|
||||
*/
|
||||
|
||||
_FpCtxSave(tcs);
|
||||
_FpCtxSave(thread);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -192,7 +192,7 @@ void k_float_enable(struct tcs *tcs, unsigned int options)
|
|||
* The locking isn't really needed when the routine is called by a cooperative
|
||||
* thread (since context switching can't occur), but it is harmless.
|
||||
*/
|
||||
void k_float_disable(struct tcs *tcs)
|
||||
void k_float_disable(struct k_thread *thread)
|
||||
{
|
||||
unsigned int imask;
|
||||
|
||||
|
@ -202,14 +202,14 @@ void k_float_disable(struct tcs *tcs)
|
|||
|
||||
/* Disable all floating point capabilities for the thread */
|
||||
|
||||
tcs->base.user_options &= ~_FP_USER_MASK;
|
||||
thread->base.user_options &= ~_FP_USER_MASK;
|
||||
|
||||
if (tcs == _current) {
|
||||
if (thread == _current) {
|
||||
_FpAccessDisable();
|
||||
_kernel.current_fp = (struct tcs *)0;
|
||||
_kernel.current_fp = (struct k_thread *)0;
|
||||
} else {
|
||||
if (_kernel.current_fp == tcs)
|
||||
_kernel.current_fp = (struct tcs *)0;
|
||||
if (_kernel.current_fp == thread)
|
||||
_kernel.current_fp = (struct k_thread *)0;
|
||||
}
|
||||
|
||||
irq_unlock(imask);
|
||||
|
|
|
@ -39,7 +39,10 @@ GEN_OFFSET_SYM(_thread_arch_t, excNestCount);
|
|||
GEN_OFFSET_SYM(_thread_arch_t, coopFloatReg);
|
||||
GEN_OFFSET_SYM(_thread_arch_t, preempFloatReg);
|
||||
|
||||
/* size of the struct tcs structure sans save area for floating point regs */
|
||||
/**
|
||||
* size of the struct k_thread structure sans save area for floating
|
||||
* point regs
|
||||
*/
|
||||
|
||||
GEN_ABSOLUTE_SYM(_K_THREAD_NO_FLOAT_SIZEOF,
|
||||
sizeof(struct k_thread) - sizeof(tCoopFloatReg) -
|
||||
|
|
|
@ -72,7 +72,7 @@ static inline void _FpAccessDisable(void)
|
|||
* This routine saves the system's "live" non-integer context into the
|
||||
* specified area. If the specified thread supports SSE then
|
||||
* x87/MMX/SSEx thread info is saved, otherwise only x87/MMX thread is saved.
|
||||
* Function is invoked by _FpCtxSave(struct tcs *tcs)
|
||||
* Function is invoked by _FpCtxSave(struct k_thread *thread)
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
|
@ -92,7 +92,7 @@ static inline void _do_fp_regs_save(void *preemp_float_reg)
|
|||
* This routine saves the system's "live" non-integer context into the
|
||||
* specified area. If the specified thread supports SSE then
|
||||
* x87/MMX/SSEx thread info is saved, otherwise only x87/MMX thread is saved.
|
||||
* Function is invoked by _FpCtxSave(struct tcs *tcs)
|
||||
* Function is invoked by _FpCtxSave(struct k_thread *thread)
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
|
|
|
@ -252,7 +252,7 @@ struct _thread_arch {
|
|||
|
||||
/*
|
||||
* The location of all floating point related structures/fields MUST be
|
||||
* located at the end of struct tcs. This way only the
|
||||
* located at the end of struct k_thread. This way only the
|
||||
* threads that actually utilize non-integer capabilities need to
|
||||
* account for the increased memory required for storing FP state when
|
||||
* sizing stacks.
|
||||
|
|
|
@ -576,7 +576,6 @@ struct k_thread {
|
|||
|
||||
typedef struct k_thread _thread_t;
|
||||
typedef struct k_thread *k_tid_t;
|
||||
#define tcs k_thread
|
||||
|
||||
enum execution_context_types {
|
||||
K_ISR = 0,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue