diff options
author | Vincent Chen <vincent.chen@sifive.com> | 2021-03-17 09:16:37 +0800 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2021-03-19 14:57:45 +0530 |
commit | 22d8ee9758128070aa838f7c8c46f9e50d6aaf5a (patch) | |
tree | 88720d8e0c1dd680d61cfe515dc0d5076c4f96c7 /firmware/payloads | |
parent | ff5bd949d55b14e1d308288ace71366b090f822d (diff) |
firmware: Use lla to access all global symbols
When OpenSBI is compiled as fPIE mode, the assembler will translate "la"
to GOT reference pattern. It will cause to cost an additional load
instruction when obtaining the symbol address. However, if the symbol
locates within the positive or negative 2GB region, we can use "lla"
instead of "la" to avoid unneeded GOT references. This patch assumes that
the OpenSBI image excluding the payload does not exceed 2GB. Based on
this assumption, all "la" instructions are replaced by "lla" to avoid
performance degradation when compiling as fPIE mode.
Signed-off-by: Vincent Chen <vincent.chen@sifive.com>
Reviewed-by: Anup Patel <anup.patel@wdc.com>
Diffstat (limited to 'firmware/payloads')
-rw-r--r-- | firmware/payloads/test_head.S | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/firmware/payloads/test_head.S b/firmware/payloads/test_head.S index 840013e..4852f71 100644 --- a/firmware/payloads/test_head.S +++ b/firmware/payloads/test_head.S @@ -28,20 +28,20 @@ .globl _start _start: /* Pick one hart to run the main boot sequence */ - la a3, _hart_lottery + lla a3, _hart_lottery li a2, 1 amoadd.w a3, a2, (a3) bnez a3, _start_hang /* Save a0 and a1 */ - la a3, _boot_a0 + lla a3, _boot_a0 REG_S a0, 0(a3) - la a3, _boot_a1 + lla a3, _boot_a1 REG_S a1, 0(a3) /* Zero-out BSS */ - la a4, _bss_start - la a5, _bss_end + lla a4, _bss_start + lla a5, _bss_end _bss_zero: REG_S zero, (a4) add a4, a4, __SIZEOF_POINTER__ @@ -53,18 +53,18 @@ _start_warm: csrw CSR_SIP, zero /* Setup exception vectors */ - la a3, _start_hang + lla a3, _start_hang csrw CSR_STVEC, a3 /* Setup stack */ - la a3, _payload_end + lla a3, _payload_end li a4, 0x2000 add sp, a3, a4 /* Jump to C main */ - la a3, _boot_a0 + lla a3, _boot_a0 REG_L a0, 0(a3) - la a3, _boot_a1 + lla a3, _boot_a1 REG_L a1, 0(a3) call test_main |