summaryrefslogtreecommitdiff
path: root/nuttx/include/nuttx/kmalloc.h
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-09-03 14:58:24 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-09-03 14:58:24 -0600
commitc6e48b65d0729bc4fffbf57dac4fb8c97a35fd63 (patch)
tree8704f2481d566dd90cc40d89e8753381d4589521 /nuttx/include/nuttx/kmalloc.h
parentffa0635358e2080f6608ec41e172e4ba0873f91a (diff)
downloadnuttx-c6e48b65d0729bc4fffbf57dac4fb8c97a35fd63.tar.gz
nuttx-c6e48b65d0729bc4fffbf57dac4fb8c97a35fd63.tar.bz2
nuttx-c6e48b65d0729bc4fffbf57dac4fb8c97a35fd63.zip
Fix more places where the user-mode allocator is used to allocate kernel thread resources -- before the user-mode allocator even exists
Diffstat (limited to 'nuttx/include/nuttx/kmalloc.h')
-rw-r--r--nuttx/include/nuttx/kmalloc.h37
1 files changed, 36 insertions, 1 deletions
diff --git a/nuttx/include/nuttx/kmalloc.h b/nuttx/include/nuttx/kmalloc.h
index 68f8c7c7b..33b3b8910 100644
--- a/nuttx/include/nuttx/kmalloc.h
+++ b/nuttx/include/nuttx/kmalloc.h
@@ -81,7 +81,7 @@ extern "C"
* from the kernel. In the flat build, the following are declared in
* stdlib.h and are directly callable. In the kernel-phase of the kernel
* build, the following are defined in userspace.h as macros that call
- * into user-space via a header at the begining of the user-space blob.
+ * into user-space via a header at the beginning of the user-space blob.
*/
#define kumm_initialize(h,s) umm_initialize(h,s)
@@ -157,6 +157,41 @@ extern "C"
#endif
+#if (defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)) && \
+ defined(CONFIG_MM_KERNEL_HEAP)
+/****************************************************************************
+ * Group memory management
+ *
+ * Manage memory allocations appropriately for the group type. If the
+ * memory is part of a privileged group, then it should be allocated so
+ * that it is only accessible by privileged code; Otherwise, it is a
+ * user mode group and must be allocated so that it accessible by
+ * unprivileged code.
+ *
+ ****************************************************************************/
+/* Functions defined in group/group_malloc.c ********************************/
+
+FAR void *group_malloc(FAR struct task_group_s *group, size_t nbytes);
+
+/* Functions defined in group/group_zalloc.c ********************************/
+
+FAR void *group_zalloc(FAR struct task_group_s *group, size_t nbytes);
+
+/* Functions defined in group/group_free.c **********************************/
+
+void group_free(FAR struct task_group_s *group, FAR void *mem);
+
+#else
+ /* In the flat build, there is only one memory allocator and no distinction
+ * in privileges.
+ */
+
+# define group_malloc(g,n) kumm_malloc(size)
+# define group_zalloc(g,n) kumm_zalloc(size)
+# define group_free(g,m) kumm_free(size)
+
+#endif
+
/* Functions defined in sched/sched_kfree.c **********************************/
/* Handles memory freed from an interrupt handler. In that context, kmm_free()