summaryrefslogtreecommitdiff
path: root/nuttx/mm/umm_extend.c
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-09-02 11:21:23 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-09-02 11:21:23 -0600
commit0c224f7e3dd878868fe921a5b41efe2362ce7fb6 (patch)
treeff432b46a6a217aa4bc58dee531ab70d1c7d29cd /nuttx/mm/umm_extend.c
parente33f20ad81548da27d8bf90a5889fc5f727d7cec (diff)
downloadpx4-nuttx-0c224f7e3dd878868fe921a5b41efe2362ce7fb6.tar.gz
px4-nuttx-0c224f7e3dd878868fe921a5b41efe2362ce7fb6.tar.bz2
px4-nuttx-0c224f7e3dd878868fe921a5b41efe2362ce7fb6.zip
Space at the beginning of the process data space is now reserved for user heap management structures. In the kernel build mode, these heap structures are shared between the kernel and use code in order to allocate user-specific data.
Diffstat (limited to 'nuttx/mm/umm_extend.c')
-rw-r--r--nuttx/mm/umm_extend.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/nuttx/mm/umm_extend.c b/nuttx/mm/umm_extend.c
index 6e16e56f8..6982ed813 100644
--- a/nuttx/mm/umm_extend.c
+++ b/nuttx/mm/umm_extend.c
@@ -41,12 +41,27 @@
#include <nuttx/mm.h>
-#ifdef CONFIG_MM_USER_HEAP
-
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
+#if defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_BUILD_KERNEL)
+/* In the kernel build, there a multiple user heaps; one for each task
+ * group. In this build configuration, the user heap structure lies
+ * in a reserved region at the beginning of the .bss/.data address
+ * space (CONFIG_ARCH_DATA_VBASE). The size of that region is given by
+ * ARCH_DATA_RESERVE
+ */
+
+# include <nuttx/addrenv.h>
+# define USR_HEAP ((FAR struct mm_heap_s *)CONFIG_ARCH_DATA_VBASE)
+
+#else
+/* Otherwise, the user heap data structures are in common .bss */
+
+# define USR_HEAP &g_mmheap;
+#endif
+
/****************************************************************************
* Public Functions
****************************************************************************/
@@ -62,7 +77,5 @@
void umm_extend(FAR void *mem, size_t size, int region)
{
- mm_extend(&g_mmheap, mem, size, region);
+ mm_extend(USR_HEAP, mem, size, region);
}
-
-#endif /* CONFIG_MM_USER_HEAP */