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 <Ioannis.Glaropoulos@nordicsemi.no>
diff --git a/include/linker/linker-defs.h b/include/linker/linker-defs.h
index f3a01fa..b28be9b 100644
--- a/include/linker/linker-defs.h
+++ b/include/linker/linker-defs.h
@@ -252,6 +252,17 @@
 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 6247a99..e275b19 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)