arches: fix arch_new_thread param names
MISRA-C wants the parameter names in a function implementaion to match the names used by the header prototype. Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
parent
aa464052ff
commit
24825c8667
9 changed files with 58 additions and 60 deletions
|
@ -39,8 +39,8 @@ struct init_stack_frame {
|
||||||
* and status register.
|
* and status register.
|
||||||
*/
|
*/
|
||||||
void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
||||||
size_t stackSize, k_thread_entry_t pEntry,
|
size_t stack_size, k_thread_entry_t entry,
|
||||||
void *parameter1, void *parameter2, void *parameter3)
|
void *p1, void *p2, void *p3)
|
||||||
{
|
{
|
||||||
char *pStackMem = Z_THREAD_STACK_BUFFER(stack);
|
char *pStackMem = Z_THREAD_STACK_BUFFER(stack);
|
||||||
|
|
||||||
|
@ -54,13 +54,11 @@ void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
||||||
size_t offset = 0;
|
size_t offset = 0;
|
||||||
bool is_user = (thread->base.user_options & K_USER) != 0;
|
bool is_user = (thread->base.user_options & K_USER) != 0;
|
||||||
|
|
||||||
|
stackAdjSize = Z_ARC_MPU_SIZE_ALIGN(stack_size);
|
||||||
stackAdjSize = Z_ARC_MPU_SIZE_ALIGN(stackSize);
|
|
||||||
|
|
||||||
stackEnd = pStackMem + stackAdjSize;
|
stackEnd = pStackMem + stackAdjSize;
|
||||||
|
|
||||||
#ifdef CONFIG_STACK_POINTER_RANDOM
|
#ifdef CONFIG_STACK_POINTER_RANDOM
|
||||||
offset = stackAdjSize - stackSize;
|
offset = stackAdjSize - stack_size;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (is_user) {
|
if (is_user) {
|
||||||
|
@ -134,9 +132,9 @@ void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
||||||
pInitCtx->status32 |= _ARC_V2_STATUS32_US;
|
pInitCtx->status32 |= _ARC_V2_STATUS32_US;
|
||||||
#else /* For no USERSPACE feature */
|
#else /* For no USERSPACE feature */
|
||||||
pStackMem += STACK_GUARD_SIZE;
|
pStackMem += STACK_GUARD_SIZE;
|
||||||
stackEnd = pStackMem + stackSize;
|
stackEnd = pStackMem + stack_size;
|
||||||
|
|
||||||
z_new_thread_init(thread, pStackMem, stackSize);
|
z_new_thread_init(thread, pStackMem, stack_size);
|
||||||
|
|
||||||
priv_stack_end = stackEnd;
|
priv_stack_end = stackEnd;
|
||||||
|
|
||||||
|
@ -152,10 +150,10 @@ void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
||||||
pInitCtx->sec_stat = z_arc_v2_aux_reg_read(_ARC_V2_SEC_STAT);
|
pInitCtx->sec_stat = z_arc_v2_aux_reg_read(_ARC_V2_SEC_STAT);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
pInitCtx->r0 = (uint32_t)pEntry;
|
pInitCtx->r0 = (uint32_t)entry;
|
||||||
pInitCtx->r1 = (uint32_t)parameter1;
|
pInitCtx->r1 = (uint32_t)p1;
|
||||||
pInitCtx->r2 = (uint32_t)parameter2;
|
pInitCtx->r2 = (uint32_t)p2;
|
||||||
pInitCtx->r3 = (uint32_t)parameter3;
|
pInitCtx->r3 = (uint32_t)p3;
|
||||||
|
|
||||||
/* stack check configuration */
|
/* stack check configuration */
|
||||||
#ifdef CONFIG_ARC_STACK_CHECKING
|
#ifdef CONFIG_ARC_STACK_CHECKING
|
||||||
|
|
|
@ -29,8 +29,8 @@
|
||||||
* of the ESF.
|
* of the ESF.
|
||||||
*/
|
*/
|
||||||
void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
||||||
size_t stackSize, k_thread_entry_t pEntry,
|
size_t stack_size, k_thread_entry_t entry,
|
||||||
void *parameter1, void *parameter2, void *parameter3)
|
void *p1, void *p2, void *p3)
|
||||||
{
|
{
|
||||||
char *pStackMem = Z_THREAD_STACK_BUFFER(stack);
|
char *pStackMem = Z_THREAD_STACK_BUFFER(stack);
|
||||||
char *stackEnd;
|
char *stackEnd;
|
||||||
|
@ -53,11 +53,11 @@ void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
||||||
* switches to user mode (thus, its stack area will need to be MPU-
|
* switches to user mode (thus, its stack area will need to be MPU-
|
||||||
* programmed to be assigned unprivileged RW access permission).
|
* programmed to be assigned unprivileged RW access permission).
|
||||||
*/
|
*/
|
||||||
stackSize &= ~(CONFIG_ARM_MPU_REGION_MIN_ALIGN_AND_SIZE - 1);
|
stack_size &= ~(CONFIG_ARM_MPU_REGION_MIN_ALIGN_AND_SIZE - 1);
|
||||||
|
|
||||||
#ifdef CONFIG_THREAD_USERSPACE_LOCAL_DATA
|
#ifdef CONFIG_THREAD_USERSPACE_LOCAL_DATA
|
||||||
/* Reserve space on top of stack for local data. */
|
/* Reserve space on top of stack for local data. */
|
||||||
uint32_t p_local_data = Z_STACK_PTR_ALIGN(pStackMem + stackSize
|
uint32_t p_local_data = Z_STACK_PTR_ALIGN(pStackMem + stack_size
|
||||||
- sizeof(*thread->userspace_local_data));
|
- sizeof(*thread->userspace_local_data));
|
||||||
|
|
||||||
thread->userspace_local_data =
|
thread->userspace_local_data =
|
||||||
|
@ -65,7 +65,7 @@ void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
||||||
|
|
||||||
/* Top of actual stack must be moved below the user local data. */
|
/* Top of actual stack must be moved below the user local data. */
|
||||||
top_of_stack_offset = (uint32_t)
|
top_of_stack_offset = (uint32_t)
|
||||||
(pStackMem + stackSize - ((char *)p_local_data));
|
(pStackMem + stack_size - ((char *)p_local_data));
|
||||||
|
|
||||||
#endif /* CONFIG_THREAD_USERSPACE_LOCAL_DATA */
|
#endif /* CONFIG_THREAD_USERSPACE_LOCAL_DATA */
|
||||||
#endif /* CONFIG_USERSPACE */
|
#endif /* CONFIG_USERSPACE */
|
||||||
|
@ -83,15 +83,15 @@ void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
||||||
if ((thread->base.user_options & K_FP_REGS) != 0) {
|
if ((thread->base.user_options & K_FP_REGS) != 0) {
|
||||||
pStackMem += MPU_GUARD_ALIGN_AND_SIZE_FLOAT
|
pStackMem += MPU_GUARD_ALIGN_AND_SIZE_FLOAT
|
||||||
- MPU_GUARD_ALIGN_AND_SIZE;
|
- MPU_GUARD_ALIGN_AND_SIZE;
|
||||||
stackSize -= MPU_GUARD_ALIGN_AND_SIZE_FLOAT
|
stack_size -= MPU_GUARD_ALIGN_AND_SIZE_FLOAT
|
||||||
- MPU_GUARD_ALIGN_AND_SIZE;
|
- MPU_GUARD_ALIGN_AND_SIZE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
stackEnd = pStackMem + stackSize;
|
stackEnd = pStackMem + stack_size;
|
||||||
|
|
||||||
struct __esf *pInitCtx;
|
struct __esf *pInitCtx;
|
||||||
|
|
||||||
z_new_thread_init(thread, pStackMem, stackSize);
|
z_new_thread_init(thread, pStackMem, stack_size);
|
||||||
|
|
||||||
/* Carve the thread entry struct from the "base" of the stack
|
/* Carve the thread entry struct from the "base" of the stack
|
||||||
*
|
*
|
||||||
|
@ -117,10 +117,10 @@ void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
||||||
pInitCtx->basic.pc &= 0xfffffffe;
|
pInitCtx->basic.pc &= 0xfffffffe;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
pInitCtx->basic.a1 = (uint32_t)pEntry;
|
pInitCtx->basic.a1 = (uint32_t)entry;
|
||||||
pInitCtx->basic.a2 = (uint32_t)parameter1;
|
pInitCtx->basic.a2 = (uint32_t)p1;
|
||||||
pInitCtx->basic.a3 = (uint32_t)parameter2;
|
pInitCtx->basic.a3 = (uint32_t)p2;
|
||||||
pInitCtx->basic.a4 = (uint32_t)parameter3;
|
pInitCtx->basic.a4 = (uint32_t)p3;
|
||||||
|
|
||||||
#if defined(CONFIG_CPU_CORTEX_M)
|
#if defined(CONFIG_CPU_CORTEX_M)
|
||||||
pInitCtx->basic.xpsr =
|
pInitCtx->basic.xpsr =
|
||||||
|
|
|
@ -44,29 +44,29 @@ struct init_stack_frame {
|
||||||
* anymore.
|
* anymore.
|
||||||
*/
|
*/
|
||||||
void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
||||||
size_t stackSize, k_thread_entry_t pEntry,
|
size_t stack_size, k_thread_entry_t entry,
|
||||||
void *parameter1, void *parameter2, void *parameter3)
|
void *p1, void *p2, void *p3)
|
||||||
{
|
{
|
||||||
char *pStackMem = Z_THREAD_STACK_BUFFER(stack);
|
char *pStackMem = Z_THREAD_STACK_BUFFER(stack);
|
||||||
char *stackEnd;
|
char *stackEnd;
|
||||||
struct init_stack_frame *pInitCtx;
|
struct init_stack_frame *pInitCtx;
|
||||||
|
|
||||||
stackEnd = pStackMem + stackSize;
|
stackEnd = pStackMem + stack_size;
|
||||||
|
|
||||||
z_new_thread_init(thread, pStackMem, stackSize);
|
z_new_thread_init(thread, pStackMem, stack_size);
|
||||||
|
|
||||||
pInitCtx = (struct init_stack_frame *)(Z_STACK_PTR_ALIGN(stackEnd -
|
pInitCtx = (struct init_stack_frame *)(Z_STACK_PTR_ALIGN(stackEnd -
|
||||||
sizeof(struct init_stack_frame)));
|
sizeof(struct init_stack_frame)));
|
||||||
|
|
||||||
pInitCtx->entry_point = (uint64_t)pEntry;
|
pInitCtx->entry_point = (uint64_t)entry;
|
||||||
pInitCtx->arg1 = (uint64_t)parameter1;
|
pInitCtx->arg1 = (uint64_t)p1;
|
||||||
pInitCtx->arg2 = (uint64_t)parameter2;
|
pInitCtx->arg2 = (uint64_t)p2;
|
||||||
pInitCtx->arg3 = (uint64_t)parameter3;
|
pInitCtx->arg3 = (uint64_t)p3;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* - ELR_ELn: to be used by eret in z_thread_entry_wrapper() to return
|
* - ELR_ELn: to be used by eret in z_thread_entry_wrapper() to return
|
||||||
* to z_thread_entry() with pEntry in x0(entry_point) and the parameters
|
* to z_thread_entry() with entry in x0(entry_point) and the
|
||||||
* already in place in x1(arg1), x2(arg2), x3(arg3).
|
* parameters already in place in x1(arg1), x2(arg2), x3(arg3).
|
||||||
* - SPSR_ELn: to enable IRQs (we are masking debug exceptions, SError
|
* - SPSR_ELn: to enable IRQs (we are masking debug exceptions, SError
|
||||||
* interrupts and FIQs).
|
* interrupts and FIQs).
|
||||||
*/
|
*/
|
||||||
|
@ -76,7 +76,7 @@ void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
||||||
/*
|
/*
|
||||||
* We are saving:
|
* We are saving:
|
||||||
*
|
*
|
||||||
* - SP: to pop out pEntry and parameters when going through
|
* - SP: to pop out entry and parameters when going through
|
||||||
* z_thread_entry_wrapper().
|
* z_thread_entry_wrapper().
|
||||||
* - x30: to be used by ret in z_arm64_context_switch() when the new
|
* - x30: to be used by ret in z_arm64_context_switch() when the new
|
||||||
* task is first scheduled.
|
* task is first scheduled.
|
||||||
|
|
|
@ -29,7 +29,7 @@ struct init_stack_frame {
|
||||||
|
|
||||||
|
|
||||||
void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
||||||
size_t stack_size, k_thread_entry_t thread_func,
|
size_t stack_size, k_thread_entry_t entry,
|
||||||
void *arg1, void *arg2, void *arg3)
|
void *arg1, void *arg2, void *arg3)
|
||||||
{
|
{
|
||||||
char *stack_memory = Z_THREAD_STACK_BUFFER(stack);
|
char *stack_memory = Z_THREAD_STACK_BUFFER(stack);
|
||||||
|
@ -42,7 +42,7 @@ void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
||||||
Z_STACK_PTR_ALIGN(stack_memory + stack_size - sizeof(*iframe));
|
Z_STACK_PTR_ALIGN(stack_memory + stack_size - sizeof(*iframe));
|
||||||
|
|
||||||
/* Setup the initial stack frame */
|
/* Setup the initial stack frame */
|
||||||
iframe->entry_point = thread_func;
|
iframe->entry_point = entry;
|
||||||
iframe->arg1 = arg1;
|
iframe->arg1 = arg1;
|
||||||
iframe->arg2 = arg2;
|
iframe->arg2 = arg2;
|
||||||
iframe->arg3 = arg3;
|
iframe->arg3 = arg3;
|
||||||
|
|
|
@ -25,8 +25,8 @@
|
||||||
* pthreads stack and therefore we ignore the stack size
|
* pthreads stack and therefore we ignore the stack size
|
||||||
*/
|
*/
|
||||||
void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
||||||
size_t stack_size, k_thread_entry_t thread_func,
|
size_t stack_size, k_thread_entry_t entry,
|
||||||
void *arg1, void *arg2, void *arg3)
|
void *p1, void *p2, void *p3)
|
||||||
{
|
{
|
||||||
|
|
||||||
char *stack_memory = Z_THREAD_STACK_BUFFER(stack);
|
char *stack_memory = Z_THREAD_STACK_BUFFER(stack);
|
||||||
|
@ -43,10 +43,10 @@ void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
||||||
- sizeof(*thread_status));
|
- sizeof(*thread_status));
|
||||||
|
|
||||||
/* z_thread_entry() arguments */
|
/* z_thread_entry() arguments */
|
||||||
thread_status->entry_point = thread_func;
|
thread_status->entry_point = entry;
|
||||||
thread_status->arg1 = arg1;
|
thread_status->arg1 = p1;
|
||||||
thread_status->arg2 = arg2;
|
thread_status->arg2 = p2;
|
||||||
thread_status->arg3 = arg3;
|
thread_status->arg3 = p3;
|
||||||
#if defined(CONFIG_ARCH_HAS_THREAD_ABORT)
|
#if defined(CONFIG_ARCH_HAS_THREAD_ABORT)
|
||||||
thread_status->aborted = 0;
|
thread_status->aborted = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -13,8 +13,8 @@ void z_thread_entry_wrapper(k_thread_entry_t thread,
|
||||||
void *arg3);
|
void *arg3);
|
||||||
|
|
||||||
void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
||||||
size_t stack_size, k_thread_entry_t thread_func,
|
size_t stack_size, k_thread_entry_t entry,
|
||||||
void *arg1, void *arg2, void *arg3)
|
void *p1, void *p2, void *p3)
|
||||||
{
|
{
|
||||||
char *stack_memory = Z_THREAD_STACK_BUFFER(stack);
|
char *stack_memory = Z_THREAD_STACK_BUFFER(stack);
|
||||||
|
|
||||||
|
@ -32,10 +32,10 @@ void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
||||||
stack_size - sizeof(struct __esf));
|
stack_size - sizeof(struct __esf));
|
||||||
|
|
||||||
/* Setup the initial stack frame */
|
/* Setup the initial stack frame */
|
||||||
stack_init->a0 = (ulong_t)thread_func;
|
stack_init->a0 = (ulong_t)entry;
|
||||||
stack_init->a1 = (ulong_t)arg1;
|
stack_init->a1 = (ulong_t)p1;
|
||||||
stack_init->a2 = (ulong_t)arg2;
|
stack_init->a2 = (ulong_t)p2;
|
||||||
stack_init->a3 = (ulong_t)arg3;
|
stack_init->a3 = (ulong_t)p3;
|
||||||
/*
|
/*
|
||||||
* Following the RISC-V architecture,
|
* Following the RISC-V architecture,
|
||||||
* the MSTATUS register (used to globally enable/disable interrupt),
|
* the MSTATUS register (used to globally enable/disable interrupt),
|
||||||
|
|
|
@ -62,7 +62,7 @@ int arch_float_disable(struct k_thread *thread)
|
||||||
|
|
||||||
void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
||||||
size_t stack_size, k_thread_entry_t entry,
|
size_t stack_size, k_thread_entry_t entry,
|
||||||
void *parameter1, void *parameter2, void *parameter3)
|
void *p1, void *p2, void *p3)
|
||||||
{
|
{
|
||||||
char *stack_buf;
|
char *stack_buf;
|
||||||
char *stack_high;
|
char *stack_high;
|
||||||
|
@ -95,9 +95,9 @@ void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
||||||
(stack_high - sizeof(struct _x86_initial_frame));
|
(stack_high - sizeof(struct _x86_initial_frame));
|
||||||
/* z_thread_entry() arguments */
|
/* z_thread_entry() arguments */
|
||||||
initial_frame->entry = entry;
|
initial_frame->entry = entry;
|
||||||
initial_frame->p1 = parameter1;
|
initial_frame->p1 = p1;
|
||||||
initial_frame->p2 = parameter2;
|
initial_frame->p2 = p2;
|
||||||
initial_frame->p3 = parameter3;
|
initial_frame->p3 = p3;
|
||||||
initial_frame->eflags = EFLAGS_INITIAL;
|
initial_frame->eflags = EFLAGS_INITIAL;
|
||||||
#ifdef _THREAD_WRAPPER_REQUIRED
|
#ifdef _THREAD_WRAPPER_REQUIRED
|
||||||
initial_frame->edi = (uint32_t)swap_entry;
|
initial_frame->edi = (uint32_t)swap_entry;
|
||||||
|
|
|
@ -13,7 +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,
|
void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
||||||
size_t stack_size, k_thread_entry_t entry,
|
size_t stack_size, k_thread_entry_t entry,
|
||||||
void *parameter1, void *parameter2, void *parameter3)
|
void *p1, void *p2, void *p3)
|
||||||
{
|
{
|
||||||
void *switch_entry;
|
void *switch_entry;
|
||||||
|
|
||||||
|
@ -44,9 +44,9 @@ void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
||||||
* thread->callee_saved.rip
|
* thread->callee_saved.rip
|
||||||
*/
|
*/
|
||||||
thread->arch.rdi = (long) entry;
|
thread->arch.rdi = (long) entry;
|
||||||
thread->arch.rsi = (long) parameter1;
|
thread->arch.rsi = (long) p1;
|
||||||
thread->arch.rdx = (long) parameter2;
|
thread->arch.rdx = (long) p2;
|
||||||
thread->arch.rcx = (long) parameter3;
|
thread->arch.rcx = (long) p3;
|
||||||
|
|
||||||
x86_sse_init(thread);
|
x86_sse_init(thread);
|
||||||
|
|
||||||
|
|
|
@ -57,16 +57,16 @@ void *xtensa_init_stack(int *stack_top,
|
||||||
}
|
}
|
||||||
|
|
||||||
void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
||||||
size_t sz, k_thread_entry_t entry,
|
size_t stack_size, k_thread_entry_t entry,
|
||||||
void *p1, void *p2, void *p3)
|
void *p1, void *p2, void *p3)
|
||||||
{
|
{
|
||||||
char *base = Z_THREAD_STACK_BUFFER(stack);
|
char *base = Z_THREAD_STACK_BUFFER(stack);
|
||||||
char *top = base + sz;
|
char *top = base + stack_size;
|
||||||
|
|
||||||
/* Align downward. The API as specified requires a runtime check. */
|
/* Align downward. The API as specified requires a runtime check. */
|
||||||
top = (char *)(((unsigned int)top) & ~3);
|
top = (char *)(((unsigned int)top) & ~3);
|
||||||
|
|
||||||
z_new_thread_init(thread, base, sz);
|
z_new_thread_init(thread, base, stack_size);
|
||||||
|
|
||||||
thread->switch_handle = xtensa_init_stack((void *)top, entry,
|
thread->switch_handle = xtensa_init_stack((void *)top, entry,
|
||||||
p1, p2, p3);
|
p1, p2, p3);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue