kernel: centralize new thread priority check

This was being done inconsistently in arch_new_thread(), just
move to the core kernel.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
Andrew Boie 2020-04-19 14:31:27 -07:00 committed by Anas Nashif
commit 1f6f977f05
8 changed files with 2 additions and 10 deletions

View file

@ -64,7 +64,6 @@ void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
int priority, unsigned int options) int priority, unsigned int options)
{ {
char *pStackMem = Z_THREAD_STACK_BUFFER(stack); char *pStackMem = Z_THREAD_STACK_BUFFER(stack);
Z_ASSERT_VALID_PRIO(priority, pEntry);
char *stackEnd; char *stackEnd;
char *stackAdjEnd; char *stackAdjEnd;

View file

@ -38,8 +38,6 @@ void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
/* Offset between the top of stack and the high end of stack area. */ /* Offset between the top of stack and the high end of stack area. */
u32_t top_of_stack_offset = 0U; u32_t top_of_stack_offset = 0U;
Z_ASSERT_VALID_PRIO(priority, pEntry);
#if defined(CONFIG_USERSPACE) #if defined(CONFIG_USERSPACE)
/* Truncate the stack size to align with the MPU region granularity. /* Truncate the stack size to align with the MPU region granularity.
* This is done proactively to account for the case when the thread * This is done proactively to account for the case when the thread

View file

@ -34,8 +34,6 @@ void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
int priority, unsigned int options) int priority, unsigned int options)
{ {
char *stack_memory = Z_THREAD_STACK_BUFFER(stack); char *stack_memory = Z_THREAD_STACK_BUFFER(stack);
Z_ASSERT_VALID_PRIO(priority, thread_func);
struct init_stack_frame *iframe; struct init_stack_frame *iframe;
z_new_thread_init(thread, stack_memory, stack_size); z_new_thread_init(thread, stack_memory, stack_size);

View file

@ -32,8 +32,6 @@ void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
char *stack_memory = Z_THREAD_STACK_BUFFER(stack); char *stack_memory = Z_THREAD_STACK_BUFFER(stack);
Z_ASSERT_VALID_PRIO(priority, thread_func);
posix_thread_status_t *thread_status; posix_thread_status_t *thread_status;
z_new_thread_init(thread, stack_memory, stack_size); z_new_thread_init(thread, stack_memory, stack_size);

View file

@ -18,7 +18,6 @@ void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
int priority, unsigned int options) int priority, unsigned int options)
{ {
char *stack_memory = Z_THREAD_STACK_BUFFER(stack); char *stack_memory = Z_THREAD_STACK_BUFFER(stack);
Z_ASSERT_VALID_PRIO(priority, thread_func);
struct __esf *stack_init; struct __esf *stack_init;

View file

@ -69,7 +69,6 @@ void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
void *swap_entry; void *swap_entry;
struct _x86_initial_frame *initial_frame; struct _x86_initial_frame *initial_frame;
Z_ASSERT_VALID_PRIO(priority, entry);
stack_buf = Z_THREAD_STACK_BUFFER(stack); stack_buf = Z_THREAD_STACK_BUFFER(stack);
z_new_thread_init(thread, stack_buf, stack_size); z_new_thread_init(thread, stack_buf, stack_size);

View file

@ -18,7 +18,6 @@ void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
{ {
void *switch_entry; void *switch_entry;
Z_ASSERT_VALID_PRIO(priority, entry);
z_new_thread_init(thread, Z_THREAD_STACK_BUFFER(stack), stack_size); z_new_thread_init(thread, Z_THREAD_STACK_BUFFER(stack), stack_size);
#if CONFIG_X86_STACK_PROTECTION #if CONFIG_X86_STACK_PROTECTION

View file

@ -473,6 +473,8 @@ void z_setup_new_thread(struct k_thread *new_thread,
void *p1, void *p2, void *p3, void *p1, void *p2, void *p3,
int prio, u32_t options, const char *name) int prio, u32_t options, const char *name)
{ {
Z_ASSERT_VALID_PRIO(prio, entry);
#ifdef CONFIG_USERSPACE #ifdef CONFIG_USERSPACE
z_object_init(new_thread); z_object_init(new_thread);
z_object_init(stack); z_object_init(stack);