Lines Matching full:stack
50 /* prepare to set stack to privileged stack */
57 ldr r0, [r0, r1] /* priv stack ptr */
63 ldr r0, [r0, #_thread_offset_to_priv_stack_start] /* priv stack ptr */
67 ldr r0, [r0, #_thread_offset_to_priv_stack_start] /* priv stack ptr */
73 str r0, [ip, #_thread_offset_to_priv_stack_end] /* priv stack end */
76 /* store current stack pointer to ip
77 * the current stack pointer is needed to retrieve
85 /* set stack to privileged stack
88 * modifying PSP via MSR instruction is not subject to stack limit
90 * The operation is safe since, by design, the privileged stack is
91 * located in memory higher than the default (user) thread stack.
97 /* At this point the privileged stack is not yet protected by PSPLIM.
98 * Since we have just switched to the top of the privileged stack, we
99 * are safe, as long as the stack can accommodate the maximum exception
100 * stack frame.
103 /* set stack pointer limit to the start of the priv stack */
106 ldr r0, [r0, #_thread_offset_to_priv_stack_start] /* priv stack ptr */
110 /* push args to stack */
123 * z_arm_configure_dynamic_mpu_regions() may re-program the MPU Stack Guard
124 * to guard the privilege stack for overflows (if building with option
126 * stack while doing the re-programming. We minimize the risk by placing
127 * this function immediately after we have switched to the privileged stack
128 * so that the whole stack area is available for this critical operation.
131 * stack, since we do not control how much stack is actually left, when
141 /* load up stack info from user stack */
151 /* load up stack info from user stack */
158 /* clear the user stack area to clean out privileged data */
176 /* r0 contains user stack start, ip contains user stack size */
177 add r0, r0, ip /* calculate top of stack */
179 /* pop remaining arguments from stack before switching stacks */
193 * set stack to user stack. We are in SYSTEM state, so r13 and r14 are
200 * Guard the default (user) stack until thread drops privileges.
203 * PSPLIM is configured *before* PSP switches to the default (user) stack.
204 * This is safe, since the user stack is located, by design, in a lower
205 * memory area compared to the privileged stack.
208 * would re-configure PSPLIM to guard the privileged stack; we enforce
211 * Between PSPLIM update and PSP switch, the privileged stack will be
212 * left un-guarded; this is safe, as long as the privileged stack is
213 * large enough to accommodate a maximum exception stack frame.
225 /* Set PSPLIM to guard the thread's user stack. */
234 /* set stack to user stack */
281 /* ISB is not strictly necessary here (stack pointer is not being
311 * 2) Configuring privileged stack and loading up stack arguments
313 * 4) Restoring stack and calling back to the caller of the SVC
318 /* Note [when using MPU-based stack guarding]:
320 * shall not be allowed to use the thread's default unprivileged stack,
321 * (i.e push to or pop from it), to avoid a possible stack corruption.
324 * is guarding the end of the default stack, we won't be able
325 * to detect any stack overflows.
327 * Note [when using built-in stack limit checking on ARMv8-M]:
329 * stack, so pushing to the default thread's stack is safe.
332 /* save current stack pointer (user stack) */
334 /* temporarily push to user stack */
336 /* setup privileged stack */
340 ldr r0, [r0] /* priv stack ptr */
344 /* Store current SP and LR at the beginning of the priv stack */
351 /* Restore user stack and original r0, r1 */
355 /* setup privileged stack */
358 ldr ip, [ip, #_thread_offset_to_priv_stack_start] /* priv stack ptr */
361 /* Store current SP and LR at the beginning of the priv stack */
367 * The SVC handler has already switched to the privileged stack.
368 * Store the user SP and LR at the beginning of the priv stack.
377 /* switch to privileged stack */
381 /* Note (applies when using stack limit checking):
382 * We do not need to lock IRQs after switching PSP to the privileged stack;
383 * PSPLIM is guarding the default (user) stack, which, by design, is
385 * privileged stack we are safe, as long as the stack can accommodate
386 * the maximum exception stack frame.
390 /* Set stack pointer limit (needed in privileged mode) */
393 ldr ip, [ip, #_thread_offset_to_priv_stack_start] /* priv stack ptr */
411 /* fixup stack frame on the privileged stack, adding ssf */
421 /* push ssf to privileged stack */
424 /* push args to complete stack frame */
458 /* fixup stack frame on the privileged stack, adding ssf */
464 /* push args to complete stack frame */
484 * Guard the default (user) stack until thread drops privileges.
487 * PSPLIM is configured *before* PSP switches to the default (user) stack.
488 * This is safe, since the user stack is located, by design, in a lower
489 * memory area compared to the privileged stack.
492 * would re-configure PSPLIM to guard the privileged stack; we enforce
495 * Between PSPLIM update and PSP switch, the privileged stack will be
496 * left un-guarded; this is safe, as long as the privileged stack is
497 * large enough to accommodate a maximum exception stack frame.
508 /* Set PSPLIM to guard the thread's user stack. */
516 /* set stack back to unprivileged stack */
525 /* set stack back to unprivileged stack */
570 /* ISB is not strictly necessary here (stack pointer is not being
619 /* Restore user stack pointer */