Lines Matching +full:stack +full:- +full:size

4  * SPDX-License-Identifier: Apache-2.0
12 * included by the kernel interface architecture-abstraction header
24 #include "sys-io-common.h"
65 * - otherwise all interrupts will use same register bank. Such configuration isn't supported in
86 #error "Non-multithreading mode isn't supported on SMP targets"
110 * For regions that are NOT the minimum size, this define has no semantics
111 * on ARC MPUv2 as its regions must be power of two size and aligned to their
112 * own size. On ARC MPUv4, region sizes are arbitrary and this just indicates
113 * the required size granularity.
132 /* Kernel-only stacks have the following layout if a stack guard is enabled:
134 * +------------+ <- thread.stack_obj
136 * +------------+ <- thread.stack_info.start
138 * | stack |
142 * +------------+ <- thread.stack_info.start + thread.stack_info.size
153 * Thread-local storage is at the very highest memory locations of this area.
154 * Memory for TLS and any initial random stack pointer offset is captured
159 * the stack object will contain the MPU guard, the privilege stack, and then
160 * the stack buffer in that order:
162 * +------------+ <- thread.stack_obj
164 * +------------+ <- thread.arch.priv_stack_start
165 * | Priv Stack | } CONFIG_PRIVILEGED_STACK_SIZE
166 * +------------+ <- thread.stack_info.start
168 * | stack |
172 * +------------+ <- thread.stack_info.start + thread.stack_info.size
176 #define ARCH_THREAD_STACK_OBJ_ALIGN(size) Z_ARC_MPU_ALIGN argument
177 /* We need to be able to exactly cover the stack buffer with an MPU region,
178 * so round its size up to the required granularity of the MPU
180 #define ARCH_THREAD_STACK_SIZE_ADJUST(size) \ argument
181 (ROUND_UP((size), Z_ARC_MPU_ALIGN))
183 "improper privilege stack size");
185 /* Userspace enabled, but supervisor stack guards are not in use */
187 /* Use defaults for everything. The privilege elevation stack is located
190 * +------------+ <- thread.arch.priv_stack_start
191 * | Priv Stack | } K_KERNEL_STACK_LEN(CONFIG_PRIVILEGED_STACK_SIZE)
192 * +------------+
194 * +------------+ <- thread.stack_obj = thread.stack_info.start
196 * | stack |
200 * +------------+ <- thread.stack_info.start + thread.stack_info.size
202 #define ARCH_THREAD_STACK_SIZE_ADJUST(size) \ argument
203 Z_POW2_CEIL(ROUND_UP((size), Z_ARC_MPU_ALIGN))
204 #define ARCH_THREAD_STACK_OBJ_ALIGN(size) \ argument
205 ARCH_THREAD_STACK_SIZE_ADJUST(size)
208 /* Reserved area of the thread object just contains the privilege stack:
210 * +------------+ <- thread.stack_obj = thread.arch.priv_stack_start
211 * | Priv Stack | } CONFIG_PRIVILEGED_STACK_SIZE
212 * +------------+ <- thread.stack_info.start
214 * | stack |
218 * +------------+ <- thread.stack_info.start + thread.stack_info.size
221 #define ARCH_THREAD_STACK_SIZE_ADJUST(size) \ argument
222 (ROUND_UP((size), Z_ARC_MPU_ALIGN))
223 #define ARCH_THREAD_STACK_OBJ_ALIGN(size) Z_ARC_MPU_ALIGN argument
226 "improper privilege stack size");
233 /* Only supported on ARC MPU V3 and higher. Reserve some memory for the stack
234 * guard. This is just a minimally-sized region at the beginning of the stack
237 * +------------+ <- thread.stack_obj
239 * +------------+ <- thread.stack_info.start
241 * | stack |
245 * +------------+ <- thread.stack_info.start + thread.stack_info.size
248 #define ARCH_THREAD_STACK_OBJ_ALIGN(size) Z_ARC_MPU_ALIGN argument
251 /* No stack guard, no userspace, Use defaults for everything. */
269 /* Execution-allowed attributes */
299 * BUILD_ASSERT in case of MWDT is a bit more picky in performing compile-time check.
307 #define _ARCH_MEM_PARTITION_ALIGN_CHECK(start, size) \ argument
308 BUILD_ASSERT(IS_BUILTIN_MWDT(size) ? !((size) & ((size) - 1)) : 1, \
309 "partition size must be power of 2"); \
310 BUILD_ASSERT(IS_BUILTIN_MWDT(size) ? (size) >= Z_ARC_MPU_ALIGN : 1, \
311 "partition size must be >= mpu address alignment."); \
312 BUILD_ASSERT(IS_BUILTIN_MWDT(size) ? IS_BUILTIN_MWDT(start) ? \
313 !((uintptr_t)(start) & ((size) - 1)) : 1 : 1, \
314 "partition start address must align with size.")
316 #define _ARCH_MEM_PARTITION_ALIGN_CHECK(start, size) \ argument
317 BUILD_ASSERT(IS_BUILTIN_MWDT(size) ? (size) % Z_ARC_MPU_ALIGN == 0 : 1, \
318 "partition size must align with " STRINGIFY(Z_ARC_MPU_ALIGN)); \
319 BUILD_ASSERT(IS_BUILTIN_MWDT(size) ? (size) >= Z_ARC_MPU_ALIGN : 1, \
320 "partition size must be >= " STRINGIFY(Z_ARC_MPU_ALIGN)); \
326 #define _ARCH_MEM_PARTITION_ALIGN_CHECK(start, size) \ argument
327 BUILD_ASSERT(!((size) & ((size) - 1)), \
328 "partition size must be power of 2"); \
329 BUILD_ASSERT((size) >= Z_ARC_MPU_ALIGN, \
330 "partition size must be >= mpu address alignment."); \
331 BUILD_ASSERT(!((uintptr_t)(start) & ((size) - 1)), \
332 "partition start address must align with size.")
334 #define _ARCH_MEM_PARTITION_ALIGN_CHECK(start, size) \ argument
335 BUILD_ASSERT((size) % Z_ARC_MPU_ALIGN == 0, \
336 "partition size must align with " STRINGIFY(Z_ARC_MPU_ALIGN)); \
337 BUILD_ASSERT((size) >= Z_ARC_MPU_ALIGN, \
338 "partition size must be >= " STRINGIFY(Z_ARC_MPU_ALIGN)); \