summaryrefslogtreecommitdiff
path: root/nuttx/binfmt
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-09-23 16:04:39 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-09-23 16:04:39 -0600
commitbda6baf012802a5748bbec3f5d3d8fc0ea398245 (patch)
tree70a7246e73e685637d9320e19608cc6140c50ff8 /nuttx/binfmt
parentf78a387b5ccea2d459a913b018c5a3fe1c24fac6 (diff)
downloadnuttx-bda6baf012802a5748bbec3f5d3d8fc0ea398245.tar.gz
nuttx-bda6baf012802a5748bbec3f5d3d8fc0ea398245.tar.bz2
nuttx-bda6baf012802a5748bbec3f5d3d8fc0ea398245.zip
Add support for a per-process virtual page allocator. This is a new member of the task_group_s structure. The allocaor must be initialized when a new user process is started and uninitialize when the process group is finally destroyed. It is used by shmat() and shmdt() to pick the virtual address onto which to map the shared physical memory.
Diffstat (limited to 'nuttx/binfmt')
-rw-r--r--nuttx/binfmt/binfmt_execmodule.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/nuttx/binfmt/binfmt_execmodule.c b/nuttx/binfmt/binfmt_execmodule.c
index babd5f1f7..e4ef0b785 100644
--- a/nuttx/binfmt/binfmt_execmodule.c
+++ b/nuttx/binfmt/binfmt_execmodule.c
@@ -49,6 +49,7 @@
#include <nuttx/arch.h>
#include <nuttx/kmalloc.h>
#include <nuttx/mm.h>
+#include <nuttx/shm.h>
#include <nuttx/binfmt/binfmt.h>
#include "sched/sched.h"
@@ -229,6 +230,18 @@ int exec_module(FAR const struct binary_s *binp)
}
#endif
+#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_SHM)
+ /* Initialize the shared memory virtual page allocator */
+
+ ret = shm_group_initialize(&tcb->cmn.group);
+ if (ret < 0)
+ {
+ bdbg("ERROR: shm_group_initialize() failed: %d\n", ret);
+ err = -ret;
+ goto errout_with_tcbinit;
+ }
+#endif
+
#ifdef CONFIG_PIC
/* Add the D-Space address as the PIC base address. By convention, this
* must be the first allocated address space.
@@ -244,7 +257,7 @@ int exec_module(FAR const struct binary_s *binp)
#ifdef CONFIG_ARCH_ADDRENV
/* Assign the address environment to the new task group */
- ret = up_addrenv_clone(&binp->addrenv, &tcb->cmn.group->addrenv);
+ ret = up_addrenv_clone(&binp->addrenv, &tcb->cmn.group->tg_addrenv);
if (ret < 0)
{
err = -ret;