Lines Matching +full:execution +full:- +full:memory
4 * SPDX-License-Identifier: Apache-2.0
9 * @brief New thread creation for ARM64 Cortex-A
11 * Core thread related primitives for the ARM64 Cortex-A
23 * - kernel threads are running in EL1 using SP_EL1 as stack pointer during
24 * normal execution and during exceptions. They are by definition already
27 * - user threads are running in EL0 using SP_EL0 as stack pointer during
28 * normal execution. When at exception is taken or a syscall is called the
29 * stack pointer switches to SP_EL1 and the execution starts using the
33 * - a stack guard region will be added bellow the kernel stack when
43 * High memory addresses
45 * +---------------+ <- stack_ptr
47 * L |<<<<<<<<<<<<<<<| <- SP_EL1
49 * +---------------+ <- stack limit
51 * +---------------+ <- stack_obj
53 * Low Memory addresses
58 * High memory addresses
60 * +---------------+ <- stack_ptr
62 * L |<<<<<<<<<<<<<<<| <- SP_EL0
64 * +---------------+ ..............|
66 * L +>>>>>>>>>>>>>>>+ <- SP_EL1 |_ used during exceptions and syscalls
68 * +---------------+ <- stack limit|
70 * +---------------+ <- stack_obj
72 * Low Memory addresses
81 return (thread->base.user_options & K_USER) != 0; in is_user()
93 * Clean the thread->arch to avoid unexpected behavior because the in arch_new_thread()
94 * thread->arch might be dirty in arch_new_thread()
96 memset(&thread->arch, 0, sizeof(thread->arch)); in arch_new_thread()
107 pInitCtx->x0 = (uint64_t)entry; in arch_new_thread()
108 pInitCtx->x1 = (uint64_t)p1; in arch_new_thread()
109 pInitCtx->x2 = (uint64_t)p2; in arch_new_thread()
110 pInitCtx->x3 = (uint64_t)p3; in arch_new_thread()
113 * - ELR_ELn: to be used by eret in z_arm64_exit_exc() to return in arch_new_thread()
116 * - SPSR_ELn: to enable IRQs (we are masking FIQs). in arch_new_thread()
124 pInitCtx->elr = (uint64_t)arch_user_mode_enter; in arch_new_thread()
126 pInitCtx->elr = (uint64_t)z_thread_entry; in arch_new_thread()
130 pInitCtx->elr = (uint64_t)z_thread_entry; in arch_new_thread()
134 pInitCtx->spsr = SPSR_MODE_EL1H | DAIF_FIQ_BIT; in arch_new_thread()
137 thread->arch.exception_depth = 1; in arch_new_thread()
144 thread->callee_saved.sp_elx = (uint64_t)pInitCtx; in arch_new_thread()
145 thread->callee_saved.lr = (uint64_t)z_arm64_exit_exc; in arch_new_thread()
147 thread->switch_handle = thread; in arch_new_thread()
149 thread->arch.stack_limit = (uint64_t)stack + Z_ARM64_STACK_GUARD_SIZE; in arch_new_thread()
165 stack_el0 = Z_STACK_PTR_ALIGN(arch_current_thread()->stack_info.start + in arch_user_mode_enter()
166 arch_current_thread()->stack_info.size - in arch_user_mode_enter()
167 arch_current_thread()->stack_info.delta); in arch_user_mode_enter()
169 /* Top of the privileged non-user-accessible part of the stack */ in arch_user_mode_enter()
170 stack_el1 = (uintptr_t)(arch_current_thread()->stack_obj + ARCH_THREAD_STACK_RESERVED); in arch_user_mode_enter()
197 : "memory"); in arch_user_mode_enter()