summaryrefslogtreecommitdiff
path: root/arch/x86/lib/init_helpers.c
diff options
context:
space:
mode:
authorGabe Black <gabeblack@chromium.org>2012-11-03 11:41:24 +0000
committerSimon Glass <sjg@chromium.org>2012-12-06 14:30:41 -0800
commit32f98735f9ada2bcfb114088f6226be8a22943fa (patch)
tree005937e3c76bd22e630d257da68e47dac7435725 /arch/x86/lib/init_helpers.c
parent8313315b9ab3a130784a2a7d0c4f329808690c0b (diff)
downloadu-boot-imx-32f98735f9ada2bcfb114088f6226be8a22943fa.zip
u-boot-imx-32f98735f9ada2bcfb114088f6226be8a22943fa.tar.gz
u-boot-imx-32f98735f9ada2bcfb114088f6226be8a22943fa.tar.bz2
x86: Reorder x86's post relocation memory layout
This changes the layout in decreasing addresses from: 1. Stack 2. Sections in the image 3. Heap to 1. Sections in the image 2. Heap 3. Stack This allows the stack to grow significantly more since it isn't constrained by the other u-boot areas. More importantly, the generic memory wipe code assumes that the stack is the lowest addressed area used by the main part of u-boot. In the original layout, that means that u-boot tramples all over itself. In the new layout, it works. Signed-off-by: Gabe Black <gabeblack@google.com> Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'arch/x86/lib/init_helpers.c')
-rw-r--r--arch/x86/lib/init_helpers.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/arch/x86/lib/init_helpers.c b/arch/x86/lib/init_helpers.c
index d10a846..9fd87df 100644
--- a/arch/x86/lib/init_helpers.c
+++ b/arch/x86/lib/init_helpers.c
@@ -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;
}