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>
This commit is contained in:
Benjamin Walsh 2016-11-24 14:08:08 -05:00 committed by Anas Nashif
commit b2974a666d
6 changed files with 56 additions and 81 deletions

View file

@ -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

View file

@ -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)

View file

@ -47,24 +47,13 @@ extern "C" {
#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 */

View file

@ -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)

View file

@ -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)

View file

@ -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)