x86: Reorder x86's post relocation memory layout
[platform/kernel/u-boot.git] / arch / x86 / lib / init_helpers.c
index d10a846..9fd87df 100644 (file)
@@ -86,15 +86,16 @@ int calculate_relocation_address(void)
 
        /* Stack is at top of available memory */
        dest_addr = gd->ram_size;
-       gd->start_addr_sp = dest_addr;
 
-       /* U-Boot is below the stack */
-       dest_addr -= CONFIG_SYS_STACK_SIZE;
+       /* U-Boot is at the top */
        dest_addr -= (bss_end - text_start);
        dest_addr &= ~15;
        gd->relocaddr = dest_addr;
        gd->reloc_off = (dest_addr - text_start);
 
+       /* Stack is at the bottom, so it can grow down */
+       gd->start_addr_sp = dest_addr - CONFIG_SYS_MALLOC_LEN;
+
        return 0;
 }