Skip to content

Commit 38195d5

Browse files
Andy Rossnashif
authored andcommitted
kernel/include: Put kernel stack memory in the right memory
The CONFIG_KERNEL_COHERENCE framework merged with a typo that left its validation asserts disabled. But it was written before the "kernel stacks" feature merged, and so missed the K_KERNEL_STACK_* macros, which need to put their stacks into __stackmem and not merely __noinit. Turning the asserts on exposed the bug. Fixes #32112 Signed-off-by: Andy Ross <[email protected]>
1 parent b8c33ef commit 38195d5

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

include/linker/section_tags.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@
4444
#if defined(CONFIG_KERNEL_COHERENCE)
4545
#define __incoherent __in_section_unique(cached)
4646
#define __stackmem __incoherent
47+
#define __kstackmem __stackmem
4748
#else
48-
#define __incoherent Z_GENERIC_SECTION(.user_stacks)
49-
#define __stackmem __incoherent
49+
#define __incoherent
50+
#define __stackmem Z_GENERIC_SECTION(.user_stacks)
51+
#define __kstackmem __noinit
5052
#endif /* CONFIG_KERNEL_COHERENCE */
5153

5254
#endif /* !_ASMLANGUAGE */

include/sys/thread_stack.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ static inline char *z_stack_ptr_align(char *ptr)
134134
* @param size Size of the stack memory region
135135
*/
136136
#define K_KERNEL_STACK_DEFINE(sym, size) \
137-
struct z_thread_stack_element __noinit \
137+
struct z_thread_stack_element __kstackmem \
138138
__aligned(Z_KERNEL_STACK_OBJ_ALIGN) \
139139
sym[Z_KERNEL_STACK_SIZE_ADJUST(size)]
140140

@@ -152,7 +152,7 @@ static inline char *z_stack_ptr_align(char *ptr)
152152
* @param size Size of the stack memory region
153153
*/
154154
#define K_KERNEL_STACK_ARRAY_DEFINE(sym, nmemb, size) \
155-
struct z_thread_stack_element __noinit \
155+
struct z_thread_stack_element __kstackmem \
156156
__aligned(Z_KERNEL_STACK_OBJ_ALIGN) \
157157
sym[nmemb][Z_KERNEL_STACK_LEN(size)]
158158

0 commit comments

Comments
 (0)