summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorBenjamin Walsh <walsh.benj@gmail.com>2017-01-22 13:05:08 -0500
committerAnas Nashif <nashif@linux.intel.com>2017-01-24 13:34:50 +0000
commited240f27968beffdf7e9d68f2a17db6272c29357 (patch)
treeb1ea2c3c16d6a0d1e6b09b7ba2cfde907a944fec /kernel
parent4b655024486bf0b39328e04c9fc1a5d1ff986207 (diff)
kernel/arch: streamline thread user options
The K_<thread option> flags/options avaialble to users were hidden in the kernel private header files: move them to include/kernel.h to publicize them. Also, to avoid any future confusion, rename the k_thread.execution_flags field to user_options. Change-Id: I65a6fd5e9e78d4ccf783f3304b607a1e6956aeac Signed-off-by: Benjamin Walsh <walsh.benj@gmail.com>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/include/kernel_offsets.h2
-rw-r--r--kernel/include/kernel_structs.h17
-rw-r--r--kernel/include/offsets_short.h4
-rw-r--r--kernel/init.c4
-rw-r--r--kernel/thread.c8
5 files changed, 12 insertions, 23 deletions
diff --git a/kernel/include/kernel_offsets.h b/kernel/include/kernel_offsets.h
index 18651d054..7513aa64d 100644
--- a/kernel/include/kernel_offsets.h
+++ b/kernel/include/kernel_offsets.h
@@ -38,7 +38,7 @@ GEN_OFFSET_SYM(_kernel_t, current_fp);
GEN_ABSOLUTE_SYM(_STRUCT_KERNEL_SIZE, sizeof(struct _kernel));
-GEN_OFFSET_SYM(_thread_base_t, execution_flags);
+GEN_OFFSET_SYM(_thread_base_t, user_options);
GEN_OFFSET_SYM(_thread_base_t, thread_state);
GEN_OFFSET_SYM(_thread_base_t, prio);
GEN_OFFSET_SYM(_thread_base_t, sched_locked);
diff --git a/kernel/include/kernel_structs.h b/kernel/include/kernel_structs.h
index e391af09e..174bac845 100644
--- a/kernel/include/kernel_structs.h
+++ b/kernel/include/kernel_structs.h
@@ -15,7 +15,7 @@
#endif
/*
- * bitmask definitions for the execution_flags and state
+ * Bitmask definitions for the struct k_thread.thread_state field.
*
* Must be before kerneL_arch_data.h because it might need them to be already
* defined.
@@ -42,17 +42,6 @@
/* end - states */
-/* execution flags: common uses low bits, arch-specific use high bits */
-
-/* system thread that must not abort */
-#define K_ESSENTIAL (1 << 0)
-
-#if defined(CONFIG_FP_SHARING)
-/* thread uses floating point registers */
-#define K_FP_REGS (1 << 1)
-#endif
-/* end - execution flags */
-
/* lowest value of _thread_base.preempt at which a thread is non-preemptible */
#define _NON_PREEMPT_THRESHOLD 0x0080
@@ -78,8 +67,8 @@ struct _thread_base {
/* this thread's entry in a ready/wait queue */
sys_dnode_t k_q_node;
- /* execution flags */
- uint8_t execution_flags;
+ /* user facing 'thread options'; values defined in include/kernel.h */
+ uint8_t user_options;
/* thread state */
uint8_t thread_state;
diff --git a/kernel/include/offsets_short.h b/kernel/include/offsets_short.h
index 38716fff6..ac73d1547 100644
--- a/kernel/include/offsets_short.h
+++ b/kernel/include/offsets_short.h
@@ -46,8 +46,8 @@
#define _thread_offset_to_thread_state \
(___thread_t_base_OFFSET + ___thread_base_t_thread_state_OFFSET)
-#define _thread_offset_to_execution_flags \
- (___thread_t_base_OFFSET + ___thread_base_t_execution_flags_OFFSET)
+#define _thread_offset_to_user_options \
+ (___thread_t_base_OFFSET + ___thread_base_t_user_options_OFFSET)
#define _thread_offset_to_prio \
(___thread_t_base_OFFSET + ___thread_base_t_prio_OFFSET)
diff --git a/kernel/init.c b/kernel/init.c
index 58f2c8992..49763c456 100644
--- a/kernel/init.c
+++ b/kernel/init.c
@@ -216,7 +216,7 @@ static void _main(void *unused1, void *unused2, void *unused3)
main();
/* Terminate thread normally since it has no more work to do */
- _main_thread->base.execution_flags &= ~K_ESSENTIAL;
+ _main_thread->base.user_options &= ~K_ESSENTIAL;
}
void __weak main(void)
@@ -251,7 +251,7 @@ static void prepare_multithreading(struct k_thread *dummy_thread)
_current = dummy_thread;
- dummy_thread->base.execution_flags = K_ESSENTIAL;
+ dummy_thread->base.user_options = K_ESSENTIAL;
#endif
/* _kernel.ready_q is all zeroes */
diff --git a/kernel/thread.c b/kernel/thread.c
index a40b44902..d70820291 100644
--- a/kernel/thread.c
+++ b/kernel/thread.c
@@ -77,7 +77,7 @@ int k_is_in_isr(void)
*/
void _thread_essential_set(void)
{
- _current->base.execution_flags |= K_ESSENTIAL;
+ _current->base.user_options |= K_ESSENTIAL;
}
/*
@@ -87,7 +87,7 @@ void _thread_essential_set(void)
*/
void _thread_essential_clear(void)
{
- _current->base.execution_flags &= ~K_ESSENTIAL;
+ _current->base.user_options &= ~K_ESSENTIAL;
}
/*
@@ -97,7 +97,7 @@ void _thread_essential_clear(void)
*/
int _is_thread_essential(void)
{
- return _current->base.execution_flags & K_ESSENTIAL;
+ return _current->base.user_options & K_ESSENTIAL;
}
void k_busy_wait(uint32_t usec_to_wait)
@@ -430,7 +430,7 @@ void _init_thread_base(struct _thread_base *thread_base, int priority,
{
/* k_q_node is initialized upon first insertion in a list */
- thread_base->execution_flags = (uint8_t)options;
+ thread_base->user_options = (uint8_t)options;
thread_base->thread_state = (uint8_t)initial_state;
thread_base->prio = priority;