Update reserved function names starting with one underscore, replacing them as follows: '_k_' with 'z_' '_K_' with 'Z_' '_handler_' with 'z_handl_' '_Cstart' with 'z_cstart' '_Swap' with 'z_swap' This renaming is done on both global and those static function names in kernel/include and include/. Other static function names in kernel/ are renamed by removing the leading underscore. Other function names not starting with any prefix listed above are renamed starting with a 'z_' or 'Z_' prefix. Function names starting with two or three leading underscores are not automatcally renamed since these names will collide with the variants with two or three leading underscores. Various generator scripts have also been updated as well as perf, linker and usb files. These are drivers/serial/uart_handlers.c include/linker/kobject-text.ld kernel/include/syscall_handler.h scripts/gen_kobject_list.py scripts/gen_syscall_header.py Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
86 lines
2.2 KiB
C
86 lines
2.2 KiB
C
/*
|
|
* Copyright (c) 2010-2015 Wind River Systems, Inc.
|
|
* Copyright (c) 2017 Oticon A/S
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
/**
|
|
* @file
|
|
* @brief Thread support primitives
|
|
*
|
|
* This module provides core thread related primitives for the POSIX
|
|
* architecture
|
|
*/
|
|
|
|
#ifdef CONFIG_INIT_STACKS
|
|
#include <string.h>
|
|
#endif /* CONFIG_INIT_STACKS */
|
|
|
|
#include <toolchain.h>
|
|
#include <kernel_structs.h>
|
|
#include <wait_q.h>
|
|
|
|
#include "posix_core.h"
|
|
#include "posix_soc_if.h"
|
|
|
|
|
|
/**
|
|
* @brief Create a new kernel execution thread
|
|
*
|
|
* Initializes the k_thread object and sets up initial stack frame.
|
|
*
|
|
* @param thread pointer to thread struct memory, including any space needed
|
|
* for extra coprocessor context
|
|
* @param stack the pointer to aligned stack memory
|
|
* @param stack_size the stack size in bytes
|
|
* @param entry thread entry point routine
|
|
* @param arg1 first param to entry point
|
|
* @param arg2 second param to entry point
|
|
* @param arg3 third param to entry point
|
|
* @param priority thread priority
|
|
* @param options thread options: K_ESSENTIAL, K_FP_REGS, K_SSE_REGS
|
|
*
|
|
* Note that in this arch we cheat quite a bit: we use as stack a normal
|
|
* pthreads stack and therefore we ignore the stack size
|
|
*
|
|
*/
|
|
void z_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)
|
|
{
|
|
|
|
char *stack_memory = K_THREAD_STACK_BUFFER(stack);
|
|
|
|
Z_ASSERT_VALID_PRIO(priority, thread_func);
|
|
|
|
posix_thread_status_t *thread_status;
|
|
|
|
_new_thread_init(thread, stack_memory, stack_size, priority, options);
|
|
|
|
/* We store it in the same place where normal archs store the
|
|
* "initial stack frame"
|
|
*/
|
|
thread_status = (posix_thread_status_t *)
|
|
STACK_ROUND_DOWN(stack_memory + stack_size
|
|
- sizeof(*thread_status));
|
|
|
|
/* z_thread_entry() arguments */
|
|
thread_status->entry_point = thread_func;
|
|
thread_status->arg1 = arg1;
|
|
thread_status->arg2 = arg2;
|
|
thread_status->arg3 = arg3;
|
|
#if defined(CONFIG_ARCH_HAS_THREAD_ABORT)
|
|
thread_status->aborted = 0;
|
|
#endif
|
|
|
|
thread->callee_saved.thread_status = (u32_t)thread_status;
|
|
|
|
posix_new_thread(thread_status);
|
|
}
|
|
|
|
void posix_new_thread_pre_start(void)
|
|
{
|
|
posix_irq_full_unlock();
|
|
}
|