From patchwork Wed Jan 4 19:59:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Graeme Russ X-Patchwork-Id: 134338 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 BE3071007D6 for ; Thu, 5 Jan 2012 07:00:29 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A05F528402; Wed, 4 Jan 2012 21:00:19 +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 PhJHgIaifuGu; Wed, 4 Jan 2012 21:00:19 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 89E6B283F5; Wed, 4 Jan 2012 21:00:12 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id F07F0283EF for ; Wed, 4 Jan 2012 21:00:09 +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 eBBiBjWuE6nQ for ; Wed, 4 Jan 2012 21:00:08 +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-vx0-f172.google.com (mail-vx0-f172.google.com [209.85.220.172]) by theia.denx.de (Postfix) with ESMTPS id 822D5283D0 for ; Wed, 4 Jan 2012 21:00:06 +0100 (CET) Received: by vcbfk13 with SMTP id fk13so13532083vcb.3 for ; Wed, 04 Jan 2012 12:00:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :in-reply-to; bh=vqMizWgh1/GYKlE7mB4jd5acoWMfoEYeD9LGdytMVqI=; b=wholeUIQtYkpNhD4H+wxKlMXChPzwx0rWqjzPZTuWHL5JL521Ks90M40RoyV1zH1IA Jx57yosrJADijarLwEAyw/znXJxOgPL6bSOoTI/f7Rhyxo0lPsmjMs74rW66WktjFpM8 j7P8j3Z3Vo5ZtUtP0GrDyNsu44ifgzG3ZXDbs= Received: by 10.220.107.73 with SMTP id a9mr33765392vcp.11.1325707205983; Wed, 04 Jan 2012 12:00:05 -0800 (PST) Received: from localhost.localdomain (d110-32-162-141.sbr801.nsw.optusnet.com.au. [110.32.162.141]) by mx.google.com with ESMTPS id eb3sm33049296vdc.5.2012.01.04.12.00.03 (version=SSLv3 cipher=OTHER); Wed, 04 Jan 2012 12:00:05 -0800 (PST) From: Graeme Russ To: u-boot@lists.denx.de Date: Thu, 5 Jan 2012 06:59:40 +1100 Message-Id: <1325707195-3218-2-git-send-email-graeme.russ@gmail.com> X-Mailer: git-send-email 1.7.5.2.317.g391b14 In-Reply-To: <1325707195-3218-1-git-send-email-graeme.russ@gmail.com> References: <1325707195-3218-1-git-send-email-graeme.russ@gmail.com> In-Reply-To: <1325477374-6417-3-git-send-email-graeme.russ@gmail.com> Subject: [U-Boot] [PATCH v2 02/17] x86: Speed up copy-to-RAM and clear BSS operations X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 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 The implementations of memcpy and memset are now the optimised versions from glibc, so use them instead of simple copy loops Signed-off-by: Graeme Russ Acked-by: Simon Glass --- Changes for v2: - Removed unneeded brackets arch/x86/lib/board.c | 17 +++++------------ 1 files changed, 5 insertions(+), 12 deletions(-) -- 1.7.5.2.317.g391b14 diff --git a/arch/x86/lib/board.c b/arch/x86/lib/board.c index d742fec..f9eb15b 100644 --- a/arch/x86/lib/board.c +++ b/arch/x86/lib/board.c @@ -188,26 +188,19 @@ static int calculate_relocation_address(void) static int copy_uboot_to_ram(void) { - ulong *dst_addr = (ulong *)gd->relocaddr; - ulong *src_addr = (ulong *)&__text_start; - ulong *end_addr = (ulong *)&__data_end; + size_t len = (size_t)&__data_end - (size_t)&__text_start; - while (src_addr < end_addr) - *dst_addr++ = *src_addr++; + memcpy((void *)gd->relocaddr, (void *)&__text_start, len); return 0; } static int clear_bss(void) { - void *bss_start = &__bss_start; - void *bss_end = &__bss_end; + ulong dst_addr = (ulong)&__bss_start + gd->reloc_off; + size_t len = (size_t)&__bss_end - (size_t)&__bss_start; - ulong *dst_addr = (ulong *)(bss_start + gd->reloc_off); - ulong *end_addr = (ulong *)(bss_end + gd->reloc_off); - - while (dst_addr < end_addr) - *dst_addr++ = 0x00000000; + memset((void *)dst_addr, 0x00, len); return 0; }