summaryrefslogtreecommitdiffstats
path: root/arch/arm/cpu/start-pbl.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-10-03 14:27:52 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2012-10-05 18:39:19 +0200
commit1fcc223e9f844bc7606840effd1d5b7405785df5 (patch)
treec7dc9efe4f688a6b9b9adccb39ba2b905c480667 /arch/arm/cpu/start-pbl.c
parent3c272204e67bb87eacd5a3e070305c401dce59c3 (diff)
downloadbarebox-1fcc223e9f844bc7606840effd1d5b7405785df5.tar.gz
barebox-1fcc223e9f844bc7606840effd1d5b7405785df5.tar.xz
ARM: add assembly function for setting up C environment
Sometimes Assembler beats C. In this case a small assembler function called without parameters can: - copy a binary to its link address - clear the bss - return to the same position in the copied binary Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/cpu/start-pbl.c')
-rw-r--r--arch/arm/cpu/start-pbl.c19
1 files changed, 2 insertions, 17 deletions
diff --git a/arch/arm/cpu/start-pbl.c b/arch/arm/cpu/start-pbl.c
index 0467dfe832..1298ca08ee 100644
--- a/arch/arm/cpu/start-pbl.c
+++ b/arch/arm/cpu/start-pbl.c
@@ -208,23 +208,8 @@ copy_piggy_link:
pg_start = (uint32_t)&input_data;
copy_link:
- /* relocate to link address if necessary */
- if (offset)
- memcpy((void *)_text, (void *)(_text - offset),
- __bss_start - _text);
- /* clear bss */
- memset(__bss_start, 0, __bss_stop - __bss_start);
+ setup_c();
- flush_icache();
-
- r = (unsigned int)&barebox_uncompress;
- /* call barebox_uncompress with its absolute address */
- __asm__ __volatile__(
- "mov r0, %1\n"
- "mov r1, %2\n"
- "mov pc, %0\n"
- :
- : "r"(r), "r"(pg_start), "r"(pg_len)
- : "r0", "r1");
+ barebox_uncompress((void *)pg_start, pg_len);
}