summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorGraeme Russ <graeme.russ@gmail.com>2011-12-27 22:46:41 +1100
committerGraeme Russ <graeme.russ@gmail.com>2012-01-04 21:05:00 +1100
commit1176a7067a89e68bbb1872b234f67bd2f4651051 (patch)
treef798c3dfbe3a56b95ebe03e8d8fdd1b807ea5ee8 /arch
parentb2c2a038426f651c574a97a02563f78c2dceaa89 (diff)
downloadu-boot-imx-1176a7067a89e68bbb1872b234f67bd2f4651051.zip
u-boot-imx-1176a7067a89e68bbb1872b234f67bd2f4651051.tar.gz
u-boot-imx-1176a7067a89e68bbb1872b234f67bd2f4651051.tar.bz2
x86: Speed up copy-to-RAM and clear BSS operations
The implementations of memcpy and memset are now the optimised versions from glibc, so use them instead of simple copy loops -- Changes for v2: - Removed unneeded brackets
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/lib/board.c17
1 files changed, 5 insertions, 12 deletions
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;
}