diff options
-rw-r--r-- | nuttx/arch/sim/src/up_deviceimage.c | 6 | ||||
-rw-r--r-- | nuttx/binfmt/libelf/libelf_iobuffer.c | 2 | ||||
-rw-r--r-- | nuttx/drivers/usbdev/usbmsc.c | 2 | ||||
-rw-r--r-- | nuttx/drivers/wireless/cc3000/cc3000.c | 2 | ||||
-rw-r--r-- | nuttx/fs/mmap/fs_munmap.c | 4 | ||||
-rw-r--r-- | nuttx/graphics/nxbe/nxbe_clipper.c | 3 | ||||
-rw-r--r-- | nuttx/include/nuttx/kmalloc.h | 26 | ||||
-rw-r--r-- | nuttx/include/nuttx/mm.h | 18 | ||||
-rw-r--r-- | nuttx/libc/lib_internal.h | 6 | ||||
-rw-r--r-- | nuttx/libnx/nxcontext.h | 6 | ||||
-rw-r--r-- | nuttx/libxx/libxx_internal.hxx | 2 | ||||
-rw-r--r-- | nuttx/mm/kmm_realloc.c | 4 | ||||
-rw-r--r-- | nuttx/mm/umm_realloc.c | 2 | ||||
-rw-r--r-- | nuttx/sched/environ/env_setenv.c | 2 | ||||
-rw-r--r-- | nuttx/sched/environ/env_unsetenv.c | 2 | ||||
-rw-r--r-- | nuttx/sched/group/group_join.c | 2 |
16 files changed, 48 insertions, 41 deletions
diff --git a/nuttx/arch/sim/src/up_deviceimage.c b/nuttx/arch/sim/src/up_deviceimage.c index ea9e3a5a0..fc54e6676 100644 --- a/nuttx/arch/sim/src/up_deviceimage.c +++ b/nuttx/arch/sim/src/up_deviceimage.c @@ -1,7 +1,7 @@ /**************************************************************************** * up_deviceimage.c * - * Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2009, 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -272,7 +272,7 @@ char *up_deviceimage(void) if (strm.avail_out == 0) { int newbufsize = bufsize + 128*1024; - char *newbuffer = krealloc(pbuffer, newbufsize); + char *newbuffer = kmm_realloc(pbuffer, newbufsize); if (!newbuffer) { kfree(pbuffer); @@ -292,7 +292,7 @@ char *up_deviceimage(void) */ int newbufsize = bufsize - strm.avail_out; - char *newbuffer = krealloc(pbuffer, newbufsize); + char *newbuffer = kmm_realloc(pbuffer, newbufsize); if (!newbuffer) { kfree(pbuffer); diff --git a/nuttx/binfmt/libelf/libelf_iobuffer.c b/nuttx/binfmt/libelf/libelf_iobuffer.c index 14a365d69..3e27c73e3 100644 --- a/nuttx/binfmt/libelf/libelf_iobuffer.c +++ b/nuttx/binfmt/libelf/libelf_iobuffer.c @@ -120,7 +120,7 @@ int elf_reallocbuffer(FAR struct elf_loadinfo_s *loadinfo, size_t increment) /* And perform the reallocation */ - buffer = krealloc((FAR void *)loadinfo->iobuffer, newsize); + buffer = kmm_realloc((FAR void *)loadinfo->iobuffer, newsize); if (!buffer) { bdbg("Failed to reallocate the I/O buffer\n"); diff --git a/nuttx/drivers/usbdev/usbmsc.c b/nuttx/drivers/usbdev/usbmsc.c index 2e51ee6d8..6ff18ef5b 100644 --- a/nuttx/drivers/usbdev/usbmsc.c +++ b/nuttx/drivers/usbdev/usbmsc.c @@ -1501,7 +1501,7 @@ int usbmsc_bindlun(FAR void *handle, FAR const char *drvrpath, else if (priv->iosize < geo.geo_sectorsize) { void *tmp; - tmp = (uint8_t*)krealloc(priv->iobuffer, geo.geo_sectorsize); + tmp = (uint8_t*)kmm_realloc(priv->iobuffer, geo.geo_sectorsize); if (!tmp) { usbtrace(TRACE_CLSERROR(USBMSC_TRACEERR_REALLOCIOBUFFER), geo.geo_sectorsize); diff --git a/nuttx/drivers/wireless/cc3000/cc3000.c b/nuttx/drivers/wireless/cc3000/cc3000.c index f31419176..e11ed7d72 100644 --- a/nuttx/drivers/wireless/cc3000/cc3000.c +++ b/nuttx/drivers/wireless/cc3000/cc3000.c @@ -1343,7 +1343,7 @@ static int cc3000_ioctl(FAR struct file *filep, int cmd, unsigned long arg) rv = priv->rx_buffer_max_len; flags = irqsave(); priv->rx_buffer_max_len = *psize; - priv->rx_buffer.pbuffer = krealloc(priv->rx_buffer.pbuffer,*psize); + priv->rx_buffer.pbuffer = kmm_realloc(priv->rx_buffer.pbuffer,*psize); irqrestore(flags); DEBUGASSERT(priv->rx_buffer.pbuffer); *psize = rv; diff --git a/nuttx/fs/mmap/fs_munmap.c b/nuttx/fs/mmap/fs_munmap.c index 6a846ef1f..ba1d99f79 100644 --- a/nuttx/fs/mmap/fs_munmap.c +++ b/nuttx/fs/mmap/fs_munmap.c @@ -151,7 +151,7 @@ int munmap(FAR void *start, size_t length) /* Get the offset from the beginning of the region and the actual number * of bytes to "unmap". All mappings must extend to the end of the region. * There is no support for free a block of memory but leaving a block of - * memory at the end. This is a consequence of using kurealloc() to + * memory at the end. This is a consequence of using umm_realloc() to * simulate the unmapping. */ @@ -195,7 +195,7 @@ int munmap(FAR void *start, size_t length) else { - newaddr = kurealloc(curr->addr, sizeof(struct fs_rammap_s) + length); + newaddr = umm_realloc(curr->addr, sizeof(struct fs_rammap_s) + length); DEBUGASSERT(newaddr == (FAR void*)(curr->addr)); curr->length = length; } diff --git a/nuttx/graphics/nxbe/nxbe_clipper.c b/nuttx/graphics/nxbe/nxbe_clipper.c index 14e66ef4f..88b6ef2f6 100644 --- a/nuttx/graphics/nxbe/nxbe_clipper.c +++ b/nuttx/graphics/nxbe/nxbe_clipper.c @@ -115,7 +115,8 @@ static inline void nxbe_pushrectangle(FAR struct nxbe_clipstack_s *stack, int mxrects = stack->mxrects ? 2 * stack->mxrects : NX_INITIAL_STACKSIZE; struct nxbe_cliprect_s *newstack; - newstack = krealloc(stack->stack, sizeof(struct nxbe_cliprect_s) * mxrects); + newstack = kmm_realloc(stack->stack, + sizeof(struct nxbe_cliprect_s) * mxrects); if (!newstack) { gdbg("Failed to reallocate stack\n"); diff --git a/nuttx/include/nuttx/kmalloc.h b/nuttx/include/nuttx/kmalloc.h index 018d34888..40102ba55 100644 --- a/nuttx/include/nuttx/kmalloc.h +++ b/nuttx/include/nuttx/kmalloc.h @@ -96,20 +96,18 @@ extern "C" # define kumalloc(s) malloc(s) # define kuzalloc(s) zalloc(s) -# define kurealloc(p,s) realloc(p,s) -# define kumemalign(a,s) memalign(a,s) +# define umm_realloc(p,s) realloc(p,s) +# define umm_memalign(a,s) memalign(a,s) # define kufree(p) free(p) #else -/* 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. +/* In the kernel-phase of the protected build, the same macros are defined + * in userspace.h as macros. Those versions call into user-space via a + * header at the beginning of the user-space blob. */ # define kumalloc(s) umm_malloc(s) # define kuzalloc(s) umm_zalloc(s) -# define kurealloc(p,s) umm_realloc(p,s) -# define kumemalign(a,s) umm_memalign(a,s) # define kufree(p) umm_free(p) #endif @@ -128,7 +126,7 @@ extern "C" # define kmalloc(s) malloc(s) # define kzalloc(s) zalloc(s) -# define krealloc(p,s) realloc(p,s) +# define kmm_realloc(p,s) realloc(p,s) # define kmm_memalign(a,s) memalign(a,s) # define kfree(p) free(p) @@ -145,7 +143,7 @@ extern "C" # define kmalloc(s) umm_malloc(s) # define kzalloc(s) umm_zalloc(s) -# define krealloc(p,s) umm_realloc(p,s) +# define kmm_realloc(p,s) umm_realloc(p,s) # define kmm_memalign(a,s) umm_memalign(a,s) # define kfree(p) umm_free(p) @@ -154,19 +152,9 @@ extern "C" * and we can call them directly. */ -void kmm_initialize(FAR void *heap_start, size_t heap_size); -void kmm_addregion(FAR void *heapstart, size_t heapsize); -int kmm_trysemaphore(void); -void kmm_givesemaphore(void); - FAR void *kmalloc(size_t size); FAR void *kzalloc(size_t size); -FAR void *krealloc(FAR void *oldmem, size_t newsize); void kfree(FAR void *mem); - -#ifdef CONFIG_DEBUG -bool kmm_heapmember(FAR void *mem); -#endif #endif /* Functions defined in sched/sched_kfree.c **********************************/ diff --git a/nuttx/include/nuttx/mm.h b/nuttx/include/nuttx/mm.h index 9e9c7631c..36c72ac3d 100644 --- a/nuttx/include/nuttx/mm.h +++ b/nuttx/include/nuttx/mm.h @@ -284,6 +284,12 @@ void kmm_initialize(FAR void *heap_start, size_t heap_size); void umm_addregion(FAR void *heapstart, size_t heapsize); #endif +/* Functions contained in kmm_addregion.c ***********************************/ + +#ifdef CONFIG_MM_USER_HEAP +void kmm_addregion(FAR void *heapstart, size_t heapsize); +#endif + /* Functions contained in mm_sem.c ******************************************/ void mm_seminitialize(FAR struct mm_heap_s *heap); @@ -318,6 +324,12 @@ void mm_free(FAR struct mm_heap_s *heap, FAR void *mem); FAR void *mm_realloc(FAR struct mm_heap_s *heap, FAR void *oldmem, size_t size); +/* Functions contained in kmm_realloc.c *************************************/ + +#ifdef CONFIG_MM_KERNEL_HEAP +FAR void *kmm_realloc(FAR void *oldmem, size_t newsize); +#endif + /* Functions contained in mm_calloc.c ***************************************/ FAR void *mm_calloc(FAR struct mm_heap_s *heap, size_t n, size_t elem_size); @@ -343,6 +355,12 @@ FAR void *mm_memalign(FAR struct mm_heap_s *heap, size_t alignment, FAR void *kmm_memalign(size_t alignment, size_t size); #endif +/* Functions contained in kmm_heapmember.c **********************************/ + +#if defined(CONFIG_MM_KERNEL_HEAP) && defined(CONFIG_DEBUG) +bool kmm_heapmember(FAR void *mem); +#endif + /* Functions contained in mm_brkaddr.c **************************************/ FAR void *mm_brkaddr(FAR struct mm_heap_s *heap, int region); diff --git a/nuttx/libc/lib_internal.h b/nuttx/libc/lib_internal.h index 6b9404680..46aaf9abe 100644 --- a/nuttx/libc/lib_internal.h +++ b/nuttx/libc/lib_internal.h @@ -88,15 +88,15 @@ # define lib_malloc(s) kmalloc(s) # define lib_zalloc(s) kzalloc(s) -# define lib_realloc(p,s) krealloc(p,s) -# define lib_memalign(p,s) krealloc(p,s) +# define lib_realloc(p,s) kmm_realloc(p,s) +# define lib_memalign(p,s) kmm_memalign(p,s) # define lib_free(p) kfree(p) /* User-accessible allocations */ # define lib_umalloc(s) kumalloc(s) # define lib_uzalloc(s) kuzalloc(s) -# define lib_urealloc(p,s) kurealloc(p,s) +# define lib_urealloc(p,s) umm_realloc(p,s) # define lib_ufree(p) kufree(p) #else diff --git a/nuttx/libnx/nxcontext.h b/nuttx/libnx/nxcontext.h index e8b52ece9..52c166205 100644 --- a/nuttx/libnx/nxcontext.h +++ b/nuttx/libnx/nxcontext.h @@ -70,15 +70,15 @@ # define lib_malloc(s) kmalloc(s) # define lib_zalloc(s) kzalloc(s) -# define lib_realloc(p,s) krealloc(p,s) -# define lib_memalign(p,s) krealloc(p,s) +# define lib_realloc(p,s) kmm_realloc(p,s) +# define lib_memalign(p,s) kmm_memalign(p,s) # define lib_free(p) kfree(p) /* User-accessible allocations */ # define lib_umalloc(s) kumalloc(s) # define lib_uzalloc(s) kuzalloc(s) -# define lib_urealloc(p,s) kurealloc(p,s) +# define lib_urealloc(p,s) umm_realloc(p,s) # define lib_ufree(p) kufree(p) #else diff --git a/nuttx/libxx/libxx_internal.hxx b/nuttx/libxx/libxx_internal.hxx index 25ad13c76..1763d4858 100644 --- a/nuttx/libxx/libxx_internal.hxx +++ b/nuttx/libxx/libxx_internal.hxx @@ -57,7 +57,7 @@ # include <nuttx/kmalloc.h> # define lib_malloc(s) kmalloc(s) # define lib_zalloc(s) kzalloc(s) -# define lib_realloc(p,s) krealloc(p,s) +# define lib_realloc(p,s) kmm_realloc(p,s) # define lib_free(p) kfree(p) #else # include <cstdlib> diff --git a/nuttx/mm/kmm_realloc.c b/nuttx/mm/kmm_realloc.c index cd3d383b4..fdb77da3f 100644 --- a/nuttx/mm/kmm_realloc.c +++ b/nuttx/mm/kmm_realloc.c @@ -56,7 +56,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: krealloc + * Name: kmm_realloc * * Description: * Re-allocate memory in the kernel heap. @@ -70,7 +70,7 @@ * ****************************************************************************/ -FAR void *krealloc(FAR void *oldmem, size_t newsize) +FAR void *kmm_realloc(FAR void *oldmem, size_t newsize) { return mm_realloc(&g_kmmheap, oldmem, newsize); } diff --git a/nuttx/mm/umm_realloc.c b/nuttx/mm/umm_realloc.c index 4f5391938..6791bb18b 100644 --- a/nuttx/mm/umm_realloc.c +++ b/nuttx/mm/umm_realloc.c @@ -58,7 +58,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: krealloc + * Name: realloc * * Description: * Re-allocate memory in the user heap. diff --git a/nuttx/sched/environ/env_setenv.c b/nuttx/sched/environ/env_setenv.c index e78cc8c89..4c9b70250 100644 --- a/nuttx/sched/environ/env_setenv.c +++ b/nuttx/sched/environ/env_setenv.c @@ -161,7 +161,7 @@ int setenv(FAR const char *name, FAR const char *value, int overwrite) if (group->tg_envp) { newsize = group->tg_envsize + varlen; - newenvp = (FAR char *)kurealloc(group->tg_envp, newsize); + newenvp = (FAR char *)umm_realloc(group->tg_envp, newsize); if (!newenvp) { ret = ENOMEM; diff --git a/nuttx/sched/environ/env_unsetenv.c b/nuttx/sched/environ/env_unsetenv.c index 5ed1ed697..53f984dfb 100644 --- a/nuttx/sched/environ/env_unsetenv.c +++ b/nuttx/sched/environ/env_unsetenv.c @@ -98,7 +98,7 @@ int unsetenv(FAR const char *name) /* Reallocate the new environment buffer */ newsize = group->tg_envsize; - newenvp = (FAR char *)kurealloc(group->tg_envp, newsize); + newenvp = (FAR char *)umm_realloc(group->tg_envp, newsize); if (!newenvp) { set_errno(ENOMEM); diff --git a/nuttx/sched/group/group_join.c b/nuttx/sched/group/group_join.c index 810bfcc01..662db69bc 100644 --- a/nuttx/sched/group/group_join.c +++ b/nuttx/sched/group/group_join.c @@ -113,7 +113,7 @@ static inline int group_addmember(FAR struct task_group_s *group, pid_t pid) } newmembers = (FAR pid_t *) - krealloc(group->tg_members, sizeof(pid_t) * newmax); + kmm_realloc(group->tg_members, sizeof(pid_t) * newmax); if (!newmembers) { |