9
0
Fork 0

ARM: Add assembler function to get runtime offset

This function returns the offset between the address barebox is linked at
and the address barebox is currently running at.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2012-09-06 22:28:33 +02:00
parent f680f893b4
commit cc27564e4c
3 changed files with 20 additions and 0 deletions

View File

@ -42,5 +42,6 @@ extern char __ll_return[];
void board_init_lowlevel(void);
void board_init_lowlevel_return(void);
void arch_init_lowlevel(void);
uint32_t get_runtime_offset(void);
#endif /* _BAREBOX_ARM_H_ */

View File

@ -16,6 +16,8 @@ obj-y += lib1funcs.o
obj-y += ashrdi3.o
obj-y += ashldi3.o
obj-y += lshrdi3.o
obj-y += runtime-offset.o
pbl-y += runtime-offset.o
obj-$(CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS) += memcpy.o
obj-$(CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS) += memset.o
obj-$(CONFIG_ARM_UNWIND) += unwind.o

View File

@ -0,0 +1,17 @@
#include <linux/linkage.h>
#include <asm/assembler.h>
/*
* Get the offset between the link address and the address
* we are currently running at.
*/
ENTRY(get_runtime_offset)
1: adr r0, 1b
ldr r1, linkadr
subs r0, r1, r0
THUMB( subs r0, r0, #1)
mov pc, lr
linkadr:
.word get_runtime_offset
ENDPROC(get_runtime_offset)