diff options
Diffstat (limited to 'nuttx')
-rw-r--r-- | nuttx/arch/arm/src/armv7-a/arm_pgalloc.c | 6 | ||||
-rw-r--r-- | nuttx/include/nuttx/mm.h | 14 | ||||
-rw-r--r-- | nuttx/mm/kmm_heapmember.c | 4 | ||||
-rw-r--r-- | nuttx/mm/mm_brkaddr.c | 4 | ||||
-rw-r--r-- | nuttx/mm/mm_extend.c | 4 | ||||
-rw-r--r-- | nuttx/mm/umm_addregion.c | 4 | ||||
-rw-r--r-- | nuttx/mm/umm_brkaddr.c | 4 | ||||
-rw-r--r-- | nuttx/mm/umm_calloc.c | 4 | ||||
-rw-r--r-- | nuttx/mm/umm_extend.c | 4 | ||||
-rw-r--r-- | nuttx/mm/umm_free.c | 4 | ||||
-rw-r--r-- | nuttx/mm/umm_initialize.c | 4 | ||||
-rw-r--r-- | nuttx/mm/umm_mallinfo.c | 3 | ||||
-rw-r--r-- | nuttx/mm/umm_malloc.c | 4 | ||||
-rw-r--r-- | nuttx/mm/umm_memalign.c | 4 | ||||
-rw-r--r-- | nuttx/mm/umm_realloc.c | 4 | ||||
-rw-r--r-- | nuttx/mm/umm_sbrk.c | 5 | ||||
-rw-r--r-- | nuttx/mm/umm_sem.c | 4 | ||||
-rw-r--r-- | nuttx/mm/umm_zalloc.c | 4 |
18 files changed, 71 insertions, 13 deletions
diff --git a/nuttx/arch/arm/src/armv7-a/arm_pgalloc.c b/nuttx/arch/arm/src/armv7-a/arm_pgalloc.c index e58c20cd0..4dc2020f3 100644 --- a/nuttx/arch/arm/src/armv7-a/arm_pgalloc.c +++ b/nuttx/arch/arm/src/armv7-a/arm_pgalloc.c @@ -133,7 +133,7 @@ static int get_pgtable(FAR group_addrenv_t *addrenv, uintptr_t vaddr) * region as part of the implementation of user sbrk(). */ - DEBUGASSERT(vadddr >= CONFIG_ARCH_HEAP_VBASE && vaddr < ARCH_HEAP_VEND); + DEBUGASSERT(vaddr >= CONFIG_ARCH_HEAP_VBASE && vaddr < ARCH_HEAP_VEND); /* Get the current level 1 entry corresponding to this vaddr */ @@ -222,7 +222,7 @@ uintptr_t pgalloc(uintptr_t brkaddr, unsigned int npages) * space and (2) extending the kernel memory regions as well. */ - DEBUGASSERT((group->flags & GROUP_FLAG_ADDRENV) != 0); + DEBUGASSERT((group->tg_flags & GROUP_FLAG_ADDRENV) != 0); /* brkaddr = 0 means that no heap has yet been allocated */ @@ -231,7 +231,7 @@ uintptr_t pgalloc(uintptr_t brkaddr, unsigned int npages) brkaddr = CONFIG_ARCH_HEAP_VBASE; } - DEBUGASSERT(vadddr >= CONFIG_ARCH_HEAP_VBASE && brkaddr < ARCH_HEAP_VEND); + DEBUGASSERT(brkaddr >= CONFIG_ARCH_HEAP_VBASE && brkaddr < ARCH_HEAP_VEND); DEBUGASSERT(MM_ISALIGNED(brkaddr)); for (; npages > 0; npages--) diff --git a/nuttx/include/nuttx/mm.h b/nuttx/include/nuttx/mm.h index 2dc6e1961..3330b2bfc 100644 --- a/nuttx/include/nuttx/mm.h +++ b/nuttx/include/nuttx/mm.h @@ -43,6 +43,7 @@ #include <nuttx/config.h> #include <sys/types.h> +#include <stdbool.h> #include <semaphore.h> /**************************************************************************** @@ -262,8 +263,7 @@ extern "C" #define EXTERN extern #endif -#if (!defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_BUILD_KERNEL)) || \ - (defined(CONFIG_BUILD_PROTECTED) && !defined(__KERNEL__)) +#if !defined(CONFIG_BUILD_PROTECTED) || !defined(__KERNEL__) /* User heap structure: * * - Flat build: In the FLAT build, the user heap structure is a globally @@ -297,7 +297,7 @@ void mm_addregion(FAR struct mm_heap_s *heap, FAR void *heapstart, /* Functions contained in umm_initialize.c **********************************/ -#ifdef MM_KERNEL_USRHEAP_INIT +#if !defined(CONFIG_BUILD_PROTECTED) || !defined(__KERNEL__) void umm_initialize(FAR void *heap_start, size_t heap_size); #endif @@ -309,7 +309,7 @@ void kmm_initialize(FAR void *heap_start, size_t heap_size); /* Functions contained in umm_addregion.c ***********************************/ -#ifdef MM_KERNEL_USRHEAP_INIT +#if !defined(CONFIG_BUILD_PROTECTED) || !defined(__KERNEL__) void umm_addregion(FAR void *heapstart, size_t heapsize); #endif @@ -328,8 +328,10 @@ void mm_givesemaphore(FAR struct mm_heap_s *heap); /* Functions contained in umm_sem.c ****************************************/ +#if !defined(CONFIG_BUILD_PROTECTED) || !defined(__KERNEL__) int umm_trysemaphore(void); void umm_givesemaphore(void); +#endif /* Functions contained in kmm_sem.c ****************************************/ @@ -412,7 +414,9 @@ FAR void *mm_brkaddr(FAR struct mm_heap_s *heap, int region); /* Functions contained in umm_brkaddr.c *************************************/ +#if !defined(CONFIG_BUILD_PROTECTED) || !defined(__KERNEL__) FAR void *umm_brkaddr(int region); +#endif /* Functions contained in kmm_brkaddr.c *************************************/ @@ -442,7 +446,9 @@ void mm_extend(FAR struct mm_heap_s *heap, FAR void *mem, size_t size, /* Functions contained in umm_extend.c **************************************/ +#if !defined(CONFIG_BUILD_PROTECTED) || !defined(__KERNEL__) void umm_extend(FAR void *mem, size_t size, int region); +#endif /* Functions contained in kmm_extend.c **************************************/ diff --git a/nuttx/mm/kmm_heapmember.c b/nuttx/mm/kmm_heapmember.c index 01fa8b53c..a91a6a667 100644 --- a/nuttx/mm/kmm_heapmember.c +++ b/nuttx/mm/kmm_heapmember.c @@ -39,6 +39,10 @@ #include <nuttx/config.h> +#include <stdbool.h> + +#include <nuttx/mm.h> + #if defined(CONFIG_MM_KERNEL_HEAP) && defined(CONFIG_DEBUG) /************************************************************************ diff --git a/nuttx/mm/mm_brkaddr.c b/nuttx/mm/mm_brkaddr.c index 693b81086..8476050c4 100644 --- a/nuttx/mm/mm_brkaddr.c +++ b/nuttx/mm/mm_brkaddr.c @@ -63,7 +63,11 @@ FAR void *mm_brkaddr(FAR struct mm_heap_s *heap, int region) { uintptr_t brkaddr; +#if CONFIG_MM_REGIONS > 1 DEBUGASSERT(heap && region < heap->mm_nregions); +#else + DEBUGASSERT(heap && region == 0); +#endif brkaddr = (uintptr_t)heap->mm_heapend[region]; return brkaddr ? (FAR void *)(brkaddr + SIZEOF_MM_ALLOCNODE) : 0; diff --git a/nuttx/mm/mm_extend.c b/nuttx/mm/mm_extend.c index 3aa3f37d7..834360760 100644 --- a/nuttx/mm/mm_extend.c +++ b/nuttx/mm/mm_extend.c @@ -73,7 +73,11 @@ void mm_extend(FAR struct mm_heap_s *heap, FAR void *mem, size_t size, /* Make sure that we were passed valid parameters */ DEBUGASSERT(heap && mem); +#if CONFIG_MM_REGIONS > 1 DEBUGASSERT(size >= MIN_EXTEND && (unsigned)region < heap->mm_nregions); +#else + DEBUGASSERT(size >= MIN_EXTEND && (unsigned)region == 0); +#endif /* Make sure that the memory region are properly aligned */ diff --git a/nuttx/mm/umm_addregion.c b/nuttx/mm/umm_addregion.c index 22a03cb8a..5cef04b01 100644 --- a/nuttx/mm/umm_addregion.c +++ b/nuttx/mm/umm_addregion.c @@ -41,7 +41,7 @@ #include <nuttx/mm.h> -#ifdef MM_KERNEL_USRHEAP_INIT +#if !defined(CONFIG_BUILD_PROTECTED) || !defined(__KERNEL__) /************************************************************************ * Pre-processor definition @@ -102,4 +102,4 @@ void umm_addregion(FAR void *heap_start, size_t heap_size) mm_addregion(USR_HEAP, heap_start, heap_size); } -#endif /* MM_KERNEL_USRHEAP_INIT */ +#endif /* !CONFIG_BUILD_PROTECTED || !__KERNEL__ */ diff --git a/nuttx/mm/umm_brkaddr.c b/nuttx/mm/umm_brkaddr.c index 6381d368b..25e399542 100644 --- a/nuttx/mm/umm_brkaddr.c +++ b/nuttx/mm/umm_brkaddr.c @@ -43,6 +43,8 @@ #include <nuttx/mm.h> +#if !defined(CONFIG_BUILD_PROTECTED) || !defined(__KERNEL__) + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -80,3 +82,5 @@ FAR void *umm_brkaddr(int region) { return mm_brkaddr(USR_HEAP, region); } + +#endif /* !CONFIG_BUILD_PROTECTED || !__KERNEL__ */ diff --git a/nuttx/mm/umm_calloc.c b/nuttx/mm/umm_calloc.c index 0009b5a1f..ed1a2d606 100644 --- a/nuttx/mm/umm_calloc.c +++ b/nuttx/mm/umm_calloc.c @@ -43,6 +43,8 @@ #include <nuttx/mm.h> +#if !defined(CONFIG_BUILD_PROTECTED) || !defined(__KERNEL__) + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -80,3 +82,5 @@ FAR void *calloc(size_t n, size_t elem_size) { return mm_calloc(USR_HEAP, n, elem_size); } + +#endif /* !CONFIG_BUILD_PROTECTED || !__KERNEL__ */ diff --git a/nuttx/mm/umm_extend.c b/nuttx/mm/umm_extend.c index f8edc9ef6..af1bb18d3 100644 --- a/nuttx/mm/umm_extend.c +++ b/nuttx/mm/umm_extend.c @@ -41,6 +41,8 @@ #include <nuttx/mm.h> +#if !defined(CONFIG_BUILD_PROTECTED) || !defined(__KERNEL__) + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -79,3 +81,5 @@ void umm_extend(FAR void *mem, size_t size, int region) { mm_extend(USR_HEAP, mem, size, region); } + +#endif /* !CONFIG_BUILD_PROTECTED || !__KERNEL__ */ diff --git a/nuttx/mm/umm_free.c b/nuttx/mm/umm_free.c index d26d7ba11..6c6d59be7 100644 --- a/nuttx/mm/umm_free.c +++ b/nuttx/mm/umm_free.c @@ -43,6 +43,8 @@ #include <nuttx/mm.h> +#if !defined(CONFIG_BUILD_PROTECTED) || !defined(__KERNEL__) + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -85,3 +87,5 @@ void free(FAR void *mem) { mm_free(USR_HEAP, mem); } + +#endif /* !CONFIG_BUILD_PROTECTED || !__KERNEL__ */ diff --git a/nuttx/mm/umm_initialize.c b/nuttx/mm/umm_initialize.c index 5b926504d..d7288e474 100644 --- a/nuttx/mm/umm_initialize.c +++ b/nuttx/mm/umm_initialize.c @@ -43,7 +43,7 @@ #include <nuttx/mm.h> -#ifdef MM_KERNEL_USRHEAP_INIT +#if !defined(CONFIG_BUILD_PROTECTED) || !defined(__KERNEL__) /************************************************************************ * Pre-processor definition @@ -109,4 +109,4 @@ void umm_initialize(FAR void *heap_start, size_t heap_size) mm_initialize(USR_HEAP, heap_start, heap_size); } -#endif /* MM_KERNEL_USRHEAP_INIT */ +#endif /* !CONFIG_BUILD_PROTECTED || !__KERNEL__ */ diff --git a/nuttx/mm/umm_mallinfo.c b/nuttx/mm/umm_mallinfo.c index 447269f00..c7ea241c0 100644 --- a/nuttx/mm/umm_mallinfo.c +++ b/nuttx/mm/umm_mallinfo.c @@ -43,6 +43,8 @@ #include <nuttx/mm.h> +#if !defined(CONFIG_BUILD_PROTECTED) || !defined(__KERNEL__) + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -102,3 +104,4 @@ int mallinfo(struct mallinfo *info) } #endif /* CONFIG_CAN_PASS_STRUCTS */ +#endif /* !CONFIG_BUILD_PROTECTED || !__KERNEL__ */ diff --git a/nuttx/mm/umm_malloc.c b/nuttx/mm/umm_malloc.c index fd4fe9608..31511b82f 100644 --- a/nuttx/mm/umm_malloc.c +++ b/nuttx/mm/umm_malloc.c @@ -44,6 +44,8 @@ #include <nuttx/mm.h> +#if !defined(CONFIG_BUILD_PROTECTED) || !defined(__KERNEL__) + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -135,3 +137,5 @@ FAR void *malloc(size_t size) return mm_malloc(USR_HEAP, size); #endif } + +#endif /* !CONFIG_BUILD_PROTECTED || !__KERNEL__ */ diff --git a/nuttx/mm/umm_memalign.c b/nuttx/mm/umm_memalign.c index 51b0f923c..3659606f3 100644 --- a/nuttx/mm/umm_memalign.c +++ b/nuttx/mm/umm_memalign.c @@ -43,6 +43,8 @@ #include <nuttx/mm.h> +#if !defined(CONFIG_BUILD_PROTECTED) || !defined(__KERNEL__) + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -89,3 +91,5 @@ FAR void *memalign(size_t alignment, size_t size) { return mm_memalign(USR_HEAP, alignment, size); } + +#endif /* !CONFIG_BUILD_PROTECTED || !__KERNEL__ */ diff --git a/nuttx/mm/umm_realloc.c b/nuttx/mm/umm_realloc.c index 344d24d68..45da6e7ec 100644 --- a/nuttx/mm/umm_realloc.c +++ b/nuttx/mm/umm_realloc.c @@ -43,6 +43,8 @@ #include <nuttx/mm.h> +#if !defined(CONFIG_BUILD_PROTECTED) || !defined(__KERNEL__) + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -91,3 +93,5 @@ FAR void *realloc(FAR void *oldmem, size_t size) { return mm_realloc(USR_HEAP, oldmem, size); } + +#endif /* !CONFIG_BUILD_PROTECTED || !__KERNEL__ */ diff --git a/nuttx/mm/umm_sbrk.c b/nuttx/mm/umm_sbrk.c index 349c61b86..19b945d3c 100644 --- a/nuttx/mm/umm_sbrk.c +++ b/nuttx/mm/umm_sbrk.c @@ -45,7 +45,8 @@ #include <nuttx/pgalloc.h> #if defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_MM_PGALLOC) && \ - defined(CONFIG_ARCH_USE_MMU) + defined(CONFIG_ARCH_USE_MMU) && (!defined(CONFIG_BUILD_PROTECTED) || \ + !defined(__KERNEL__)) /**************************************************************************** * Pre-processor Definitions @@ -109,4 +110,4 @@ FAR void *sbrk(intptr_t incr) return mm_sbrk(USR_HEAP, incr, CONFIG_ARCH_STACK_NPAGES << MM_PGSHIFT); } -#endif /* CONFIG_ARCH_ADDRENV && CONFIG_MM_PGALLOC && CONFIG_ARCH_USE_MMU */ +#endif /* CONFIG_ARCH_ADDRENV && CONFIG_MM_PGALLOC && ... */ diff --git a/nuttx/mm/umm_sem.c b/nuttx/mm/umm_sem.c index 8e899994b..baa992ebb 100644 --- a/nuttx/mm/umm_sem.c +++ b/nuttx/mm/umm_sem.c @@ -41,6 +41,8 @@ #include <nuttx/mm.h> +#if !defined(CONFIG_BUILD_PROTECTED) || !defined(__KERNEL__) + /************************************************************************ * Pre-processor definition ************************************************************************/ @@ -119,3 +121,5 @@ void umm_givesemaphore(void) { mm_givesemaphore(USR_HEAP); } + +#endif /* !CONFIG_BUILD_PROTECTED || !__KERNEL__ */ diff --git a/nuttx/mm/umm_zalloc.c b/nuttx/mm/umm_zalloc.c index 20a37c2e2..06d9d1047 100644 --- a/nuttx/mm/umm_zalloc.c +++ b/nuttx/mm/umm_zalloc.c @@ -44,6 +44,8 @@ #include <nuttx/mm.h> +#if !defined(CONFIG_BUILD_PROTECTED) || !defined(__KERNEL__) + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -102,3 +104,5 @@ FAR void *zalloc(size_t size) return mm_zalloc(USR_HEAP, size); #endif } + +#endif /* !CONFIG_BUILD_PROTECTED || !__KERNEL__ */ |