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:
Flavio Ceolin 2018-09-27 11:06:12 -07:00 committed by Anas Nashif
commit 61a1057ea5
8 changed files with 37 additions and 29 deletions

View file

@ -76,13 +76,13 @@ extern "C" {
#endif #endif
/* save stack pointer in struct tcs */ /* save stack pointer in struct k_thread */
st sp, [r2, _thread_offset_to_sp] st sp, [r2, _thread_offset_to_sp]
.endm .endm
/* entering this macro, current is in r2 */ /* entering this macro, current is in r2 */
.macro _load_callee_saved_regs .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] ld sp, [r2, _thread_offset_to_sp]
#ifdef CONFIG_FP_SHARING #ifdef CONFIG_FP_SHARING

View file

@ -63,7 +63,10 @@ GEN_OFFSET_SYM(NANO_ESF, estatus);
GEN_OFFSET_SYM(NANO_ESF, instr); GEN_OFFSET_SYM(NANO_ESF, instr);
GEN_ABSOLUTE_SYM(__NANO_ESF_SIZEOF, sizeof(NANO_ESF)); 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_ABSOLUTE_SYM(_K_THREAD_NO_FLOAT_SIZEOF, sizeof(struct k_thread));
GEN_ABS_SYM_END GEN_ABS_SYM_END

View file

@ -75,7 +75,10 @@ GEN_OFFSET_SYM(NANO_ESF, lpcount1);
*/ */
GEN_ABSOLUTE_SYM(__NANO_ESF_SIZEOF, STACK_ROUND_UP(sizeof(NANO_ESF))); 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, GEN_ABSOLUTE_SYM(_K_THREAD_NO_FLOAT_SIZEOF,
STACK_ROUND_UP(sizeof(struct k_thread))); STACK_ROUND_UP(sizeof(struct k_thread)));

View file

@ -57,15 +57,15 @@ extern u32_t _sse_mxcsr_default_value;
* specified thread control block. The SSE registers are saved only if the * specified thread control block. The SSE registers are saved only if the
* thread is actually using them. * thread is actually using them.
*/ */
static void _FpCtxSave(struct tcs *tcs) static void _FpCtxSave(struct k_thread *thread)
{ {
#ifdef CONFIG_SSE #ifdef CONFIG_SSE
if (tcs->base.user_options & K_SSE_REGS) { if (thread->base.user_options & K_SSE_REGS) {
_do_fp_and_sse_regs_save(&tcs->arch.preempFloatReg); _do_fp_and_sse_regs_save(&thread->arch.preempFloatReg);
return; return;
} }
#endif #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. * This routine initializes the system's "live" floating point context.
* The SSE registers are initialized only if the thread is actually using them. * 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(); _do_fp_regs_init();
#ifdef CONFIG_SSE #ifdef CONFIG_SSE
if (tcs->base.user_options & K_SSE_REGS) { if (thread->base.user_options & K_SSE_REGS) {
_do_sse_regs_init(); _do_sse_regs_init();
} }
#endif #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 * 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. * 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; unsigned int imask;
struct tcs *fp_owner; struct k_thread *fp_owner;
/* Ensure a preemptive context switch does not occur */ /* 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 */ /* 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] * 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 */ /* Now create a virgin FP context */
_FpCtxInit(tcs); _FpCtxInit(thread);
/* Associate the new FP context with the specified 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 * When enabling FP support for the current thread, just claim
* ownership of the FPU and leave CR0[TS] unset. * 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.) * (The FP context is "live" in hardware, not saved in TCS.)
*/ */
_kernel.current_fp = tcs; _kernel.current_fp = thread;
} else { } else {
/* /*
* When enabling FP support for someone else, assign ownership * 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. * to its original state.
*/ */
_kernel.current_fp = tcs; _kernel.current_fp = thread;
_FpAccessDisable(); _FpAccessDisable();
} else { } else {
/* /*
@ -176,7 +176,7 @@ void k_float_enable(struct tcs *tcs, unsigned int options)
* handling an interrupt or exception.) * 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 * 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. * 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; unsigned int imask;
@ -202,14 +202,14 @@ void k_float_disable(struct tcs *tcs)
/* Disable all floating point capabilities for the thread */ /* 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(); _FpAccessDisable();
_kernel.current_fp = (struct tcs *)0; _kernel.current_fp = (struct k_thread *)0;
} else { } else {
if (_kernel.current_fp == tcs) if (_kernel.current_fp == thread)
_kernel.current_fp = (struct tcs *)0; _kernel.current_fp = (struct k_thread *)0;
} }
irq_unlock(imask); irq_unlock(imask);

View file

@ -39,7 +39,10 @@ GEN_OFFSET_SYM(_thread_arch_t, excNestCount);
GEN_OFFSET_SYM(_thread_arch_t, coopFloatReg); GEN_OFFSET_SYM(_thread_arch_t, coopFloatReg);
GEN_OFFSET_SYM(_thread_arch_t, preempFloatReg); 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, GEN_ABSOLUTE_SYM(_K_THREAD_NO_FLOAT_SIZEOF,
sizeof(struct k_thread) - sizeof(tCoopFloatReg) - sizeof(struct k_thread) - sizeof(tCoopFloatReg) -

View file

@ -72,7 +72,7 @@ static inline void _FpAccessDisable(void)
* This routine saves the system's "live" non-integer context into the * This routine saves the system's "live" non-integer context into the
* specified area. If the specified thread supports SSE then * specified area. If the specified thread supports SSE then
* x87/MMX/SSEx thread info is saved, otherwise only x87/MMX thread is saved. * 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 * @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 * This routine saves the system's "live" non-integer context into the
* specified area. If the specified thread supports SSE then * specified area. If the specified thread supports SSE then
* x87/MMX/SSEx thread info is saved, otherwise only x87/MMX thread is saved. * 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 * @return N/A
*/ */

View file

@ -252,7 +252,7 @@ struct _thread_arch {
/* /*
* The location of all floating point related structures/fields MUST be * 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 * threads that actually utilize non-integer capabilities need to
* account for the increased memory required for storing FP state when * account for the increased memory required for storing FP state when
* sizing stacks. * sizing stacks.

View file

@ -576,7 +576,6 @@ struct k_thread {
typedef struct k_thread _thread_t; typedef struct k_thread _thread_t;
typedef struct k_thread *k_tid_t; typedef struct k_thread *k_tid_t;
#define tcs k_thread
enum execution_context_types { enum execution_context_types {
K_ISR = 0, K_ISR = 0,