diff options
-rw-r--r-- | c/src/lib/libbsp/shared/ChangeLog | 7 | ||||
-rw-r--r-- | c/src/lib/libbsp/shared/bootcard.c | 14 |
2 files changed, 13 insertions, 8 deletions
diff --git a/c/src/lib/libbsp/shared/ChangeLog b/c/src/lib/libbsp/shared/ChangeLog index 288ef28424..98e261cad2 100644 --- a/c/src/lib/libbsp/shared/ChangeLog +++ b/c/src/lib/libbsp/shared/ChangeLog @@ -1,3 +1,10 @@ +2009-03-10 Eric Norum <norume@aps.anl.gov> + + * 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. + 2009-03-05 Till Straumann <strauman@slac.stanford.edu> * bootcard.c: use aligned heap_start (instead of 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) |