From patchwork Mon Jan 2 04:09:19 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Graeme Russ X-Patchwork-Id: 133777 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 2B56EB6FA2 for ; Mon, 2 Jan 2012 15:10:34 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8920F28198; Mon, 2 Jan 2012 05:10:18 +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 AIe3q7neS+vz; Mon, 2 Jan 2012 05:10:18 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7AEF0281DE; Mon, 2 Jan 2012 05:10:05 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7C0A328198 for ; Mon, 2 Jan 2012 05:09:57 +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 mrqvhZnYPHxu for ; Mon, 2 Jan 2012 05:09:57 +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-gx0-f172.google.com (mail-gx0-f172.google.com [209.85.161.172]) by theia.denx.de (Postfix) with ESMTPS id AD5FB28199 for ; Mon, 2 Jan 2012 05:09:55 +0100 (CET) Received: by ggnk5 with SMTP id k5so8859710ggn.3 for ; Sun, 01 Jan 2012 20:09:53 -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; bh=VDQjzmwDvJmUiHdJlQlYqNxadZVc7UR47LE0/S4EEzk=; b=qDx3GQmSkRDnY+YrHqdsAvWJTeT4a6w6TQNm/MiSwYQQzSOeqe/RHR5aoXaM1nAo+e s3oGYho3q6aZBsTtszFJPpgG/hcCcvAsomEi/BG4xOI7EZsoHvJJTyFUjif8HZnGEUBt 5X1RB7n0y2T1QKRwPeV8U2twIvQ207iHtyY6I= Received: by 10.101.160.5 with SMTP id m5mr18529710ano.65.1325477393900; Sun, 01 Jan 2012 20:09:53 -0800 (PST) Received: from localhost.localdomain (d58-106-85-147.sbr801.nsw.optusnet.com.au. [58.106.85.147]) by mx.google.com with ESMTPS id 9sm114431452any.3.2012.01.01.20.09.51 (version=SSLv3 cipher=OTHER); Sun, 01 Jan 2012 20:09:53 -0800 (PST) From: Graeme Russ To: u-boot@lists.denx.de Date: Mon, 2 Jan 2012 15:09:19 +1100 Message-Id: <1325477374-6417-3-git-send-email-graeme.russ@gmail.com> X-Mailer: git-send-email 1.7.5.2.317.g391b14 In-Reply-To: <1325477374-6417-1-git-send-email-graeme.russ@gmail.com> References: <1325477374-6417-1-git-send-email-graeme.russ@gmail.com> Subject: [U-Boot] [PATCH 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 --- arch/x86/lib/board.c | 17 +++++------------ 1 files changed, 5 insertions(+), 12 deletions(-) diff --git a/arch/x86/lib/board.c b/arch/x86/lib/board.c index d742fec..ba6b59f 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; }