From f15c12d482a9aa1c95daf6ad15c631e78b6a88ad Mon Sep 17 00:00:00 2001 From: Ioannis Glaropoulos Date: Fri, 14 Jun 2019 09:08:11 +0200 Subject: [PATCH] arch: arm: expose start/end limits of the thread priv stack section We introduce linker symbols to hold the start and end address of the memory area holding the thread privilege stack buffers, applicable when building with support for User Mode. Signed-off-by: Ioannis Glaropoulos --- include/linker/linker-defs.h | 11 +++++++++++ include/linker/priv_stacks-noinit.ld | 2 ++ 2 files changed, 13 insertions(+) diff --git a/include/linker/linker-defs.h b/include/linker/linker-defs.h index f3a01fa469b..b28be9b4670 100644 --- a/include/linker/linker-defs.h +++ b/include/linker/linker-defs.h @@ -252,6 +252,17 @@ extern char _ramfunc_ram_size[]; extern char _ramfunc_rom_start[]; #endif /* CONFIG_ARCH_HAS_RAMFUNC_SUPPORT */ +/* Memory owned by the kernel. Memory region for thread privilege stack buffers, + * currently only applicable on ARM Cortex-M architecture when building with + * support for User Mode. + * + * All thread privilege stack buffers will be placed into this section. + */ +#ifdef CONFIG_USERSPACE +extern char z_priv_stacks_ram_start[]; +extern char z_priv_stacks_ram_end[]; +#endif /* CONFIG_USERSPACE */ + #endif /* ! _ASMLANGUAGE */ #endif /* ZEPHYR_INCLUDE_LINKER_LINKER_DEFS_H_ */ diff --git a/include/linker/priv_stacks-noinit.ld b/include/linker/priv_stacks-noinit.ld index 6247a99a1d7..e275b194c9c 100644 --- a/include/linker/priv_stacks-noinit.ld +++ b/include/linker/priv_stacks-noinit.ld @@ -6,5 +6,7 @@ SECTION_DATA_PROLOGUE(priv_stacks_noinit,,) { + z_priv_stacks_ram_start = .; *(".priv_stacks.noinit") + z_priv_stacks_ram_end = .; } GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)