mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 11:56:10 +08:00
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.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user