arch_interface: remove unnecessary params
arch_new_thread() passes along the thread priority and option flags, but these are already initialized in thread->base and can be accessed there if needed. Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
parent
79728eccca
commit
62eb7d99dc
11 changed files with 20 additions and 36 deletions
|
@ -45,23 +45,18 @@ struct init_stack_frame {
|
|||
* z_thread_entry() return address, that points at z_thread_entry()
|
||||
* and status register.
|
||||
*
|
||||
* <options> is currently unused.
|
||||
*
|
||||
* @param pStackmem the pointer to aligned stack memory
|
||||
* @param stackSize the stack size in bytes
|
||||
* @param pEntry thread entry point routine
|
||||
* @param parameter1 first param to entry point
|
||||
* @param parameter2 second param to entry point
|
||||
* @param parameter3 third param to entry point
|
||||
* @param priority thread priority
|
||||
* @param options thread options: K_ESSENTIAL
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
||||
size_t stackSize, k_thread_entry_t pEntry,
|
||||
void *parameter1, void *parameter2, void *parameter3,
|
||||
int priority, unsigned int options)
|
||||
void *parameter1, void *parameter2, void *parameter3)
|
||||
{
|
||||
char *pStackMem = Z_THREAD_STACK_BUFFER(stack);
|
||||
|
||||
|
@ -73,6 +68,7 @@ void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
|||
|
||||
size_t stackAdjSize;
|
||||
size_t offset = 0;
|
||||
bool is_user = (thread->base.user_options & K_USER) != 0;
|
||||
|
||||
|
||||
stackAdjSize = Z_ARC_MPU_SIZE_ALIGN(stackSize);
|
||||
|
@ -83,7 +79,7 @@ void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
|||
offset = stackAdjSize - stackSize;
|
||||
#endif
|
||||
|
||||
if (options & K_USER) {
|
||||
if (is_user) {
|
||||
#ifdef CONFIG_GEN_PRIV_STACKS
|
||||
thread->arch.priv_stack_start =
|
||||
(uint32_t)z_priv_stack_find(thread->stack_obj);
|
||||
|
@ -138,7 +134,7 @@ void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
|||
|
||||
/* fill init context */
|
||||
pInitCtx->status32 = 0U;
|
||||
if (options & K_USER) {
|
||||
if (is_user) {
|
||||
pInitCtx->pc = ((uint32_t)z_user_thread_entry_wrapper);
|
||||
} else {
|
||||
pInitCtx->pc = ((uint32_t)z_thread_entry_wrapper);
|
||||
|
@ -185,7 +181,7 @@ void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
|||
pInitCtx->status32 |= _ARC_V2_STATUS32_SC;
|
||||
#endif
|
||||
#ifdef CONFIG_USERSPACE
|
||||
if (options & K_USER) {
|
||||
if (is_user) {
|
||||
thread->arch.u_stack_top = (uint32_t)pStackMem;
|
||||
thread->arch.u_stack_base = (uint32_t)stackEnd;
|
||||
thread->arch.k_stack_top =
|
||||
|
|
|
@ -30,8 +30,7 @@
|
|||
*/
|
||||
void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
||||
size_t stackSize, k_thread_entry_t pEntry,
|
||||
void *parameter1, void *parameter2, void *parameter3,
|
||||
int priority, unsigned int options)
|
||||
void *parameter1, void *parameter2, void *parameter3)
|
||||
{
|
||||
char *pStackMem = Z_THREAD_STACK_BUFFER(stack);
|
||||
char *stackEnd;
|
||||
|
@ -81,7 +80,7 @@ void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
|||
* .start and .size.
|
||||
*
|
||||
*/
|
||||
if ((options & K_FP_REGS) != 0) {
|
||||
if ((thread->base.user_options & K_FP_REGS) != 0) {
|
||||
pStackMem += MPU_GUARD_ALIGN_AND_SIZE_FLOAT
|
||||
- MPU_GUARD_ALIGN_AND_SIZE;
|
||||
stackSize -= MPU_GUARD_ALIGN_AND_SIZE_FLOAT
|
||||
|
@ -104,7 +103,7 @@ void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
|||
(char *)top_of_stack_offset - sizeof(struct __basic_sf)));
|
||||
|
||||
#if defined(CONFIG_USERSPACE)
|
||||
if ((options & K_USER) != 0) {
|
||||
if ((thread->base.user_options & K_USER) != 0) {
|
||||
pInitCtx->basic.pc = (uint32_t)arch_user_mode_enter;
|
||||
} else {
|
||||
pInitCtx->basic.pc = (uint32_t)z_thread_entry;
|
||||
|
|
|
@ -33,8 +33,6 @@
|
|||
* @param parameter1 entry point to the first param
|
||||
* @param parameter2 entry point to the second param
|
||||
* @param parameter3 entry point to the third param
|
||||
* @param priority thread priority
|
||||
* @param options thread options: K_ESSENTIAL, K_FP_REGS
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
|
@ -62,8 +60,7 @@ struct init_stack_frame {
|
|||
|
||||
void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
||||
size_t stackSize, k_thread_entry_t pEntry,
|
||||
void *parameter1, void *parameter2, void *parameter3,
|
||||
int priority, unsigned int options)
|
||||
void *parameter1, void *parameter2, void *parameter3)
|
||||
{
|
||||
char *pStackMem = Z_THREAD_STACK_BUFFER(stack);
|
||||
char *stackEnd;
|
||||
|
|
|
@ -30,8 +30,7 @@ struct init_stack_frame {
|
|||
|
||||
void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
||||
size_t stack_size, k_thread_entry_t thread_func,
|
||||
void *arg1, void *arg2, void *arg3,
|
||||
int priority, unsigned int options)
|
||||
void *arg1, void *arg2, void *arg3)
|
||||
{
|
||||
char *stack_memory = Z_THREAD_STACK_BUFFER(stack);
|
||||
struct init_stack_frame *iframe;
|
||||
|
|
|
@ -26,8 +26,7 @@
|
|||
*/
|
||||
void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
||||
size_t stack_size, k_thread_entry_t thread_func,
|
||||
void *arg1, void *arg2, void *arg3,
|
||||
int priority, unsigned int options)
|
||||
void *arg1, void *arg2, void *arg3)
|
||||
{
|
||||
|
||||
char *stack_memory = Z_THREAD_STACK_BUFFER(stack);
|
||||
|
|
|
@ -14,8 +14,7 @@ void z_thread_entry_wrapper(k_thread_entry_t thread,
|
|||
|
||||
void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
||||
size_t stack_size, k_thread_entry_t thread_func,
|
||||
void *arg1, void *arg2, void *arg3,
|
||||
int priority, unsigned int options)
|
||||
void *arg1, void *arg2, void *arg3)
|
||||
{
|
||||
char *stack_memory = Z_THREAD_STACK_BUFFER(stack);
|
||||
|
||||
|
|
|
@ -62,8 +62,7 @@ int arch_float_disable(struct k_thread *thread)
|
|||
|
||||
void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
||||
size_t stack_size, k_thread_entry_t entry,
|
||||
void *parameter1, void *parameter2, void *parameter3,
|
||||
int priority, unsigned int options)
|
||||
void *parameter1, void *parameter2, void *parameter3)
|
||||
{
|
||||
char *stack_buf;
|
||||
char *stack_high;
|
||||
|
|
|
@ -13,8 +13,7 @@ extern void x86_sse_init(struct k_thread *); /* in locore.S */
|
|||
|
||||
void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
||||
size_t stack_size, k_thread_entry_t entry,
|
||||
void *parameter1, void *parameter2, void *parameter3,
|
||||
int priority, unsigned int options)
|
||||
void *parameter1, void *parameter2, void *parameter3)
|
||||
{
|
||||
void *switch_entry;
|
||||
|
||||
|
|
|
@ -58,8 +58,7 @@ void *xtensa_init_stack(int *stack_top,
|
|||
|
||||
void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
||||
size_t sz, k_thread_entry_t entry,
|
||||
void *p1, void *p2, void *p3,
|
||||
int prio, unsigned int opts)
|
||||
void *p1, void *p2, void *p3)
|
||||
{
|
||||
char *base = Z_THREAD_STACK_BUFFER(stack);
|
||||
char *top = base + sz;
|
||||
|
|
|
@ -58,6 +58,8 @@ void arch_busy_wait(uint32_t usec_to_wait);
|
|||
* be called with the true bounds of the available stack buffer within the
|
||||
* thread's stack object.
|
||||
*
|
||||
* Fields in thread->base will be initialized when this is called.
|
||||
*
|
||||
* @param thread Pointer to uninitialized struct k_thread
|
||||
* @param pStack Pointer to the stack space.
|
||||
* @param stackSize Stack size in bytes.
|
||||
|
@ -65,13 +67,10 @@ void arch_busy_wait(uint32_t usec_to_wait);
|
|||
* @param p1 1st entry point parameter.
|
||||
* @param p2 2nd entry point parameter.
|
||||
* @param p3 3rd entry point parameter.
|
||||
* @param prio Thread priority.
|
||||
* @param options Thread options.
|
||||
*/
|
||||
void arch_new_thread(struct k_thread *thread, k_thread_stack_t *pStack,
|
||||
size_t stackSize, k_thread_entry_t entry,
|
||||
void *p1, void *p2, void *p3,
|
||||
int prio, unsigned int options);
|
||||
size_t stackSize, k_thread_entry_t entry,
|
||||
void *p1, void *p2, void *p3);
|
||||
|
||||
#ifdef CONFIG_USE_SWITCH
|
||||
/**
|
||||
|
|
|
@ -484,8 +484,7 @@ void z_setup_new_thread(struct k_thread *new_thread,
|
|||
/* Initialize various struct k_thread members */
|
||||
z_init_thread_base(&new_thread->base, prio, _THREAD_PRESTART, options);
|
||||
|
||||
arch_new_thread(new_thread, stack, stack_size, entry, p1, p2, p3,
|
||||
prio, options);
|
||||
arch_new_thread(new_thread, stack, stack_size, entry, p1, p2, p3);
|
||||
/* static threads overwrite it afterwards with real value */
|
||||
new_thread->init_data = NULL;
|
||||
new_thread->fn_abort = NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue