From patchwork Tue Jan 4 08:52:14 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Minkyu Kang X-Patchwork-Id: 77439 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 C39CBB70DA for ; Tue, 4 Jan 2011 20:30:19 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 53B8528126; Tue, 4 Jan 2011 10:30:15 +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 QAX8z-zExDgs; Tue, 4 Jan 2011 10:30:15 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3BEBB28155; Tue, 4 Jan 2011 10:30:13 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7409428155 for ; Tue, 4 Jan 2011 10:30:08 +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 iz0pfZK7jJPJ for ; Tue, 4 Jan 2011 10:30: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 mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by theia.denx.de (Postfix) with ESMTP id 0C64528126 for ; Tue, 4 Jan 2011 10:30:03 +0100 (CET) Received: from epmmp2 (mailout3.samsung.com [203.254.224.33]) by mailout3.samsung.com (Oracle Communications Messaging Exchange Server 7u4-19.01 64bit (built Sep 7 2010)) with ESMTP id <0LEH0023IPZ2HZ10@mailout3.samsung.com> for u-boot@lists.denx.de; Tue, 04 Jan 2011 17:52:14 +0900 (KST) Received: from TNRNDGASPAPP1.tn.corp.samsungelectronics.net ([165.213.149.150]) by mmp2.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0LEH00C0EPZ2CF@mmp2.samsung.com> for u-boot@lists.denx.de; Tue, 04 Jan 2011 17:52:14 +0900 (KST) Received: from [10.89.9.135] ([10.89.9.135]) by TNRNDGASPAPP1.tn.corp.samsungelectronics.net with Microsoft SMTPSVC(6.0.3790.4675); Tue, 04 Jan 2011 17:52:14 +0900 Date: Tue, 04 Jan 2011 17:52:14 +0900 From: Minkyu Kang In-reply-to: To: u-boot@lists.denx.de, albert.aribaud@free.fr Message-id: <4D22DFBE.8090503@samsung.com> MIME-version: 1.0 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; ko; rv:1.9.2.7) Gecko/20100713 Thunderbird/3.1.1 References: <4D186A13.4080004@samsung.com> X-OriginalArrivalTime: 04 Jan 2011 08:52:14.0225 (UTC) FILETIME=[AEBA0810:01CBABEC] Subject: [U-Boot] [PATCH v2, RFC] armv7: fixloop: don't fixup if location is invalid on RAM 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: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Need to check that location is valid on RAM before the fixup. Signed-off-by: Minkyu Kang --- arch/arm/cpu/armv7/start.S | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S index 684f2d2..a052378 100644 --- a/arch/arm/cpu/armv7/start.S +++ b/arch/arm/cpu/armv7/start.S @@ -195,6 +195,11 @@ copy_loop: add r3, r3, r0 /* r3 <- rel dyn end in FLASH */ fixloop: ldr r0, [r2] /* r0 <- location to fix up, IN FLASH! */ + ldr r7, _TEXT_BASE + cmp r0, r7 + blo fixskip + cmp r0, r6 + bhs fixskip add r0, r0, r9 /* r0 <- location to fix up in RAM */ ldr r1, [r2, #4] and r7, r1, #0xff @@ -217,6 +222,7 @@ fixrel: add r1, r1, r9 fixnext: str r1, [r0] +fixskip: add r2, r2, #8 /* each rel.dyn entry is 8 bytes */ cmp r2, r3 blo fixloop