kernel: rename z_new_thread()

This is part of the core kernel -> architecture interface
and should have a leading prefix z_arch_.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
Andrew Boie 2019-09-21 15:36:52 -07:00 committed by Anas Nashif
commit 61901ccb4c
15 changed files with 58 additions and 57 deletions

View file

@ -59,10 +59,10 @@ struct init_stack_frame {
* *
* @return N/A * @return N/A
*/ */
void z_new_thread(struct k_thread *thread, k_thread_stack_t *stack, void z_arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
size_t stackSize, k_thread_entry_t pEntry, size_t stackSize, k_thread_entry_t pEntry,
void *parameter1, void *parameter2, void *parameter3, void *parameter1, void *parameter2, void *parameter3,
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); Z_ASSERT_VALID_PRIO(priority, pEntry);

View file

@ -22,7 +22,7 @@ GTEXT(z_thread_entry_wrapper1)
* @brief Wrapper for z_thread_entry * @brief Wrapper for z_thread_entry
* *
* The routine pops parameters for the z_thread_entry from stack frame, prepared * The routine pops parameters for the z_thread_entry from stack frame, prepared
* by the z_new_thread() routine. * by the z_arch_new_thread() routine.
* *
* @return N/A * @return N/A
*/ */

View file

@ -50,10 +50,10 @@ extern u8_t *z_priv_stack_find(void *obj);
* @return N/A * @return N/A
*/ */
void z_new_thread(struct k_thread *thread, k_thread_stack_t *stack, void z_arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
size_t stackSize, k_thread_entry_t pEntry, size_t stackSize, k_thread_entry_t pEntry,
void *parameter1, void *parameter2, void *parameter3, void *parameter1, void *parameter2, void *parameter3,
int priority, unsigned int options) int priority, unsigned int options)
{ {
char *pStackMem = Z_THREAD_STACK_BUFFER(stack); char *pStackMem = Z_THREAD_STACK_BUFFER(stack);
char *stackEnd; char *stackEnd;

View file

@ -31,10 +31,10 @@ struct init_stack_frame {
}; };
void z_new_thread(struct k_thread *thread, k_thread_stack_t *stack, void z_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 thread_func,
void *arg1, void *arg2, void *arg3, void *arg1, void *arg2, void *arg3,
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); Z_ASSERT_VALID_PRIO(priority, thread_func);

View file

@ -361,10 +361,10 @@ static int ttable_get_empty_slot(void)
} }
/** /**
* Called from z_new_thread(), * Called from z_arch_new_thread(),
* Create a new POSIX thread for the new Zephyr thread. * Create a new POSIX thread for the new Zephyr thread.
* z_new_thread() picks from the kernel structures what it is that we need to * z_arch_new_thread() picks from the kernel structures what it is that we need
* call with what parameters * to call with what parameters
*/ */
void posix_new_thread(posix_thread_status_t *ptr) void posix_new_thread(posix_thread_status_t *ptr)
{ {

View file

@ -41,10 +41,10 @@
* pthreads stack and therefore we ignore the stack size * pthreads stack and therefore we ignore the stack size
* *
*/ */
void z_new_thread(struct k_thread *thread, k_thread_stack_t *stack, void z_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 thread_func,
void *arg1, void *arg2, void *arg3, void *arg1, void *arg2, void *arg3,
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);

View file

@ -15,10 +15,10 @@ void z_thread_entry_wrapper(k_thread_entry_t thread,
void *arg2, void *arg2,
void *arg3); void *arg3);
void z_new_thread(struct k_thread *thread, k_thread_stack_t *stack, void z_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 thread_func,
void *arg1, void *arg2, void *arg3, void *arg1, void *arg2, void *arg3,
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); Z_ASSERT_VALID_PRIO(priority, thread_func);

View file

@ -382,19 +382,19 @@ time_read_not_needed:
* *
* @brief Adjust stack/parameters before invoking thread entry function * @brief Adjust stack/parameters before invoking thread entry function
* *
* This function adjusts the initial stack frame created by z_new_thread() such * This function adjusts the initial stack frame created by z_arch_new_thread()
* that the GDB stack frame unwinders recognize it as the outermost frame in * such that the GDB stack frame unwinders recognize it as the outermost frame
* the thread's stack. * in the thread's stack.
* *
* GDB normally stops unwinding a stack when it detects that it has * GDB normally stops unwinding a stack when it detects that it has
* reached a function called main(). Kernel threads, however, do not have * reached a function called main(). Kernel threads, however, do not have
* a main() function, and there does not appear to be a simple way of stopping * a main() function, and there does not appear to be a simple way of stopping
* the unwinding of the stack. * the unwinding of the stack.
* *
* Given the initial thread created by z_new_thread(), GDB expects to find a * Given the initial thread created by z_arch_new_thread(), GDB expects to find
* return address on the stack immediately above the thread entry routine * a return address on the stack immediately above the thread entry routine
* z_thread_entry, in the location occupied by the initial EFLAGS. * z_thread_entry, in the location occupied by the initial EFLAGS. GDB
* GDB attempts to examine the memory at this return address, which typically * attempts to examine the memory at this return address, which typically
* results in an invalid access to page 0 of memory. * results in an invalid access to page 0 of memory.
* *
* This function overwrites the initial EFLAGS with zero. When GDB subsequently * This function overwrites the initial EFLAGS with zero. When GDB subsequently

View file

@ -190,10 +190,10 @@ int z_arch_float_disable(struct k_thread *thread)
* @param priority thread priority * @param priority thread priority
* @param options thread options: K_ESSENTIAL, K_FP_REGS, K_SSE_REGS * @param options thread options: K_ESSENTIAL, K_FP_REGS, K_SSE_REGS
*/ */
void z_new_thread(struct k_thread *thread, k_thread_stack_t *stack, void z_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 *parameter1, void *parameter2, void *parameter3,
int priority, unsigned int options) int priority, unsigned int options)
{ {
char *stack_buf; char *stack_buf;
char *stack_high; char *stack_high;

View file

@ -10,10 +10,10 @@
extern void x86_sse_init(struct k_thread *); /* in locore.S */ extern void x86_sse_init(struct k_thread *); /* in locore.S */
void z_new_thread(struct k_thread *thread, k_thread_stack_t *stack, void z_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 *parameter1, void *parameter2, void *parameter3,
int priority, unsigned int options) int priority, unsigned int options)
{ {
Z_ASSERT_VALID_PRIO(priority, entry); Z_ASSERT_VALID_PRIO(priority, entry);
z_new_thread_init(thread, Z_THREAD_STACK_BUFFER(stack), z_new_thread_init(thread, Z_THREAD_STACK_BUFFER(stack),

View file

@ -202,7 +202,7 @@ typedef struct s_preempFloatReg {
* The thread control structure definition. It contains the * The thread control structure definition. It contains the
* various fields to manage a _single_ thread. The TCS will be aligned * various fields to manage a _single_ thread. The TCS will be aligned
* to the appropriate architecture specific boundary via the * to the appropriate architecture specific boundary via the
* z_new_thread() call. * z_arch_new_thread() call.
*/ */
struct _thread_arch { struct _thread_arch {

View file

@ -24,10 +24,10 @@ struct device;
struct z_arch_esf_t { struct z_arch_esf_t {
}; };
void z_new_thread(struct k_thread *t, k_thread_stack_t *stack, void z_arch_new_thread(struct k_thread *t, k_thread_stack_t *stack,
size_t sz, k_thread_entry_t entry, size_t sz, k_thread_entry_t entry,
void *p1, void *p2, void *p3, void *p1, void *p2, void *p3,
int prio, unsigned int opts) int prio, unsigned int opts)
{ {
void *args[] = { entry, p1, p2, p3 }; void *args[] = { entry, p1, p2, p3 };
int nargs = 4; int nargs = 4;

View file

@ -56,9 +56,10 @@ void *xtensa_init_stack(int *stack_top,
return &bsa[-9]; return &bsa[-9];
} }
void z_new_thread(struct k_thread *thread, k_thread_stack_t *stack, size_t sz, void z_arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
k_thread_entry_t entry, void *p1, void *p2, void *p3, size_t sz, k_thread_entry_t entry,
int prio, unsigned int opts) void *p1, void *p2, void *p3,
int prio, unsigned int opts)
{ {
char *base = Z_THREAD_STACK_BUFFER(stack); char *base = Z_THREAD_STACK_BUFFER(stack);
char *top = base + sz; char *top = base + sz;

View file

@ -40,10 +40,10 @@ extern FUNC_NORETURN void z_thread_entry(k_thread_entry_t entry,
void *p1, void *p2, void *p3); void *p1, void *p2, void *p3);
/* Implemented by architectures. Only called from z_setup_new_thread. */ /* Implemented by architectures. Only called from z_setup_new_thread. */
extern void z_new_thread(struct k_thread *thread, k_thread_stack_t *pStack, extern void z_arch_new_thread(struct k_thread *thread, k_thread_stack_t *pStack,
size_t stackSize, k_thread_entry_t entry, size_t stackSize, k_thread_entry_t entry,
void *p1, void *p2, void *p3, void *p1, void *p2, void *p3,
int prio, unsigned int options); int prio, unsigned int options);
extern void z_setup_new_thread(struct k_thread *new_thread, extern void z_setup_new_thread(struct k_thread *new_thread,
k_thread_stack_t *stack, size_t stack_size, k_thread_stack_t *stack, size_t stack_size,
@ -181,7 +181,7 @@ extern int z_arch_buffer_validate(void *addr, size_t size, int write);
* - Set up any kernel stack region for the CPU to use during privilege * - Set up any kernel stack region for the CPU to use during privilege
* elevation * elevation
* - Put the CPU in whatever its equivalent of user mode is * - Put the CPU in whatever its equivalent of user mode is
* - Transfer execution to z_new_thread() passing along all the supplied * - Transfer execution to z_arch_new_thread() passing along all the supplied
* arguments, in user mode. * arguments, in user mode.
* *
* @param Entry point to start executing as a user thread * @param Entry point to start executing as a user thread

View file

@ -412,8 +412,8 @@ static inline size_t adjust_stack_size(size_t stack_size)
random_val = sys_rand32_get(); random_val = sys_rand32_get();
} }
/* Don't need to worry about alignment of the size here, z_new_thread() /* Don't need to worry about alignment of the size here,
* is required to do it * z_arch_new_thread() is required to do it.
* *
* FIXME: Not the best way to get a random number in a range. * FIXME: Not the best way to get a random number in a range.
* See #6493 * See #6493
@ -462,12 +462,12 @@ void z_setup_new_thread(struct k_thread *new_thread,
#endif #endif
#endif #endif
z_new_thread(new_thread, stack, stack_size, entry, p1, p2, p3, z_arch_new_thread(new_thread, stack, stack_size, entry, p1, p2, p3,
prio, options); prio, options);
#ifdef CONFIG_THREAD_USERSPACE_LOCAL_DATA #ifdef CONFIG_THREAD_USERSPACE_LOCAL_DATA
#ifndef CONFIG_THREAD_USERSPACE_LOCAL_DATA_ARCH_DEFER_SETUP #ifndef CONFIG_THREAD_USERSPACE_LOCAL_DATA_ARCH_DEFER_SETUP
/* don't set again if the arch's own code in z_new_thread() has /* don't set again if the arch's own code in z_arch_new_thread() has
* already set the pointer. * already set the pointer.
*/ */
new_thread->userspace_local_data = new_thread->userspace_local_data =