diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-03-09 21:12:20 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-03-09 21:12:20 +0000 |
commit | dda5be5c1fc672b5d9cb3a910b5e0cb0a41046c5 (patch) | |
tree | 0af32db840a032a50312791977b7d129def1d5b3 /nuttx/binfmt | |
parent | 2ac33dcffabd9422659c3b013ed8624c09ae90e4 (diff) | |
download | nuttx-dda5be5c1fc672b5d9cb3a910b5e0cb0a41046c5.tar.gz nuttx-dda5be5c1fc672b5d9cb3a910b5e0cb0a41046c5.tar.bz2 nuttx-dda5be5c1fc672b5d9cb3a910b5e0cb0a41046c5.zip |
More changes for a kernel-mode allocator (more to be done)
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5724 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/binfmt')
-rw-r--r-- | nuttx/binfmt/binfmt_execmodule.c | 4 | ||||
-rw-r--r-- | nuttx/binfmt/binfmt_unloadmodule.c | 5 | ||||
-rw-r--r-- | nuttx/binfmt/libelf/libelf_addrenv.c | 6 | ||||
-rw-r--r-- | nuttx/binfmt/libelf/libelf_ctors.c | 2 | ||||
-rw-r--r-- | nuttx/binfmt/libelf/libelf_dtors.c | 2 | ||||
-rw-r--r-- | nuttx/binfmt/libelf/libelf_iobuffer.c | 2 | ||||
-rw-r--r-- | nuttx/binfmt/libelf/libelf_unload.c | 4 | ||||
-rw-r--r-- | nuttx/binfmt/libnxflat/libnxflat_addrenv.c | 6 |
8 files changed, 16 insertions, 15 deletions
diff --git a/nuttx/binfmt/binfmt_execmodule.c b/nuttx/binfmt/binfmt_execmodule.c index 09ad4ee6c..b56dd470f 100644 --- a/nuttx/binfmt/binfmt_execmodule.c +++ b/nuttx/binfmt/binfmt_execmodule.c @@ -166,7 +166,7 @@ int exec_module(FAR const struct binary_s *binp) /* Allocate the stack for the new task */ #ifndef CONFIG_CUSTOM_STACK - stack = (FAR uint32_t*)kmalloc(binp->stacksize); + stack = (FAR uint32_t*)kumalloc(binp->stacksize); if (!tcb) { err = ENOMEM; @@ -246,7 +246,7 @@ errout_with_stack: #ifndef CONFIG_CUSTOM_STACK tcb->cmn.stack_alloc_ptr = NULL; sched_releasetcb(&tcb->cmn); - kfree(stack); + kufree(stack); #else sched_releasetcb(&tcb->cmn); #endif diff --git a/nuttx/binfmt/binfmt_unloadmodule.c b/nuttx/binfmt/binfmt_unloadmodule.c index 365f26a34..50f8dcb43 100644 --- a/nuttx/binfmt/binfmt_unloadmodule.c +++ b/nuttx/binfmt/binfmt_unloadmodule.c @@ -1,7 +1,7 @@ /**************************************************************************** * binfmt/binfmt_loadmodule.c * - * Copyright (C) 2009, 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2012-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -45,6 +45,7 @@ #include <debug.h> #include <errno.h> +#include <nuttx/kmalloc.h> #include <nuttx/binfmt/binfmt.h> #include "binfmt_internal.h" @@ -183,7 +184,7 @@ int unload_module(FAR const struct binary_s *binp) if (binp->alloc[i]) { bvdbg("Freeing alloc[%d]: %p\n", i, binp->alloc[i]); - free((FAR void *)binp->alloc[i]); + kufree((FAR void *)binp->alloc[i]); } } diff --git a/nuttx/binfmt/libelf/libelf_addrenv.c b/nuttx/binfmt/libelf/libelf_addrenv.c index 193062a54..d2b9870b6 100644 --- a/nuttx/binfmt/libelf/libelf_addrenv.c +++ b/nuttx/binfmt/libelf/libelf_addrenv.c @@ -68,7 +68,7 @@ * * Description: * Allocate memory for the ELF image (elfalloc). If CONFIG_ADDRENV=n, - * elfalloc will be allocated using kzalloc(). If CONFIG_ADDRENV-y, then + * elfalloc will be allocated using kuzalloc(). If CONFIG_ADDRENV-y, then * elfalloc will be allocated using up_addrenv_create(). In either case, * there will be a unique instance of elfalloc (and stack) for each * instance of a process. @@ -116,7 +116,7 @@ int elf_addrenv_alloc(FAR struct elf_loadinfo_s *loadinfo, size_t envsize) #else /* Allocate memory to hold the ELF image */ - loadinfo->elfalloc = (uintptr_t)kzalloc(envsize); + loadinfo->elfalloc = (uintptr_t)kuzalloc(envsize); if (!loadinfo->elfalloc) { return -ENOMEM; @@ -167,7 +167,7 @@ void elf_addrenv_free(FAR struct elf_loadinfo_s *loadinfo) if (loadinfo->elfalloc != 0) { - kfree((FAR void *)loadinfo->elfalloc); + kufree((FAR void *)loadinfo->elfalloc); loadinfo->elfalloc = 0; } diff --git a/nuttx/binfmt/libelf/libelf_ctors.c b/nuttx/binfmt/libelf/libelf_ctors.c index 20f1256e2..af9c7bba4 100644 --- a/nuttx/binfmt/libelf/libelf_ctors.c +++ b/nuttx/binfmt/libelf/libelf_ctors.c @@ -163,7 +163,7 @@ int elf_loadctors(FAR struct elf_loadinfo_s *loadinfo) { /* Allocate memory to hold a copy of the .ctor section */ - loadinfo->ctoralloc = (binfmt_ctor_t*)kmalloc(ctorsize); + loadinfo->ctoralloc = (binfmt_ctor_t*)kumalloc(ctorsize); if (!loadinfo->ctoralloc) { bdbg("Failed to allocate memory for .ctors\n"); diff --git a/nuttx/binfmt/libelf/libelf_dtors.c b/nuttx/binfmt/libelf/libelf_dtors.c index c0c73a337..638284f0b 100644 --- a/nuttx/binfmt/libelf/libelf_dtors.c +++ b/nuttx/binfmt/libelf/libelf_dtors.c @@ -163,7 +163,7 @@ int elf_loaddtors(FAR struct elf_loadinfo_s *loadinfo) { /* Allocate memory to hold a copy of the .dtor section */ - loadinfo->ctoralloc = (binfmt_dtor_t*)kmalloc(dtorsize); + loadinfo->ctoralloc = (binfmt_dtor_t*)kumalloc(dtorsize); if (!loadinfo->ctoralloc) { bdbg("Failed to allocate memory for .dtors\n"); diff --git a/nuttx/binfmt/libelf/libelf_iobuffer.c b/nuttx/binfmt/libelf/libelf_iobuffer.c index ead99ca09..b2d54b3ca 100644 --- a/nuttx/binfmt/libelf/libelf_iobuffer.c +++ b/nuttx/binfmt/libelf/libelf_iobuffer.c @@ -1,7 +1,7 @@ /**************************************************************************** * binfmt/libelf/elf_iobuffer.c * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without diff --git a/nuttx/binfmt/libelf/libelf_unload.c b/nuttx/binfmt/libelf/libelf_unload.c index 539e5faf7..7f7a3cf91 100644 --- a/nuttx/binfmt/libelf/libelf_unload.c +++ b/nuttx/binfmt/libelf/libelf_unload.c @@ -92,7 +92,7 @@ int elf_unload(struct elf_loadinfo_s *loadinfo) #ifdef CONFIG_BINFMT_CONSTRUCTORS if (loadinfo->ctoralloc != 0) { - kfree(loadinfo->ctoralloc); + kufree(loadinfo->ctoralloc); loadinfo->ctoralloc = NULL; } @@ -101,7 +101,7 @@ int elf_unload(struct elf_loadinfo_s *loadinfo) if (loadinfo->dtoralloc != 0) { - kfree(loadinfo->dtoralloc); + kufree(loadinfo->dtoralloc); loadinfo->dtoralloc = NULL; } diff --git a/nuttx/binfmt/libnxflat/libnxflat_addrenv.c b/nuttx/binfmt/libnxflat/libnxflat_addrenv.c index 2d9255b28..d31e7fda0 100644 --- a/nuttx/binfmt/libnxflat/libnxflat_addrenv.c +++ b/nuttx/binfmt/libnxflat/libnxflat_addrenv.c @@ -69,7 +69,7 @@ * * Description: * Allocate memory for the ELF image (elfalloc). If CONFIG_ADDRENV=n, - * elfalloc will be allocated using kzalloc(). If CONFIG_ADDRENV-y, then + * elfalloc will be allocated using kuzalloc(). If CONFIG_ADDRENV-y, then * elfalloc will be allocated using up_addrenv_create(). In either case, * there will be a unique instance of elfalloc (and stack) for each * instance of a process. @@ -164,7 +164,7 @@ errout_with_dspace: #else /* Allocate (and zero) memory to hold the ELF image */ - dspace->region = (FAR uint8_t *)kzalloc(envsize); + dspace->region = (FAR uint8_t *)kuzalloc(envsize); if (!dspace->region) { kfree(dspace); @@ -222,7 +222,7 @@ void nxflat_addrenv_free(FAR struct nxflat_loadinfo_s *loadinfo) if (dspace->region) { - kfree(dspace->region); + kufree(dspace->region); } #endif |