mirror of
https://github.com/Stichting-MINIX-Research-Foundation/u-boot.git
synced 2025-09-12 13:35:21 -04:00
x86: Rework relocation calculations
This commit introduces no functional changes - It simply re-arranges the calculations so that adding to them in future commits will be cleaner -- Changes for v2: - Fixed typo in title - Added commit message
This commit is contained in:
parent
f48dd6fc6c
commit
240ab5aa21
@ -164,24 +164,23 @@ static int calculate_relocation_address(void)
|
|||||||
ulong text_start = (ulong)&__text_start;
|
ulong text_start = (ulong)&__text_start;
|
||||||
ulong bss_end = (ulong)&__bss_end;
|
ulong bss_end = (ulong)&__bss_end;
|
||||||
ulong dest_addr;
|
ulong dest_addr;
|
||||||
ulong rel_offset;
|
|
||||||
|
|
||||||
/* Calculate destination RAM Address and relocation offset */
|
|
||||||
dest_addr = gd->ram_size;
|
|
||||||
dest_addr -= CONFIG_SYS_STACK_SIZE;
|
|
||||||
dest_addr -= (bss_end - text_start);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Round destination address down to 16-byte boundary to keep
|
* NOTE: All destination address are rounded down to 16-byte
|
||||||
* IDT and GDT 16-byte aligned
|
* boundary to satisfy various worst-case alignment
|
||||||
|
* requirements
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* Stack is at top of available memory */
|
||||||
|
dest_addr = gd->ram_size;
|
||||||
|
gd->start_addr_sp = dest_addr;
|
||||||
|
|
||||||
|
/* U-Boot is below the stack */
|
||||||
|
dest_addr -= CONFIG_SYS_STACK_SIZE;
|
||||||
|
dest_addr -= (bss_end - text_start);
|
||||||
dest_addr &= ~15;
|
dest_addr &= ~15;
|
||||||
|
|
||||||
rel_offset = dest_addr - text_start;
|
|
||||||
|
|
||||||
gd->start_addr_sp = gd->ram_size;
|
|
||||||
gd->relocaddr = dest_addr;
|
gd->relocaddr = dest_addr;
|
||||||
gd->reloc_off = rel_offset;
|
gd->reloc_off = (dest_addr - text_start);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user