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
This commit is contained in:
patacongo
2013-03-09 21:12:20 +00:00
parent 43d8762499
commit 1c52dce216
264 changed files with 1277 additions and 1648 deletions
+2 -2
View File
@@ -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
+3 -2
View File
@@ -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]);
}
}
+3 -3
View File
@@ -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;
}
+1 -1
View File
@@ -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");
+1 -1
View File
@@ -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");
+1 -1
View File
@@ -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
+2 -2
View File
@@ -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;
}
+3 -3
View File
@@ -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