From patchwork Thu Nov 17 09:32:50 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Graeme Russ X-Patchwork-Id: 126165 X-Patchwork-Delegate: graeme.russ@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id BFADFB71F8 for ; Thu, 17 Nov 2011 20:33:13 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3565D28890; Thu, 17 Nov 2011 10:33:10 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zL-McdAbxQS2; Thu, 17 Nov 2011 10:33:10 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C414C2889B; Thu, 17 Nov 2011 10:33:07 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D38E42889B for ; Thu, 17 Nov 2011 10:33:05 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7i4OmimPuxp7 for ; Thu, 17 Nov 2011 10:33:05 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-yw0-f44.google.com (mail-yw0-f44.google.com [209.85.213.44]) by theia.denx.de (Postfix) with ESMTPS id 0C30D28890 for ; Thu, 17 Nov 2011 10:33:03 +0100 (CET) Received: by ywt34 with SMTP id 34so794413ywt.3 for ; Thu, 17 Nov 2011 01:33:02 -0800 (PST) Received: by 10.101.8.31 with SMTP id l31mr6005253ani.94.1321522382139; Thu, 17 Nov 2011 01:33:02 -0800 (PST) Received: from localhost.localdomain (d122-104-36-186.sbr6.nsw.optusnet.com.au. [122.104.36.186]) by mx.google.com with ESMTPS id h28sm9070979ani.17.2011.11.17.01.32.59 (version=SSLv3 cipher=OTHER); Thu, 17 Nov 2011 01:33:01 -0800 (PST) From: Graeme Russ To: u-boot@lists.denx.de Date: Thu, 17 Nov 2011 20:32:50 +1100 Message-Id: <1321522370-3098-1-git-send-email-graeme.russ@gmail.com> X-Mailer: git-send-email 1.7.5.2.317.g391b14 Cc: Graeme Russ Subject: [U-Boot] [PATCH 1/8] x86: Fix a few recently added bugs X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de From: Gabe Black Signed-off-by: Gabe Black Signed-off-by: Graeme Russ --- arch/x86/cpu/cpu.c | 1 + arch/x86/lib/board.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletions(-) diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c index 48d2f7a..61d0b69 100644 --- a/arch/x86/cpu/cpu.c +++ b/arch/x86/cpu/cpu.c @@ -37,6 +37,7 @@ #include #include #include +#include /* * Constructor for a conventional segment GDT (or LDT) entry diff --git a/arch/x86/lib/board.c b/arch/x86/lib/board.c index 18e0ede..d742fec 100644 --- a/arch/x86/lib/board.c +++ b/arch/x86/lib/board.c @@ -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 &&