Lines Matching +full:initial +full:- +full:key
4 * SPDX-License-Identifier: Apache-2.0
31 /* initial stack frame */
52 return (thread->base.user_options & K_USER) != 0; in is_user()
56 /* Set all stack-related architecture variables for the provided thread */
62 thread->arch.priv_stack_start = in setup_stack_vars()
63 (uint32_t)z_priv_stack_find(thread->stack_obj); in setup_stack_vars()
65 thread->arch.priv_stack_start = (uint32_t)(thread->stack_obj); in setup_stack_vars()
67 thread->arch.priv_stack_start += Z_ARC_STACK_GUARD_SIZE; in setup_stack_vars()
69 thread->arch.priv_stack_start = 0; in setup_stack_vars()
76 thread->arch.k_stack_top = thread->arch.priv_stack_start; in setup_stack_vars()
77 thread->arch.k_stack_base = (thread->arch.priv_stack_start + in setup_stack_vars()
79 thread->arch.u_stack_top = thread->stack_info.start; in setup_stack_vars()
80 thread->arch.u_stack_base = (thread->stack_info.start + in setup_stack_vars()
81 thread->stack_info.size); in setup_stack_vars()
85 thread->arch.k_stack_top = (uint32_t)thread->stack_info.start; in setup_stack_vars()
86 thread->arch.k_stack_base = (uint32_t)(thread->stack_info.start + in setup_stack_vars()
87 thread->stack_info.size); in setup_stack_vars()
89 thread->arch.u_stack_top = 0; in setup_stack_vars()
90 thread->arch.u_stack_base = 0; in setup_stack_vars()
96 /* Get the initial stack frame pointer from the thread's stack buffer. */
102 /* Initial stack frame for a user thread is slightly larger; in get_iframe()
110 thread->arch.priv_stack_start + in get_iframe()
112 uframe->user_sp = (uint32_t)stack_ptr; in get_iframe()
113 return &uframe->iframe; in get_iframe()
120 * Pre-populate values in the registers inside _callee_saved_stack struct
121 * so these registers have pre-defined values when new thread begins
140 regs->TLSREG = thread->tls; in arch_setup_callee_saved_regs()
143 regs->r30 = thread->tls; in arch_setup_callee_saved_regs()
149 * The initial context is a basic stack frame that contains arguments for
161 /* Set up initial stack frame */ in arch_new_thread()
166 * mode sleep instructions, and it enables a form of denial-of-service in arch_new_thread()
171 iframe->status32 = _ARC_V2_STATUS32_US | _ARC_V2_STATUS32_DZ; in arch_new_thread()
173 iframe->pc = (uint32_t)z_user_thread_entry_wrapper; in arch_new_thread()
175 iframe->pc = (uint32_t)z_thread_entry_wrapper; in arch_new_thread()
178 iframe->status32 = _ARC_V2_STATUS32_DZ; in arch_new_thread()
179 iframe->pc = ((uintptr_t)z_thread_entry_wrapper); in arch_new_thread()
182 iframe->sec_stat = z_arc_v2_aux_reg_read(_ARC_V2_SEC_STAT); in arch_new_thread()
184 iframe->r0 = (uintptr_t)entry; in arch_new_thread()
185 iframe->r1 = (uintptr_t)p1; in arch_new_thread()
186 iframe->r2 = (uintptr_t)p2; in arch_new_thread()
187 iframe->r3 = (uintptr_t)p3; in arch_new_thread()
191 iframe->sec_stat |= _ARC_V2_SEC_STAT_SSC; in arch_new_thread()
193 iframe->status32 |= _ARC_V2_STATUS32_SC; in arch_new_thread()
197 iframe->status32 |= _ARC_V2_STATUS32_AD; in arch_new_thread()
200 thread->switch_handle = thread; in arch_new_thread()
201 thread->arch.relinquish_cause = _CAUSE_COOP; in arch_new_thread()
202 thread->callee_saved.sp = in arch_new_thread()
203 (uintptr_t)iframe - ___callee_saved_stack_t_SIZEOF; in arch_new_thread()
205 arch_setup_callee_saved_regs(thread, thread->callee_saved.sp); in arch_new_thread()
207 /* initial values in all other regs/k_thread entries are irrelevant */ in arch_new_thread()
237 (uint32_t)arch_current_thread()->stack_info.start, in arch_user_mode_enter()
238 (arch_current_thread()->stack_info.size - in arch_user_mode_enter()
239 arch_current_thread()->stack_info.delta), arch_current_thread()); in arch_user_mode_enter()
247 unsigned int key; in arch_float_disable() local
251 key = irq_lock(); in arch_float_disable()
254 thread->base.user_options &= ~K_FP_REGS; in arch_float_disable()
256 irq_unlock(key); in arch_float_disable()
264 unsigned int key; in arch_float_enable() local
268 key = irq_lock(); in arch_float_enable()
271 thread->base.user_options |= K_FP_REGS; in arch_float_enable()
273 irq_unlock(key); in arch_float_enable()
309 k_spinlock_key_t key = k_spin_lock(&lock); in arc_dsp_disable() local
312 thread->base.user_options &= ~(uint8_t)options; in arc_dsp_disable()
314 k_spin_unlock(&lock, key); in arc_dsp_disable()
320 k_spinlock_key_t key = k_spin_lock(&lock); in arc_dsp_enable() local
323 thread->base.user_options |= (uint8_t)options; in arc_dsp_enable()
325 k_spin_unlock(&lock, key); in arc_dsp_enable()
332 k_spinlock_key_t key; in arc_vpx_lock() local
335 key = k_spin_lock(&lock); in arc_vpx_lock()
337 id = _current_cpu->id; in arc_vpx_lock()
339 __ASSERT(!arch_is_in_isr() && (arch_current_thread()->base.cpu_mask == BIT(id)), ""); in arc_vpx_lock()
341 k_spin_unlock(&lock, key); in arc_vpx_lock()
353 k_spinlock_key_t key; in arc_vpx_unlock() local
356 key = k_spin_lock(&lock); in arc_vpx_unlock()
358 __ASSERT(!arch_is_in_isr() && (arch_current_thread()->base.cpu_mask == BIT(id)), ""); in arc_vpx_unlock()
360 id = _current_cpu->id; in arc_vpx_unlock()
361 k_spin_unlock(&lock, key); in arc_vpx_unlock()