summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/sparc/shared/bspgetworkarea.c
diff options
context:
space:
mode:
Diffstat (limited to 'c/src/lib/libbsp/sparc/shared/bspgetworkarea.c')
-rw-r--r--c/src/lib/libbsp/sparc/shared/bspgetworkarea.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/c/src/lib/libbsp/sparc/shared/bspgetworkarea.c b/c/src/lib/libbsp/sparc/shared/bspgetworkarea.c
index c6e1491d81..45d3d0ed87 100644
--- a/c/src/lib/libbsp/sparc/shared/bspgetworkarea.c
+++ b/c/src/lib/libbsp/sparc/shared/bspgetworkarea.c
@@ -8,8 +8,6 @@
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
- *
- * $Id$
*/
/* #define BSP_GET_WORK_AREA_DEBUG */
@@ -22,6 +20,9 @@
/* Tells us where to put the workspace in case remote debugger is present. */
extern uint32_t rdb_start;
+/* Must be aligned to 8, _end is aligned to 8 */
+unsigned int early_mem = (unsigned int)&end;
+
/*
* This method returns the base address and size of the area which
* is to be allocated between the RTEMS Workspace and the C Program
@@ -37,8 +38,11 @@ void bsp_get_work_area(
/* must be identical to STACK_SIZE in start.S */
#define STACK_SIZE (16 * 1024)
- *work_area_start = &end;
- *work_area_size = (void *)rdb_start - (void *)&end - STACK_SIZE;
+ /* Early dynamic memory allocator is placed just above _end */
+ *work_area_start = (void *)early_mem;
+ *work_area_size = (void *)rdb_start - (void *)early_mem - STACK_SIZE;
+ early_mem = ~0; /* Signal bsp_early_malloc not to be used anymore */
+
*heap_start = BSP_BOOTCARD_HEAP_USES_WORK_AREA;
*heap_size = BSP_BOOTCARD_HEAP_SIZE_DEFAULT;