From 8557f1a1bba8f4e10c3f678c55e36edc29c04ae9 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 2 Sep 2014 11:21:23 -0600 Subject: [PATCH] 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. --- arch/arm/src/armv7-a/arm_addrenv.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/arch/arm/src/armv7-a/arm_addrenv.c b/arch/arm/src/armv7-a/arm_addrenv.c index fe765a18205..bdb6c291d19 100644 --- a/arch/arm/src/armv7-a/arm_addrenv.c +++ b/arch/arm/src/armv7-a/arm_addrenv.c @@ -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; }