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 <benjamin.walsh@windriver.com>
diff --git a/arch/arc/include/kernel_arch_data.h b/arch/arc/include/kernel_arch_data.h
index 673783d..9dc3e5e 100644
--- a/arch/arc/include/kernel_arch_data.h
+++ b/arch/arc/include/kernel_arch_data.h
@@ -128,24 +128,6 @@
#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 967092f..4863ecb 100644
--- a/arch/arm/include/kernel_arch_data.h
+++ b/arch/arm/include/kernel_arch_data.h
@@ -86,24 +86,6 @@
#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 0a46871..d55d8cf 100644
--- a/arch/nios2/include/kernel_arch_data.h
+++ b/arch/nios2/include/kernel_arch_data.h
@@ -47,24 +47,13 @@
#include <misc/dlist.h>
#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 7004e84..2542bd9 100644
--- a/arch/x86/core/intstub.S
+++ b/arch/x86/core/intstub.S
@@ -312,10 +312,6 @@
* _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 377ff3c..15a9b37 100644
--- a/arch/x86/include/kernel_arch_data.h
+++ b/arch/x86/include/kernel_arch_data.h
@@ -52,37 +52,22 @@
#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)
#define _FP_USER_MASK (K_FP_REGS)
diff --git a/kernel/unified/include/kernel_structs.h b/kernel/unified/include/kernel_structs.h
index 81d807b..e4483f7 100644
--- a/kernel/unified/include/kernel_structs.h
+++ b/kernel/unified/include/kernel_structs.h
@@ -23,6 +23,47 @@
#include <misc/dlist.h>
#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 <kernel_arch_data.h>
#if !defined(_ASMLANGUAGE)