summaryrefslogtreecommitdiff
path: root/nuttx/include/nuttx/kmalloc.h
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-09-02 11:22:09 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-09-02 11:22:09 -0600
commit70364682c1d59b7ac26548085cc8faa835086c02 (patch)
tree9d6b1584b65ed5dbc7896ad55d677c3540fdc115 /nuttx/include/nuttx/kmalloc.h
parent0c224f7e3dd878868fe921a5b41efe2362ce7fb6 (diff)
downloadnuttx-70364682c1d59b7ac26548085cc8faa835086c02.tar.gz
nuttx-70364682c1d59b7ac26548085cc8faa835086c02.tar.bz2
nuttx-70364682c1d59b7ac26548085cc8faa835086c02.zip
Restructuring of build to allow use of use-space allocators by kernel logic in the kernel build.
Diffstat (limited to 'nuttx/include/nuttx/kmalloc.h')
-rw-r--r--nuttx/include/nuttx/kmalloc.h31
1 files changed, 15 insertions, 16 deletions
diff --git a/nuttx/include/nuttx/kmalloc.h b/nuttx/include/nuttx/kmalloc.h
index ffe0340dc..68f8c7c7b 100644
--- a/nuttx/include/nuttx/kmalloc.h
+++ b/nuttx/include/nuttx/kmalloc.h
@@ -89,8 +89,21 @@ extern "C"
#define kumm_trysemaphore() umm_trysemaphore()
#define kumm_givesemaphore() umm_givesemaphore()
-#ifndef CONFIG_BUILD_PROTECTED
-/* In the flat build, the following are declared in stdlib.h and are
+#ifdef CONFIG_BUILD_PROTECTED
+/* In the kernel-phase of the protected build, the these macros are defined
+ * in userspace.h. These macros version call into user-space via a header
+ * at the beginning of the user-space blob.
+ */
+
+# define kumm_malloc(s) umm_malloc(s)
+# define kumm_zalloc(s) umm_zalloc(s)
+# define kumm_realloc(p,s) umm_realloc(p,s)
+# define kumm_memalign(a,s) umm_memalign(a,s)
+# define kumm_free(p) umm_free(p)
+
+#else
+/* In the flat build (CONFIG_BUILD_FLAT) and in the kernel build
+ * (CONFIG_BUILD_KERNEL), the following are declared in stdlib.h and are
* directly callable.
*/
@@ -100,18 +113,6 @@ extern "C"
# define kumm_memalign(a,s) memalign(a,s)
# define kumm_free(p) free(p)
-#else
-/* In the kernel-phase of the protected build, the these macros are defined
- * in userspace.h. These macros versions call into user-space via a header
- * at the beginning of the user-space blob.
- */
-
-# define kumm_malloc(s) umm_malloc(s)
-# define kumm_zalloc(s) umm_zalloc(s)
-# define kumm_realloc(p,s) umm_realloc(p,s)
-# define kumm_memalign(a,s) umm_memalign(a,s)
-# define kumm_free(p) umm_free(p)
-
#endif
/* This family of allocators is used to manage kernel protected memory */
@@ -164,9 +165,7 @@ extern "C"
* sched_garbagecollection().
*/
-#ifdef CONFIG_MM_USER_HEAP
void sched_ufree(FAR void *address);
-#endif
#if defined(CONFIG_MM_KERNEL_HEAP) && defined(__KERNEL__)
void sched_kfree(FAR void *address);