diff options
Diffstat (limited to 'c/src/lib/libbsp/sparc/shared/startup/early_malloc.c')
-rw-r--r-- | c/src/lib/libbsp/sparc/shared/startup/early_malloc.c | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/c/src/lib/libbsp/sparc/shared/startup/early_malloc.c b/c/src/lib/libbsp/sparc/shared/startup/early_malloc.c deleted file mode 100644 index 911a7b019b..0000000000 --- a/c/src/lib/libbsp/sparc/shared/startup/early_malloc.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Early dynamic memory allocation (not freeable) for BSP - * boot routines. Minimum alignment 8 bytes. Memory is - * allocated after _end, it will shrink the workspace. - * - * COPYRIGHT (c) 2011. - * Aeroflex Gaisler AB - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#include <bsp.h> -#include <stdlib.h> - -/* Tells us where to put the workspace in case remote debugger is present. */ -extern uint32_t rdb_start; - -/* Must be aligned to 8 */ -extern unsigned int early_mem; - -/* must be identical to STACK_SIZE in start.S */ -#define STACK_SIZE (16 * 1024) - -/* Allocate 8-byte aligned non-freeable pre-malloc() memory. The function - * can be called at any time. The work-area will shrink when called before - * bsp_work_area_initialize(). malloc() is called to get memory when this function - * is called after bsp_work_area_initialize(). - */ -void *bsp_early_malloc(int size) -{ - void *start; - - /* Not early anymore? */ - if (early_mem == ~0) - return malloc(size); - - size = (size + 7) & ~0x7; - if (rdb_start - STACK_SIZE - early_mem < size) - return NULL; - - start = (void *)early_mem; - early_mem += size; - - return start; -} |