ARM: zImage: Fix bad SP address after relocating kernel
authorTony Lindgren <tony@atomide.com>
Tue, 26 Apr 2011 12:37:46 +0000 (05:37 -0700)
committerNicolas Pitre <nico@fluxnic.net>
Sat, 7 May 2011 03:56:43 +0000 (23:56 -0400)
Otherwise cache_clean_flush can overwrite some of the relocated
area depending on where the kernel image gets loaded. This fixes
booting on n900 after commit 6d7d0ae51574943bf571d269da3243257a2d15db
(ARM: 6750/1: improvements to compressed/head.S).

Thanks to Aaro Koskinen <aaro.koskinen@nokia.com> for debugging
the address of the relocated area that gets corrupted, and to
Nicolas Pitre <nicolas.pitre@linaro.org> for the other uncompress
related fixes.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
arch/arm/boot/compressed/head.S

index 84ac4d656310772f424b42996c72bb48ba0673d5..55a5bcb82ba0c51a5e158a68febbfa75554c5db2 100644 (file)
@@ -253,6 +253,11 @@ restart:   adr     r0, LC0
                /* Preserve offset to relocated code. */
                sub     r6, r9, r6
 
+#ifndef CONFIG_ZBOOT_ROM
+               /* cache_clean_flush may use the stack, so relocate it */
+               add     sp, sp, r6
+#endif
+
                bl      cache_clean_flush
 
                adr     r0, BSYM(restart)