]> git.dujemihanovic.xyz Git - u-boot.git/commit
riscv: restore global data pointer in trap handler
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Sat, 26 Sep 2020 05:50:36 +0000 (07:50 +0200)
committerHeinrich Schuchardt <xypron.glpk@gmx.de>
Mon, 28 Sep 2020 10:20:19 +0000 (12:20 +0200)
commitc48e9f310b950e39a91cea74b6708dd4fe2eb39c
tree6d32a1601de2a11a4fd3f8b2152ebd42a431171e
parentb59c13d42f42811912fd08f32f11e68a8e708c00
riscv: restore global data pointer in trap handler

The gp register is used to store U-Boot's global data pointer. We should
not assume that an UEFI application leaves the gp register unchanged as
the UEFI specifications does not define who is the owner of the gp and tp
registers.

So the following sequence should be followed in the trap handler:

* save the caller's gp register
* restore the global data pointer
* serve interrupts or print crash dump and reset
* restore the caller's gp register

Cc: Abner Chang <abner.chang@hpe.com>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Rick Chen <rick@andestech.com>
arch/riscv/lib/interrupts.c