summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/malloc_simple.c2
-rw-r--r--common/spl/spl.c13
2 files changed, 12 insertions, 3 deletions
diff --git a/common/malloc_simple.c b/common/malloc_simple.c
index dd1119f..479a1e4 100644
--- a/common/malloc_simple.c
+++ b/common/malloc_simple.c
@@ -44,7 +44,7 @@ void *memalign_simple(size_t align, size_t bytes)
return ptr;
}
-#ifdef CONFIG_SYS_MALLOC_SIMPLE
+#if CONFIG_IS_ENABLED(SYS_MALLOC_SIMPLE)
void *calloc(size_t nmemb, size_t elem_size)
{
size_t size = nmemb * elem_size;
diff --git a/common/spl/spl.c b/common/spl/spl.c
index a5892d7..4b319d6 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -347,8 +347,17 @@ ulong spl_relocate_stack_gd(void)
memcpy(new_gd, (void *)gd, sizeof(gd_t));
gd = new_gd;
- /* Clear the BSS. */
- memset(__bss_start, 0, __bss_end - __bss_start);
+#ifdef CONFIG_SPL_SYS_MALLOC_SIMPLE
+ if (CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN) {
+ if (!(gd->flags & GD_FLG_SPL_INIT))
+ panic("spl_init must be called before heap reloc");
+
+ ptr -= CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN;
+ gd->malloc_base = ptr;
+ gd->malloc_limit = CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN;
+ gd->malloc_ptr = 0;
+ }
+#endif
return ptr;
#else