x86: Fix a few recently added bugs
authorGabe Black <gabeblack@chromium.org>
Wed, 16 Nov 2011 23:32:50 +0000 (23:32 +0000)
committerGraeme Russ <graeme.russ@gmail.com>
Tue, 29 Nov 2011 10:30:51 +0000 (21:30 +1100)
Signed-off-by: Gabe Black <gabeblack@chromium.org>
Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
arch/x86/cpu/cpu.c
arch/x86/lib/board.c

index 48d2f7aad1431194a8884857e228235daa1c1415..61d0b69416e1540b2914c5fe24782041481493a6 100644 (file)
@@ -37,6 +37,7 @@
 #include <asm/processor.h>
 #include <asm/processor-flags.h>
 #include <asm/interrupt.h>
+#include <linux/compiler.h>
 
 /*
  * Constructor for a conventional segment GDT (or LDT) entry
index 18e0edee8756e5ffdbcb86cb0fcd59b6df1998c7..d742fec928b9e7e549a45ea4166bfa70190ea903 100644 (file)
@@ -220,6 +220,9 @@ static int do_elf_reloc_fixups(void)
        Elf32_Addr *offset_ptr_rom;
        Elf32_Addr *offset_ptr_ram;
 
+       /* The size of the region of u-boot that runs out of RAM. */
+       uintptr_t size = (uintptr_t)&__bss_end - (uintptr_t)&__text_start;
+
        do {
                /* Get the location from the relocation entry */
                offset_ptr_rom = (Elf32_Addr *)re_src->r_offset;
@@ -228,7 +231,8 @@ static int do_elf_reloc_fixups(void)
                if (offset_ptr_rom >= (Elf32_Addr *)CONFIG_SYS_TEXT_BASE) {
 
                        /* Switch to the in-RAM version */
-                       offset_ptr_ram = offset_ptr_rom + gd->reloc_off;
+                       offset_ptr_ram = (Elf32_Addr *)((ulong)offset_ptr_rom +
+                                                       gd->reloc_off);
 
                        /* Check that the target points into .text */
                        if (*offset_ptr_ram >= CONFIG_SYS_TEXT_BASE &&