firmware: fw_base: Optimize trap handler for RV32 systems
authorAnup Patel <anup.patel@wdc.com>
Sun, 22 Nov 2020 06:17:22 +0000 (11:47 +0530)
committerAnup Patel <anup@brainfault.org>
Tue, 1 Dec 2020 11:44:32 +0000 (17:14 +0530)
commit2677324f906133db8596de4868df87cb1224f113
tree9ba4085aa7bd74ce779051dca067fe427064b6bf
parent548d03e577490f74af8b57706655e5d81c9b94a1
firmware: fw_base: Optimize trap handler for RV32 systems

On RV32 systems, we have two CSRs for M-mode status (MSTATUS and
MSTATUSH) when H-extension is implemented. This means we have to
save/restore MSTATUSH for RV32 systems only when H-extension is
implemented. The current _trap_handler() has extra instructions
(roughly 10) for conditional save/restore of MSTATUSH CSR.

These extra instructions in RV32 _trap_handler() can be avoided
if we create separate low-level trap handler for RV32 systems
having H-extension. This patch optimizes low-level trap handler
for RV32 systems accordingly.

Signed-off-by: Anup Patel <anup.patel@wdc.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
firmware/fw_base.S