diff --git a/arch/arm/src/armv7-a/arm_addrenv.c b/arch/arm/src/armv7-a/arm_addrenv.c index fe765a1820..bdb6c291d1 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; }