Space at the beginning of the process data space is now reserved for user heap management structures. In the kernel build mode, these heap structures are shared between the kernel and use code in order to allocate user-specific data.

This commit is contained in:
Gregory Nutt 2014-09-02 11:21:23 -06:00
parent 4d8367a009
commit 8557f1a1bb

View File

@ -329,7 +329,10 @@ static void up_addrenv_destroy_region(FAR uintptr_t **list,
* textsize - The size (in bytes) of the .text address environment needed
* by the task. This region may be read/execute only.
* datasize - The size (in bytes) of the .data/.bss address environment
* needed by the task. This region may be read/write only.
* needed by the task. This region may be read/write only. NOTE: The
* actual size of the data region that is allocated will include a
* OS private reserved region at the beginning. The size of the
* private, reserved region is give by ARCH_DATA_RESERVE.
* addrenv - The location to return the representation of the task address
* environment.
*
@ -368,10 +371,14 @@ int up_addrenv_create(size_t textsize, size_t datasize,
goto errout;
}
/* Allocate .bss/.data space pages */
/* Allocate .bss/.data space pages. NOTE that a configurable offset is
* added to the allocted size. This is matched by the offset that is
* used when reporting the virtual data address in up_addrenv_vdata().
*/
ret = up_addrenv_create_region(addrenv->data, ARCH_DATA_NSECTS,
CONFIG_ARCH_DATA_VBASE, datasize,
CONFIG_ARCH_DATA_VBASE,
datasize + ARCH_DATA_RESERVE,
MMU_L2_UDATAFLAGS);
if (ret < 0)
{
@ -488,7 +495,7 @@ int up_addrenv_vdata(FAR group_addrenv_t *addrenv, uintptr_t textsize,
/* Not much to do in this case */
DEBUGASSERT(addrenv && vdata);
*vdata = (FAR void *)CONFIG_ARCH_DATA_VBASE;
*vdata = (FAR void *)(CONFIG_ARCH_DATA_VBASE + ARCH_DATA_RESERVE);
return OK;
}