9
0
Fork 0

Merge branch 'for-next/arm'

This commit is contained in:
Sascha Hauer 2012-10-03 21:10:11 +02:00
commit 4a543aa677
8 changed files with 36 additions and 24 deletions

View File

@ -36,6 +36,9 @@
unsigned long free_mem_ptr;
unsigned long free_mem_end_ptr;
/*
* First instructions in the pbl image
*/
void __naked __section(.text_head_entry) pbl_start(void)
{
barebox_arm_head();
@ -153,23 +156,17 @@ static void barebox_uncompress(void *compressed_start, unsigned int len)
* Board code can jump here by either returning from board_init_lowlevel
* or by calling this function directly.
*/
void __naked __section(.text_ll_return) board_init_lowlevel_return(void)
void __naked board_init_lowlevel_return(void)
{
uint32_t r, addr, offset;
uint32_t r, offset;
uint32_t pg_start, pg_end, pg_len;
/*
* Get runtime address of this function. Do not
* put any code above this.
*/
__asm__ __volatile__("1: adr %0, 1b":"=r"(addr));
/* Setup the stack */
r = STACK_BASE + STACK_SIZE - 16;
__asm__ __volatile__("mov sp, %0" : : "r"(r));
/* Get offset between linked address and runtime address */
offset = (uint32_t)__ll_return - addr;
offset = get_runtime_offset();
pg_start = (uint32_t)&input_data - offset;
pg_end = (uint32_t)&input_data_end - offset;

View File

@ -29,6 +29,9 @@
/*
* The actual reset vector. This code is position independent and usually
* does not run at the address it's linked at.
*
* This is either executed in the pbl image (if enabled) or in the regular
* image.
*/
void __naked __bare_init reset(void)
{

View File

@ -30,7 +30,7 @@
#ifdef CONFIG_PBL_IMAGE
/*
* First function in the pbl image. We get here from
* First function in the uncompressed image. We get here from
* the pbl.
*/
void __naked __section(.text_entry) start(void)
@ -47,6 +47,9 @@ void __naked __section(.text_entry) start(void)
}
#else
/*
* First function in the image without pbl support
*/
void __naked __section(.text_entry) start(void)
{
barebox_arm_head();
@ -56,22 +59,16 @@ void __naked __section(.text_entry) start(void)
* Board code can jump here by either returning from board_init_lowlevel
* or by calling this function directly.
*/
void __naked __section(.text_ll_return) board_init_lowlevel_return(void)
void __naked board_init_lowlevel_return(void)
{
uint32_t r, addr, offset;
/*
* Get runtime address of this function. Do not
* put any code above this.
*/
__asm__ __volatile__("1: adr %0, 1b":"=r"(addr));
uint32_t r, offset;
/* Setup the stack */
r = STACK_BASE + STACK_SIZE - 16;
__asm__ __volatile__("mov sp, %0" : : "r"(r));
/* Get offset between linked address and runtime address */
offset = (uint32_t)__ll_return - addr;
offset = get_runtime_offset();
/* relocate to link address if necessary */
if (offset)

View File

@ -37,10 +37,10 @@ int board_init(void);
int dram_init (void);
extern char __exceptions_start[], __exceptions_stop[];
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

@ -40,8 +40,6 @@ SECTIONS
_stext = .;
_text = .;
*(.text_entry*)
__ll_return = .;
*(.text_ll_return*)
__bare_init_start = .;
*(.text_bare_init*)
__bare_init_end = .;

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)

View File

@ -39,8 +39,6 @@ SECTIONS
_stext = .;
_text = .;
*(.text_head_entry*)
__ll_return = .;
*(.text_ll_return*)
__bare_init_start = .;
*(.text_bare_init*)
__bare_init_end = .;