Skip to content

Commit 51859b8

Browse files
benwrsnashif
authored andcommitted
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 <[email protected]>
1 parent 7aa5367 commit 51859b8

File tree

6 files changed

+59
-84
lines changed

6 files changed

+59
-84
lines changed

arch/arc/include/kernel_arch_data.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -128,24 +128,6 @@ typedef struct _callee_saved_stack _callee_saved_stack_t;
128128

129129
#endif /* _ASMLANGUAGE */
130130

131-
/* Bitmask definitions for the struct tcs->flags bit field */
132-
133-
#define K_STATIC 0x00000800
134-
135-
#define K_READY 0x00000000 /* Thread is ready to run */
136-
#define K_TIMING 0x00001000 /* Thread is waiting on a timeout */
137-
#define K_PENDING 0x00002000 /* Thread is waiting on an object */
138-
#define K_PRESTART 0x00004000 /* Thread has not yet started */
139-
#define K_DEAD 0x00008000 /* Thread has terminated */
140-
#define K_SUSPENDED 0x00010000 /* Thread is suspended */
141-
#define K_DUMMY 0x00020000 /* Not a real thread */
142-
#define K_EXECUTION_MASK (K_TIMING | K_PENDING | K_PRESTART | \
143-
K_DEAD | K_SUSPENDED | K_DUMMY)
144-
145-
#define K_FP_REGS 0x010 /* 1 = thread uses floating point registers */
146-
#define K_ESSENTIAL 0x200 /* 1 = system thread that must not abort */
147-
#define NO_METRICS 0x400 /* 1 = _Swap() not to update task metrics */
148-
149131
/* stacks */
150132

151133
#define STACK_ALIGN_SIZE 4

arch/arm/include/kernel_arch_data.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -86,24 +86,6 @@ typedef struct __esf _esf_t;
8686

8787
#endif /* _ASMLANGUAGE */
8888

89-
/* Bitmask definitions for the struct tcs.flags bit field */
90-
91-
#define K_STATIC 0x00000800
92-
93-
#define K_READY 0x00000000 /* Thread is ready to run */
94-
#define K_TIMING 0x00001000 /* Thread is waiting on a timeout */
95-
#define K_PENDING 0x00002000 /* Thread is waiting on an object */
96-
#define K_PRESTART 0x00004000 /* Thread has not yet started */
97-
#define K_DEAD 0x00008000 /* Thread has terminated */
98-
#define K_SUSPENDED 0x00010000 /* Thread is suspended */
99-
#define K_DUMMY 0x00020000 /* Not a real thread */
100-
#define K_EXECUTION_MASK \
101-
(K_TIMING | K_PENDING | K_PRESTART | K_DEAD | K_SUSPENDED | K_DUMMY)
102-
103-
#define K_FP_REGS 0x010 /* 1 = thread uses floating point registers */
104-
#define K_ESSENTIAL 0x200 /* 1 = system thread that must not abort */
105-
#define NO_METRICS 0x400 /* 1 = _Swap() not to update task metrics */
106-
10789
/* stacks */
10890

10991
#define STACK_ROUND_UP(x) ROUND_UP(x, STACK_ALIGN_SIZE)

arch/nios2/include/kernel_arch_data.h

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -47,24 +47,13 @@ extern "C" {
4747
#include <misc/dlist.h>
4848
#endif
4949

50-
/* Bitmask definitions for the struct tcs->flags bit field */
51-
#define K_STATIC 0x00000800
52-
53-
#define K_READY 0x00000000 /* Thread is ready to run */
54-
#define K_TIMING 0x00001000 /* Thread is waiting on a timeout */
55-
#define K_PENDING 0x00002000 /* Thread is waiting on an object */
56-
#define K_PRESTART 0x00004000 /* Thread has not yet started */
57-
#define K_DEAD 0x00008000 /* Thread has terminated */
58-
#define K_SUSPENDED 0x00010000 /* Thread is suspended */
59-
#define K_DUMMY 0x00020000 /* Not a real thread */
60-
#define K_EXECUTION_MASK (K_TIMING | K_PENDING | K_PRESTART | \
61-
K_DEAD | K_SUSPENDED | K_DUMMY)
62-
63-
#define INT_ACTIVE 0x002 /* 1 = executing context is interrupt handler */
64-
#define EXC_ACTIVE 0x004 /* 1 = executing context is exception handler */
65-
#define K_FP_REGS 0x010 /* 1 = thread uses floating point registers */
66-
#define K_ESSENTIAL 0x200 /* 1 = system thread that must not abort */
67-
#define NO_METRICS 0x400 /* 1 = _Swap() not to update task metrics */
50+
/* nios2 bitmask definitions for the struct k_thread->flags bit field */
51+
52+
/* 1 = executing context is interrupt handler */
53+
#define INT_ACTIVE (1 << 1)
54+
55+
/* 1 = executing context is exception handler */
56+
#define EXC_ACTIVE (1 << 2)
6857

6958
/* stacks */
7059

arch/x86/core/intstub.S

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,10 +312,6 @@ alreadyOnIntStack:
312312
* _Swap() to determine whether non-floating registers need to be
313313
* preserved using the lazy save/restore algorithm, or to indicate to
314314
* debug tools that a preemptive context switch has occurred.
315-
*
316-
* Setting the NO_METRICS bit tells _Swap() that the per-execution context
317-
* [totalRunTime] calculation has already been performed and that
318-
* there is no need to do it again.
319315
*/
320316

321317
#if defined(CONFIG_FP_SHARING) || defined(CONFIG_GDB_INFO)

arch/x86/include/kernel_arch_data.h

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -52,36 +52,21 @@
5252

5353
#define STACK_ALIGN_SIZE 4
5454

55-
/*
56-
* Bitmask definitions for the struct k_thread->flags bit field
57-
*/
55+
/* x86 Bitmask definitions for the struct k_thread->flags bit field */
5856

59-
#define K_STATIC 0x00000800
60-
61-
#define K_READY 0x00000000 /* Thread is ready to run */
62-
#define K_TIMING 0x00001000 /* Thread is waiting on a timeout */
63-
#define K_PENDING 0x00002000 /* Thread is waiting on an object */
64-
#define K_PRESTART 0x00004000 /* Thread has not yet started */
65-
#define K_DEAD 0x00008000 /* Thread has terminated */
66-
#define K_SUSPENDED 0x00010000 /* Thread is suspended */
67-
#define K_DUMMY 0x00020000 /* Not a real thread */
68-
#define K_EXECUTION_MASK (K_TIMING | K_PENDING | K_PRESTART | \
69-
K_DEAD | K_SUSPENDED | K_DUMMY)
70-
71-
#define INT_ACTIVE 0x2 /* 1 = executing context is interrupt handler */
72-
#define EXC_ACTIVE 0x4 /* 1 = executing context is exception handler */
73-
#if defined(CONFIG_FP_SHARING)
74-
#define K_FP_REGS 0x10 /* 1 = thread uses floating point registers */
75-
#endif
76-
#if defined(CONFIG_FP_SHARING) && defined(CONFIG_SSE)
77-
#define K_SSE_REGS 0x20 /* 1 = thread uses SSEx (and also FP) registers */
78-
#endif
79-
#define K_ESSENTIAL 0x200 /* 1 = system thread that must not abort */
80-
#define NO_METRICS 0x400 /* 1 = _Swap() not to update task metrics */
81-
#define NO_METRICS_BIT_OFFSET 0xa /* Bit position of NO_METRICS */
57+
/* executing context is interrupt handler */
58+
#define INT_ACTIVE (1 << 1)
59+
60+
/* executing context is exception handler */
61+
#define EXC_ACTIVE (1 << 2)
8262

8363
#define INT_OR_EXC_MASK (INT_ACTIVE | EXC_ACTIVE)
8464

65+
#if defined(CONFIG_FP_SHARING) && defined(CONFIG_SSE)
66+
/* thread uses SSEx (and also FP) registers */
67+
#define K_SSE_REGS (1 << 5)
68+
#endif
69+
8570
#if defined(CONFIG_FP_SHARING) && defined(CONFIG_SSE)
8671
#define _FP_USER_MASK (K_FP_REGS | K_SSE_REGS)
8772
#elif defined(CONFIG_FP_SHARING)

kernel/unified/include/kernel_structs.h

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,47 @@
2323
#include <misc/dlist.h>
2424
#endif
2525

26+
/*
27+
* Common bitmask definitions for the struct tcs->flags bit field.
28+
*
29+
* Must be before kerneL_arch_data.h because it might need them to be already
30+
* defined.
31+
*/
32+
33+
/* thread is defined statically */
34+
#define K_STATIC (1 << 8)
35+
36+
#define K_READY 0
37+
38+
/* Thread is waiting on a timeout */
39+
#define K_TIMING (1 << 12)
40+
41+
/* Thread is waiting on an object */
42+
#define K_PENDING (1 << 13)
43+
44+
/* Thread has not yet started */
45+
#define K_PRESTART (1 << 14)
46+
47+
/* Thread has terminated */
48+
#define K_DEAD (1 << 15)
49+
50+
/* Thread is suspended */
51+
#define K_SUSPENDED (1 << 16)
52+
53+
/* Not a real thread */
54+
#define K_DUMMY (1 << 17)
55+
56+
#define K_EXECUTION_MASK \
57+
(K_TIMING | K_PENDING | K_PRESTART | K_DEAD | K_SUSPENDED | K_DUMMY)
58+
59+
#if defined(CONFIG_FP_SHARING)
60+
/* thread uses floating point registers */
61+
#define K_FP_REGS (1 << 4)
62+
#endif
63+
64+
/* system thread that must not abort */
65+
#define K_ESSENTIAL (1 << 9)
66+
2667
#include <kernel_arch_data.h>
2768

2869
#if !defined(_ASMLANGUAGE)

0 commit comments

Comments
 (0)