Lines Matching full:thread
9 * @brief New thread creation for ARCv2
11 * Core thread related primitives for the ARCv2 processor architecture.
45 static bool is_user(struct k_thread *thread) in is_user() argument
47 return (thread->base.user_options & K_USER) != 0; in is_user()
51 /* Set all stack-related architecture variables for the provided thread */
52 static void setup_stack_vars(struct k_thread *thread) in setup_stack_vars() argument
55 if (is_user(thread)) { in setup_stack_vars()
57 thread->arch.priv_stack_start = in setup_stack_vars()
58 (uint32_t)z_priv_stack_find(thread->stack_obj); in setup_stack_vars()
60 thread->arch.priv_stack_start = (uint32_t)(thread->stack_obj); in setup_stack_vars()
62 thread->arch.priv_stack_start += Z_ARC_STACK_GUARD_SIZE; in setup_stack_vars()
64 thread->arch.priv_stack_start = 0; in setup_stack_vars()
70 if (is_user(thread)) { in setup_stack_vars()
71 thread->arch.k_stack_top = thread->arch.priv_stack_start; in setup_stack_vars()
72 thread->arch.k_stack_base = (thread->arch.priv_stack_start + in setup_stack_vars()
74 thread->arch.u_stack_top = thread->stack_info.start; in setup_stack_vars()
75 thread->arch.u_stack_base = (thread->stack_info.start + in setup_stack_vars()
76 thread->stack_info.size); in setup_stack_vars()
80 thread->arch.k_stack_top = (uint32_t)thread->stack_info.start; in setup_stack_vars()
81 thread->arch.k_stack_base = (uint32_t)(thread->stack_info.start + in setup_stack_vars()
82 thread->stack_info.size); in setup_stack_vars()
84 thread->arch.u_stack_top = 0; in setup_stack_vars()
85 thread->arch.u_stack_base = 0; in setup_stack_vars()
91 /* Get the initial stack frame pointer from the thread's stack buffer. */
92 static struct init_stack_frame *get_iframe(struct k_thread *thread, in get_iframe() argument
96 if (is_user(thread)) { in get_iframe()
97 /* Initial stack frame for a user thread is slightly larger; in get_iframe()
105 thread->arch.priv_stack_start + in get_iframe()
116 * so these registers have pre-defined values when new thread begins
117 * execution. For example, setting up the thread pointer for thread local
118 * storage here so the thread starts with thread pointer already set up.
120 static inline void arch_setup_callee_saved_regs(struct k_thread *thread, in arch_setup_callee_saved_regs() argument
131 #error Compiler not configured for thread local storage in arch_setup_callee_saved_regs()
134 /* __ARC_TLS_REGNO__ is used for thread pointer for ARCv2 */ in arch_setup_callee_saved_regs()
135 regs->TLSREG = thread->tls; in arch_setup_callee_saved_regs()
137 /* R30 is used for thread pointer for ARCv3 */ in arch_setup_callee_saved_regs()
138 regs->r30 = thread->tls; in arch_setup_callee_saved_regs()
148 void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack, in arch_new_thread() argument
154 setup_stack_vars(thread); in arch_new_thread()
157 iframe = get_iframe(thread, stack_ptr); in arch_new_thread()
167 if (is_user(thread)) { in arch_new_thread()
194 /* Set required thread members */ in arch_new_thread()
195 thread->switch_handle = thread; in arch_new_thread()
196 thread->arch.relinquish_cause = _CAUSE_COOP; in arch_new_thread()
197 thread->callee_saved.sp = in arch_new_thread()
200 arch_setup_callee_saved_regs(thread, thread->callee_saved.sp); in arch_new_thread()
240 int arch_float_disable(struct k_thread *thread) in arch_float_disable() argument
248 /* Disable all floating point capabilities for the thread */ in arch_float_disable()
249 thread->base.user_options &= ~K_FP_REGS; in arch_float_disable()
257 int arch_float_enable(struct k_thread *thread, unsigned int options) in arch_float_enable() argument
265 /* Enable all floating point capabilities for the thread */ in arch_float_enable()
266 thread->base.user_options |= K_FP_REGS; in arch_float_enable()
301 void arc_dsp_disable(struct k_thread *thread, unsigned int options) in arc_dsp_disable() argument
306 /* Disable DSP or AGU capabilities for the thread */ in arc_dsp_disable()
307 thread->base.user_options &= ~(uint8_t)options; in arc_dsp_disable()
312 void arc_dsp_enable(struct k_thread *thread, unsigned int options) in arc_dsp_enable() argument
317 /* Enable dsp or agu capabilities for the thread */ in arc_dsp_enable()
318 thread->base.user_options |= (uint8_t)options; in arc_dsp_enable()