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
This commit is contained in:
Graeme Russ 2011-12-27 22:46:41 +11:00
parent b2c2a03842
commit 1176a7067a
1 changed files with 5 additions and 12 deletions

View File

@ -188,26 +188,19 @@ static int calculate_relocation_address(void)
static int copy_uboot_to_ram(void) static int copy_uboot_to_ram(void)
{ {
ulong *dst_addr = (ulong *)gd->relocaddr; size_t len = (size_t)&__data_end - (size_t)&__text_start;
ulong *src_addr = (ulong *)&__text_start;
ulong *end_addr = (ulong *)&__data_end;
while (src_addr < end_addr) memcpy((void *)gd->relocaddr, (void *)&__text_start, len);
*dst_addr++ = *src_addr++;
return 0; return 0;
} }
static int clear_bss(void) static int clear_bss(void)
{ {
void *bss_start = &__bss_start; ulong dst_addr = (ulong)&__bss_start + gd->reloc_off;
void *bss_end = &__bss_end; size_t len = (size_t)&__bss_end - (size_t)&__bss_start;
ulong *dst_addr = (ulong *)(bss_start + gd->reloc_off); memset((void *)dst_addr, 0x00, len);
ulong *end_addr = (ulong *)(bss_end + gd->reloc_off);
while (dst_addr < end_addr)
*dst_addr++ = 0x00000000;
return 0; return 0;
} }