mirror of
https://github.com/apache/nuttx.git
synced 2026-05-22 05:42:05 +08:00
Add low-level memory management hooks that will be needed to support brk() and sbrk()
This commit is contained in:
@@ -337,6 +337,39 @@ FAR void *mm_zalloc(FAR struct mm_heap_s *heap, size_t size);
|
||||
FAR void *mm_memalign(FAR struct mm_heap_s *heap, size_t alignment,
|
||||
size_t size);
|
||||
|
||||
/* Functions contained in mm_brkaddr.c **************************************/
|
||||
|
||||
FAR void *mm_brkaddr(FAR struct mm_heap_s *heap, int region);
|
||||
|
||||
/* Functions contained in umm_brkaddr.c *************************************/
|
||||
|
||||
#ifdef CONFIG_MM_USER_HEAP
|
||||
FAR void *umm_brkaddr(int region);
|
||||
#endif
|
||||
|
||||
/* Functions contained in kmm_brkaddr.c *************************************/
|
||||
|
||||
#ifdef CONFIG_MM_KERNEL_HEAP
|
||||
FAR void *umm_brkaddr(int region);
|
||||
#endif
|
||||
|
||||
/* Functions contained in mm_extend.c ***************************************/
|
||||
|
||||
void mm_extend(FAR struct mm_heap_s *heap, FAR void *mem, size_t size,
|
||||
int region);
|
||||
|
||||
/* Functions contained in umm_extend.c **************************************/
|
||||
|
||||
#ifdef CONFIG_MM_USER_HEAP
|
||||
void umm_extend(FAR void *mem, size_t size, int region);
|
||||
#endif
|
||||
|
||||
/* Functions contained in kmm_extend.c **************************************/
|
||||
|
||||
#ifdef CONFIG_MM_KERNEL_HEAP
|
||||
void kmm_extend(FAR void *mem, size_t size, int region);
|
||||
#endif
|
||||
|
||||
/* Functions contained in mm_mallinfo.c *************************************/
|
||||
|
||||
struct mallinfo; /* Forward reference */
|
||||
|
||||
+6
-6
@@ -53,21 +53,21 @@ endif
|
||||
ASRCS =
|
||||
CSRCS = mm_initialize.c mm_sem.c mm_addfreechunk.c mm_size2ndx.c
|
||||
CSRCS += mm_shrinkchunk.c
|
||||
CSRCS += mm_calloc.c mm_free.c mm_mallinfo.c mm_malloc.c mm_memalign.c
|
||||
CSRCS += mm_realloc.c mm_zalloc.c
|
||||
CSRCS += mm_brkaddr.c mm_calloc.c mm_extend.c mm_free.c mm_mallinfo.c
|
||||
CSRCS += mm_malloc.c mm_memalign.c mm_realloc.c mm_zalloc.c
|
||||
|
||||
# User allocator
|
||||
|
||||
CSRCS += umm_initialize.c umm_addregion.c umm_sem.c
|
||||
CSRCS += umm_calloc.c umm_free.c umm_mallinfo.c umm_malloc.c
|
||||
CSRCS += umm_memalign.c umm_realloc.c umm_zalloc.c
|
||||
CSRCS += umm_brkaddr.c umm_calloc.c umm_extend.c umm_free.c umm_mallinfo.c
|
||||
CSRCS += umm_malloc.c umm_memalign.c umm_realloc.c umm_zalloc.c
|
||||
|
||||
# Kernel allocator
|
||||
|
||||
ifeq ($(CONFIG_MM_KERNEL_HEAP),y)
|
||||
CSRCS += kmm_initialize.c kmm_addregion.c kmm_sem.c
|
||||
CSRCS += kmm_calloc.c kmm_free.c kmm_mallinfo.c kmm_malloc.c
|
||||
CSRCS += kmm_memalign.c kmm_realloc.c kmm_zalloc.c
|
||||
CSRCS += kmm_brkaddr.c kmm_calloc.c kmm_extend.c kmm_free.c kmm_mallinfo.c
|
||||
CSRCS += kmm_malloc.c kmm_memalign.c kmm_realloc.c kmm_zalloc.c
|
||||
ifeq ($(CONFIG_DEBUG),y)
|
||||
CSRCS += kmm_heapmember.c
|
||||
endif
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
/****************************************************************************
|
||||
* mm/kmm_breakaddr.c
|
||||
*
|
||||
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include <nuttx/mm.h>
|
||||
|
||||
#ifdef CONFIG_MM_KERNEL_HEAP
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: kmm_brkaddr
|
||||
*
|
||||
* Description:
|
||||
* Return the break address of a region in the user heap
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR void *kmm_brkaddr(int region)
|
||||
{
|
||||
return mm_brkaddr(&g_kmmheap, region);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_MM_KERNEL_HEAP */
|
||||
@@ -0,0 +1,68 @@
|
||||
/****************************************************************************
|
||||
* mm/kmm_extend.c
|
||||
*
|
||||
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <nuttx/mm.h>
|
||||
|
||||
#ifdef CONFIG_MM_KERNEL_HEAP
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: kmm_extend
|
||||
*
|
||||
* Description:
|
||||
* Extend a region in the kernel heap by add a block of (virtually)
|
||||
* contiguous memory to the end of the heap.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void kmm_extend(FAR void *mem, size_t size, int region)
|
||||
{
|
||||
mm_extend(&g_kmmheap, mem, size, region);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_MM_KERNEL_HEAP */
|
||||
@@ -0,0 +1,69 @@
|
||||
/****************************************************************************
|
||||
* mm/mm_brkaddr.c
|
||||
*
|
||||
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include <nuttx/mm.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mm_brkaddr
|
||||
*
|
||||
* Description:
|
||||
* Return the break address of a heap region
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR void *mm_brkaddr(FAR struct mm_heap_s *heap, int region)
|
||||
{
|
||||
uintptr_t brkaddr;
|
||||
DEBUGASSERT(heap && region < heap->mm_nregions);
|
||||
|
||||
brkaddr = (uintptr_t)heap->mm_heapend[region];
|
||||
return (FAR void *)(brkaddr + SIZEOF_MM_ALLOCNODE);
|
||||
}
|
||||
+123
@@ -0,0 +1,123 @@
|
||||
/****************************************************************************
|
||||
* mm/mm_extend.c
|
||||
*
|
||||
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include <nuttx/mm.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define MIN_EXTEND (2 * SIZEOF_MM_ALLOCNODE)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mm_extend
|
||||
*
|
||||
* Description:
|
||||
* Extend a heap region by add a block of (virtually) contiguous memory
|
||||
* to the end of the heap.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void mm_extend(FAR struct mm_heap_s *heap, FAR void *mem, size_t size,
|
||||
int region)
|
||||
{
|
||||
struct mm_allocnode_s *oldnode;
|
||||
struct mm_allocnode_s *newnode;
|
||||
uintptr_t blockstart;
|
||||
uintptr_t blockend;
|
||||
|
||||
/* Make sure that we were passed valid parameters */
|
||||
|
||||
DEBUGASSERT(heap && mem);
|
||||
DEBUGASSERT(size >= MIN_EXTEND && (unsigned)region < heap->mm_nregions);
|
||||
|
||||
/* Make sure that the memory region are properly aligned */
|
||||
|
||||
blockstart = (uintptr_t)mem;
|
||||
blockend = blockstart + size;
|
||||
|
||||
DEBUGASSERT(MM_ALIGN_UP(blockstart) == blockstart);
|
||||
DEBUGASSERT(MM_ALIGN_DOWN(blockend) == blockend);
|
||||
|
||||
/* Take the memory manager semaphore */
|
||||
|
||||
mm_takesemaphore(heap);
|
||||
|
||||
/* Get the terminal node in the old heap. The block to extend must
|
||||
* immediately follow this node.
|
||||
*/
|
||||
|
||||
oldnode = heap->mm_heapend[region];
|
||||
DEBUGASSERT((uintptr_t)oldnode + SIZEOF_MM_ALLOCNODE == (uintptr_t)mem);
|
||||
|
||||
/* The size of the old node now extends to the new terminal node.
|
||||
* This is the old size (SIZEOF_MM_ALLOCNODE) plus the size of
|
||||
* the block (size) minus the size of the new terminal node
|
||||
* (SIZEOF_MM_ALLOCNODE) or simply:
|
||||
*/
|
||||
|
||||
oldnode->size = size;
|
||||
|
||||
/* The old node should already be marked as allocated */
|
||||
|
||||
DEBUGASSERT((oldnode->preceding & MM_ALLOC_BIT) != 0);
|
||||
|
||||
/* Get and initialize the new terminal node in the heap */
|
||||
|
||||
newnode = (FAR struct mm_allocnode_s *)(blockend - SIZEOF_MM_ALLOCNODE);
|
||||
newnode->size = SIZEOF_MM_ALLOCNODE;
|
||||
newnode->preceding = oldnode->size | MM_ALLOC_BIT;
|
||||
|
||||
heap->mm_heapend[region] = newnode;
|
||||
mm_givesemaphore(heap);
|
||||
|
||||
/* Finally "free" the new block of memory where the old terminal node was
|
||||
* located.
|
||||
*/
|
||||
|
||||
mm_free(heap, (FAR void *)mem);
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/****************************************************************************
|
||||
* mm/umm_breakaddr.c
|
||||
*
|
||||
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include <nuttx/mm.h>
|
||||
|
||||
#ifdef CONFIG_MM_USER_HEAP
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: umm_brkaddr
|
||||
*
|
||||
* Description:
|
||||
* Return the break address of a region in the user heap
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR void *umm_brkaddr(int region)
|
||||
{
|
||||
return mm_brkaddr(&g_mmheap, region);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_MM_USER_HEAP */
|
||||
@@ -0,0 +1,68 @@
|
||||
/****************************************************************************
|
||||
* mm/umm_extend.c
|
||||
*
|
||||
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <nuttx/mm.h>
|
||||
|
||||
#ifdef CONFIG_MM_USER_HEAP
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: umm_extend
|
||||
*
|
||||
* Description:
|
||||
* Extend a region in the user heap by add a block of (virtually)
|
||||
* contiguous memory to the end of the heap.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void umm_extend(FAR void *mem, size_t size, int region)
|
||||
{
|
||||
mm_extend(&g_mmheap, mem, size, region);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_MM_USER_HEAP */
|
||||
Reference in New Issue
Block a user