mirror of
https://github.com/Stichting-MINIX-Research-Foundation/u-boot.git
synced 2025-09-10 12:39:22 -04:00
x86: Fix incorrect usage of relocation offset
x86 has always used relocation offset in the opposite sense to the ELF standard - Fix this
This commit is contained in:
parent
0b2378557c
commit
5fed82110d
@ -120,7 +120,7 @@ relocate_code:
|
|||||||
|
|
||||||
/* Setup call address of in-RAM copy of board_init_r() */
|
/* Setup call address of in-RAM copy of board_init_r() */
|
||||||
movl $board_init_r, %ebp
|
movl $board_init_r, %ebp
|
||||||
subl (GD_RELOC_OFF * 4)(%edx), %ebp
|
addl (GD_RELOC_OFF * 4)(%edx), %ebp
|
||||||
|
|
||||||
/* Setup parameters to board_init_r() */
|
/* Setup parameters to board_init_r() */
|
||||||
movl %edx, %eax
|
movl %edx, %eax
|
||||||
|
@ -214,7 +214,7 @@ void board_init_f(ulong boot_flags)
|
|||||||
addr_sp = dest_addr;
|
addr_sp = dest_addr;
|
||||||
dest_addr -= CONFIG_SYS_STACK_SIZE;
|
dest_addr -= CONFIG_SYS_STACK_SIZE;
|
||||||
dest_addr -= (bss_end - text_start);
|
dest_addr -= (bss_end - text_start);
|
||||||
rel_offset = text_start - dest_addr;
|
rel_offset = dest_addr - text_start;
|
||||||
|
|
||||||
/* First stage CPU initialization */
|
/* First stage CPU initialization */
|
||||||
if (cpu_init_f() != 0)
|
if (cpu_init_f() != 0)
|
||||||
@ -233,8 +233,8 @@ void board_init_f(ulong boot_flags)
|
|||||||
*dst_addr++ = *src_addr++;
|
*dst_addr++ = *src_addr++;
|
||||||
|
|
||||||
/* Clear BSS */
|
/* Clear BSS */
|
||||||
dst_addr = (ulong *)(bss_start - rel_offset);
|
dst_addr = (ulong *)(bss_start + rel_offset);
|
||||||
end_addr = (ulong *)(bss_end - rel_offset);
|
end_addr = (ulong *)(bss_end + rel_offset);
|
||||||
|
|
||||||
while (dst_addr < end_addr)
|
while (dst_addr < end_addr)
|
||||||
*dst_addr++ = 0x00000000;
|
*dst_addr++ = 0x00000000;
|
||||||
@ -245,8 +245,8 @@ void board_init_f(ulong boot_flags)
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
if (re_src->r_offset >= CONFIG_SYS_TEXT_BASE)
|
if (re_src->r_offset >= CONFIG_SYS_TEXT_BASE)
|
||||||
if (*(Elf32_Addr *)(re_src->r_offset - rel_offset) >= CONFIG_SYS_TEXT_BASE)
|
if (*(Elf32_Addr *)(re_src->r_offset + rel_offset) >= CONFIG_SYS_TEXT_BASE)
|
||||||
*(Elf32_Addr *)(re_src->r_offset - rel_offset) -= rel_offset;
|
*(Elf32_Addr *)(re_src->r_offset + rel_offset) += rel_offset;
|
||||||
} while (re_src++ < re_end);
|
} while (re_src++ < re_end);
|
||||||
|
|
||||||
gd->reloc_off = rel_offset;
|
gd->reloc_off = rel_offset;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user