From b2974a666d63ab0811875fd37d01cb9efaf02d11 Mon Sep 17 00:00:00 2001 From: Benjamin Walsh Date: Thu, 24 Nov 2016 14:08:08 -0500 Subject: [PATCH] kernel/arch: move common thread.flags definitions to common file Also remove NO_METRIC, which is not referenced anywhere anymore. Change-Id: Ieaedf075af070a13aa3d975fee9b6b332203bfec Signed-off-by: Benjamin Walsh --- arch/arc/include/kernel_arch_data.h | 18 ----------- arch/arm/include/kernel_arch_data.h | 18 ----------- arch/nios2/include/kernel_arch_data.h | 21 +++---------- arch/x86/core/intstub.S | 4 --- arch/x86/include/kernel_arch_data.h | 35 ++++++--------------- kernel/unified/include/kernel_structs.h | 41 +++++++++++++++++++++++++ 6 files changed, 56 insertions(+), 81 deletions(-) diff --git a/arch/arc/include/kernel_arch_data.h b/arch/arc/include/kernel_arch_data.h index 673783db018..9dc3e5e4264 100644 --- a/arch/arc/include/kernel_arch_data.h +++ b/arch/arc/include/kernel_arch_data.h @@ -128,24 +128,6 @@ typedef struct _callee_saved_stack _callee_saved_stack_t; #endif /* _ASMLANGUAGE */ -/* Bitmask definitions for the struct tcs->flags bit field */ - -#define K_STATIC 0x00000800 - -#define K_READY 0x00000000 /* Thread is ready to run */ -#define K_TIMING 0x00001000 /* Thread is waiting on a timeout */ -#define K_PENDING 0x00002000 /* Thread is waiting on an object */ -#define K_PRESTART 0x00004000 /* Thread has not yet started */ -#define K_DEAD 0x00008000 /* Thread has terminated */ -#define K_SUSPENDED 0x00010000 /* Thread is suspended */ -#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 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 */ - /* stacks */ #define STACK_ALIGN_SIZE 4 diff --git a/arch/arm/include/kernel_arch_data.h b/arch/arm/include/kernel_arch_data.h index 967092ff1a4..4863ecb41a0 100644 --- a/arch/arm/include/kernel_arch_data.h +++ b/arch/arm/include/kernel_arch_data.h @@ -86,24 +86,6 @@ typedef struct __esf _esf_t; #endif /* _ASMLANGUAGE */ -/* Bitmask definitions for the struct tcs.flags bit field */ - -#define K_STATIC 0x00000800 - -#define K_READY 0x00000000 /* Thread is ready to run */ -#define K_TIMING 0x00001000 /* Thread is waiting on a timeout */ -#define K_PENDING 0x00002000 /* Thread is waiting on an object */ -#define K_PRESTART 0x00004000 /* Thread has not yet started */ -#define K_DEAD 0x00008000 /* Thread has terminated */ -#define K_SUSPENDED 0x00010000 /* Thread is suspended */ -#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 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 */ - /* stacks */ #define STACK_ROUND_UP(x) ROUND_UP(x, STACK_ALIGN_SIZE) diff --git a/arch/nios2/include/kernel_arch_data.h b/arch/nios2/include/kernel_arch_data.h index 0a468714f88..d55d8cf1cca 100644 --- a/arch/nios2/include/kernel_arch_data.h +++ b/arch/nios2/include/kernel_arch_data.h @@ -47,24 +47,13 @@ extern "C" { #include #endif -/* Bitmask definitions for the struct tcs->flags bit field */ -#define K_STATIC 0x00000800 +/* nios2 bitmask definitions for the struct k_thread->flags bit field */ -#define K_READY 0x00000000 /* Thread is ready to run */ -#define K_TIMING 0x00001000 /* Thread is waiting on a timeout */ -#define K_PENDING 0x00002000 /* Thread is waiting on an object */ -#define K_PRESTART 0x00004000 /* Thread has not yet started */ -#define K_DEAD 0x00008000 /* Thread has terminated */ -#define K_SUSPENDED 0x00010000 /* Thread is suspended */ -#define K_DUMMY 0x00020000 /* Not a real thread */ -#define K_EXECUTION_MASK (K_TIMING | K_PENDING | K_PRESTART | \ - K_DEAD | K_SUSPENDED | K_DUMMY) +/* 1 = executing context is interrupt handler */ +#define INT_ACTIVE (1 << 1) -#define INT_ACTIVE 0x002 /* 1 = executing context is interrupt handler */ -#define EXC_ACTIVE 0x004 /* 1 = executing context is exception handler */ -#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 */ +/* 1 = executing context is exception handler */ +#define EXC_ACTIVE (1 << 2) /* stacks */ diff --git a/arch/x86/core/intstub.S b/arch/x86/core/intstub.S index 7004e846e9f..2542bd93d3f 100644 --- a/arch/x86/core/intstub.S +++ b/arch/x86/core/intstub.S @@ -312,10 +312,6 @@ alreadyOnIntStack: * _Swap() to determine whether non-floating registers need to be * preserved using the lazy save/restore algorithm, or to indicate to * debug tools that a preemptive context switch has occurred. - * - * Setting the NO_METRICS bit tells _Swap() that the per-execution context - * [totalRunTime] calculation has already been performed and that - * there is no need to do it again. */ #if defined(CONFIG_FP_SHARING) || defined(CONFIG_GDB_INFO) diff --git a/arch/x86/include/kernel_arch_data.h b/arch/x86/include/kernel_arch_data.h index 377ff3c86be..15a9b37b44e 100644 --- a/arch/x86/include/kernel_arch_data.h +++ b/arch/x86/include/kernel_arch_data.h @@ -52,36 +52,21 @@ #define STACK_ALIGN_SIZE 4 -/* - * Bitmask definitions for the struct k_thread->flags bit field - */ +/* x86 Bitmask definitions for the struct k_thread->flags bit field */ -#define K_STATIC 0x00000800 +/* executing context is interrupt handler */ +#define INT_ACTIVE (1 << 1) -#define K_READY 0x00000000 /* Thread is ready to run */ -#define K_TIMING 0x00001000 /* Thread is waiting on a timeout */ -#define K_PENDING 0x00002000 /* Thread is waiting on an object */ -#define K_PRESTART 0x00004000 /* Thread has not yet started */ -#define K_DEAD 0x00008000 /* Thread has terminated */ -#define K_SUSPENDED 0x00010000 /* Thread is suspended */ -#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 INT_ACTIVE 0x2 /* 1 = executing context is interrupt handler */ -#define EXC_ACTIVE 0x4 /* 1 = executing context is exception handler */ -#if defined(CONFIG_FP_SHARING) -#define K_FP_REGS 0x10 /* 1 = thread uses floating point registers */ -#endif -#if defined(CONFIG_FP_SHARING) && defined(CONFIG_SSE) -#define K_SSE_REGS 0x20 /* 1 = thread uses SSEx (and also FP) registers */ -#endif -#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 */ +/* executing context is exception handler */ +#define EXC_ACTIVE (1 << 2) #define INT_OR_EXC_MASK (INT_ACTIVE | EXC_ACTIVE) +#if defined(CONFIG_FP_SHARING) && defined(CONFIG_SSE) +/* thread uses SSEx (and also FP) registers */ +#define K_SSE_REGS (1 << 5) +#endif + #if defined(CONFIG_FP_SHARING) && defined(CONFIG_SSE) #define _FP_USER_MASK (K_FP_REGS | K_SSE_REGS) #elif defined(CONFIG_FP_SHARING) diff --git a/kernel/unified/include/kernel_structs.h b/kernel/unified/include/kernel_structs.h index 81d807b6bd7..e4483f77dbf 100644 --- a/kernel/unified/include/kernel_structs.h +++ b/kernel/unified/include/kernel_structs.h @@ -23,6 +23,47 @@ #include #endif +/* + * Common bitmask definitions for the struct tcs->flags bit field. + * + * Must be before kerneL_arch_data.h because it might need them to be already + * defined. + */ + +/* thread is defined statically */ +#define K_STATIC (1 << 8) + +#define K_READY 0 + +/* Thread is waiting on a timeout */ +#define K_TIMING (1 << 12) + +/* Thread is waiting on an object */ +#define K_PENDING (1 << 13) + +/* Thread has not yet started */ +#define K_PRESTART (1 << 14) + +/* Thread has terminated */ +#define K_DEAD (1 << 15) + +/* Thread is suspended */ +#define K_SUSPENDED (1 << 16) + +/* Not a real thread */ +#define K_DUMMY (1 << 17) + +#define K_EXECUTION_MASK \ + (K_TIMING | K_PENDING | K_PRESTART | K_DEAD | K_SUSPENDED | K_DUMMY) + +#if defined(CONFIG_FP_SHARING) +/* thread uses floating point registers */ +#define K_FP_REGS (1 << 4) +#endif + +/* system thread that must not abort */ +#define K_ESSENTIAL (1 << 9) + #include #if !defined(_ASMLANGUAGE)