firmware: use _fw_start for load address

The previous code uses _start as the load address, this default .entry is
the first segment, using _fw_start does not need to make this assumption.

Signed-off-by: Xiang W <wxjstz@126.com>
Reviewed-by: Anup Patel <anup.patel@wdc.com>
This commit is contained in:
Xiang W 2021-07-14 15:14:39 +08:00 committed by Anup Patel
parent 989039117f
commit 74db0acbe5
2 changed files with 4 additions and 4 deletions

View file

@ -65,14 +65,14 @@ _try_lottery:
/* Save load address */ /* Save load address */
lla t0, _load_start lla t0, _load_start
lla t1, _start lla t1, _fw_start
REG_S t1, 0(t0) REG_S t1, 0(t0)
#ifdef FW_PIC #ifdef FW_PIC
/* relocate the global table content */ /* relocate the global table content */
lla t0, _link_start lla t0, _link_start
REG_L t0, 0(t0) REG_L t0, 0(t0)
/* t1 shall has the address of _start */ /* t1 shall has the address of _fw_start */
sub t2, t1, t0 sub t2, t1, t0
lla t3, _runtime_offset lla t3, _runtime_offset
REG_S t2, (t3) REG_S t2, (t3)
@ -172,7 +172,7 @@ _relocate_copy_to_upper_loop:
blt t0, t1, _relocate_copy_to_upper_loop blt t0, t1, _relocate_copy_to_upper_loop
jr t4 jr t4
_wait_relocate_copy_done: _wait_relocate_copy_done:
lla t0, _start lla t0, _fw_start
lla t1, _link_start lla t1, _link_start
REG_L t1, 0(t1) REG_L t1, 0(t1)
beq t0, t1, _wait_for_boot_hart beq t0, t1, _wait_for_boot_hart

View file

@ -8,7 +8,7 @@
*/ */
. = FW_TEXT_START; . = FW_TEXT_START;
/* Don't add any section between FW_TEXT_START and _fw_start */
PROVIDE(_fw_start = .); PROVIDE(_fw_start = .);
. = ALIGN(0x1000); /* Need this to create proper sections */ . = ALIGN(0x1000); /* Need this to create proper sections */