From 96f2d87a59ce0ccddf5770805471b02907933bb9 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Tue, 10 Mar 2009 17:40:06 +0000 Subject: 2009-03-10 Eric Norum * bootcard.c: Swap order of RTEMS Workspace and Malloc Heap. This allows the potential for sbrk() to extend the heap area. This actually is done on PowerPC BSPs with more than 32MB which use dynamic loading. --- c/src/lib/libbsp/shared/bootcard.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'c/src/lib/libbsp/shared/bootcard.c') diff --git a/c/src/lib/libbsp/shared/bootcard.c b/c/src/lib/libbsp/shared/bootcard.c index f83c109b4f..10a3b0d7a8 100644 --- a/c/src/lib/libbsp/shared/bootcard.c +++ b/c/src/lib/libbsp/shared/bootcard.c @@ -73,8 +73,8 @@ static rtems_status_code bootcard_bsp_libc_helper( if ( !rtems_unified_work_area && heap_start == BSP_BOOTCARD_HEAP_USES_WORK_AREA) { - /* Use the work area start as heap start */ - heap_start = work_area_start; + /* Place the heap immediately following the work area */ + heap_start = work_area_start + rtems_configuration_get_work_space_size(); /* Ensure proper alignement */ if ((uintptr_t) heap_start & (CPU_ALIGNMENT - 1)) { @@ -83,11 +83,10 @@ static rtems_status_code bootcard_bsp_libc_helper( } /* - * For the default heap size use the free space from the start of the - * work area up to the work space start as heap area. + * For the default heap size use the free space from the end of the + * work space up to the end of the work area as heap. */ - heap_size_default = (intptr_t) ((char *) Configuration.work_space_start - - (char *) heap_start); + heap_size_default = work_area_size - rtems_configuration_get_work_space_size(); /* Keep it as a multiple of 16 bytes */ heap_size_default &= ~((intptr_t) 0xf); @@ -182,8 +181,7 @@ int boot_card( Configuration.work_space_start = work_area_start; Configuration.work_space_size = work_area_size; } else { - Configuration.work_space_start = (char *) work_area_start + - work_area_size - rtems_configuration_get_work_space_size(); + Configuration.work_space_start = (char *) work_area_start; } #if (BSP_DIRTY_MEMORY == 1) -- cgit v1.2.3