Lines Matching refs:new_thread
383 static char *setup_thread_stack(struct k_thread *new_thread, in setup_thread_stack() argument
443 new_thread->stack_info.mapped.addr = stack_mapped; in setup_thread_stack()
444 new_thread->stack_info.mapped.sz = stack_obj_size; in setup_thread_stack()
457 stack, new_thread, stack_obj_size, (void *)stack_buf_start, in setup_thread_stack()
472 delta += arch_tls_stack_setup(new_thread, stack_ptr); in setup_thread_stack()
479 new_thread->userspace_local_data = in setup_thread_stack()
494 new_thread->stack_info.start = (uintptr_t)stack_buf_start; in setup_thread_stack()
495 new_thread->stack_info.size = stack_buf_size; in setup_thread_stack()
496 new_thread->stack_info.delta = delta; in setup_thread_stack()
508 char *z_setup_new_thread(struct k_thread *new_thread, in z_setup_new_thread() argument
519 k_thread_abort_cleanup_check_reuse(new_thread); in z_setup_new_thread()
523 k_obj_core_init_and_link(K_OBJ_CORE(new_thread), &obj_type_thread); in z_setup_new_thread()
525 k_obj_core_stats_register(K_OBJ_CORE(new_thread), in z_setup_new_thread()
526 &new_thread->base.usage, in z_setup_new_thread()
527 sizeof(new_thread->base.usage)); in z_setup_new_thread()
534 new_thread, stack); in z_setup_new_thread()
535 k_object_init(new_thread); in z_setup_new_thread()
537 new_thread->stack_obj = stack; in z_setup_new_thread()
538 new_thread->syscall_frame = NULL; in z_setup_new_thread()
541 k_object_access_grant(new_thread, new_thread); in z_setup_new_thread()
543 z_waitq_init(&new_thread->join_queue); in z_setup_new_thread()
546 z_init_thread_base(&new_thread->base, prio, _THREAD_SLEEPING, options); in z_setup_new_thread()
547 stack_ptr = setup_thread_stack(new_thread, stack, stack_size); in z_setup_new_thread()
553 __ASSERT_NO_MSG(arch_mem_coherent(new_thread)); in z_setup_new_thread()
564 arch_new_thread(new_thread, stack, stack_ptr, entry, p1, p2, p3); in z_setup_new_thread()
567 new_thread->init_data = NULL; in z_setup_new_thread()
574 __ASSERT(new_thread->switch_handle != NULL, in z_setup_new_thread()
579 new_thread->custom_data = NULL; in z_setup_new_thread()
582 new_thread->no_wake_on_timeout = false; in z_setup_new_thread()
585 new_thread->entry.pEntry = entry; in z_setup_new_thread()
586 new_thread->entry.parameter1 = p1; in z_setup_new_thread()
587 new_thread->entry.parameter2 = p2; in z_setup_new_thread()
588 new_thread->entry.parameter3 = p3; in z_setup_new_thread()
592 new_thread->next_thread = _kernel.threads; in z_setup_new_thread()
593 _kernel.threads = new_thread; in z_setup_new_thread()
598 strncpy(new_thread->name, name, in z_setup_new_thread()
601 new_thread->name[CONFIG_THREAD_MAX_NAME_LEN - 1] = '\0'; in z_setup_new_thread()
603 arch_thread_name_set(new_thread, name); in z_setup_new_thread()
606 new_thread->name[0] = '\0'; in z_setup_new_thread()
611 new_thread->base.cpu_mask = 1; /* must specify only one cpu */ in z_setup_new_thread()
613 new_thread->base.cpu_mask = -1; /* allow all cpus */ in z_setup_new_thread()
619 new_thread->resource_pool = NULL; in z_setup_new_thread()
624 z_mem_domain_init_thread(new_thread); in z_setup_new_thread()
627 k_thread_perms_inherit(arch_current_thread(), new_thread); in z_setup_new_thread()
631 new_thread->base.prio_deadline = 0; in z_setup_new_thread()
633 new_thread->resource_pool = arch_current_thread()->resource_pool; in z_setup_new_thread()
636 z_waitq_init(&new_thread->halt_queue); in z_setup_new_thread()
640 new_thread->base.usage = (struct k_cycle_stats) {}; in z_setup_new_thread()
641 new_thread->base.usage.track_usage = in z_setup_new_thread()
645 SYS_PORT_TRACING_OBJ_FUNC(k_thread, create, new_thread); in z_setup_new_thread()
651 k_tid_t z_impl_k_thread_create(struct k_thread *new_thread, in z_impl_k_thread_create() argument
659 z_setup_new_thread(new_thread, stack, stack_size, entry, p1, p2, p3, in z_impl_k_thread_create()
663 thread_schedule_new(new_thread, delay); in z_impl_k_thread_create()
666 return new_thread; in z_impl_k_thread_create()
675 k_tid_t z_vrfy_k_thread_create(struct k_thread *new_thread, in z_vrfy_k_thread_create() argument
685 K_OOPS(K_SYSCALL_OBJ_NEVER_INIT(new_thread, K_OBJ_THREAD)); in z_vrfy_k_thread_create()
730 z_setup_new_thread(new_thread, stack, stack_size, in z_vrfy_k_thread_create()
734 thread_schedule_new(new_thread, delay); in z_vrfy_k_thread_create()
737 return new_thread; in z_vrfy_k_thread_create()