Skip to content

Commit

Permalink
kernel/arch: streamline thread flag bits used
Browse files Browse the repository at this point in the history
Use least significant bits for common flags and high bits for
arch-specific ones.

Change-Id: I982719de4a24d3588c19a0d30bbe7a27d9a99f13
Signed-off-by: Benjamin Walsh <[email protected]>
  • Loading branch information
benwrs authored and Andrew Boie committed Jan 6, 2017
1 parent e6a69ca commit d779f3d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions arch/nios2/include/kernel_arch_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ extern "C" {
/* nios2 bitmask definitions for the struct k_thread->flags bit field */

/* 1 = executing context is interrupt handler */
#define INT_ACTIVE (1 << 1)
#define INT_ACTIVE (1 << 31)

/* 1 = executing context is exception handler */
#define EXC_ACTIVE (1 << 2)
#define EXC_ACTIVE (1 << 30)

/* stacks */

Expand Down
6 changes: 3 additions & 3 deletions arch/x86/include/kernel_arch_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,16 @@
/* x86 Bitmask definitions for the struct k_thread->flags bit field */

/* executing context is interrupt handler */
#define INT_ACTIVE (1 << 1)
#define INT_ACTIVE (1 << 31)

/* executing context is exception handler */
#define EXC_ACTIVE (1 << 2)
#define EXC_ACTIVE (1 << 30)

#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)
#define K_SSE_REGS (1 << 29)
#endif

#if defined(CONFIG_FP_SHARING) && defined(CONFIG_SSE)
Expand Down
22 changes: 11 additions & 11 deletions kernel/include/kernel_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,31 +31,31 @@
*/

/* thread is defined statically */
#define K_STATIC (1 << 8)
#define K_STATIC (1 << 0)

/* Thread is waiting on an object */
#define K_PENDING (1 << 13)
#define K_PENDING (1 << 1)

/* Thread has not yet started */
#define K_PRESTART (1 << 14)
#define K_PRESTART (1 << 2)

/* Thread has terminated */
#define K_DEAD (1 << 15)
#define K_DEAD (1 << 3)

/* Thread is suspended */
#define K_SUSPENDED (1 << 16)
#define K_SUSPENDED (1 << 4)

/* Not a real thread */
#define K_DUMMY (1 << 17)
#define K_DUMMY (1 << 5)

/* system thread that must not abort */
#define K_ESSENTIAL (1 << 6)

#if defined(CONFIG_FP_SHARING)
/* thread uses floating point registers */
#define K_FP_REGS (1 << 4)
#define K_FP_REGS (1 << 7)
#endif

/* system thread that must not abort */
#define K_ESSENTIAL (1 << 9)

#include <kernel_arch_data.h>

#if !defined(_ASMLANGUAGE)
Expand All @@ -76,7 +76,7 @@ struct _thread_base {
sys_dnode_t k_q_node;

/* execution flags */
int flags;
uint32_t flags;

/* thread priority used to sort linked list */
int prio;
Expand Down

0 comments on commit d779f3d

Please sign in to comment.