mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-19 21:51:31 +00:00
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>
This commit is contained in:
parent
b59c13d42f
commit
c48e9f310b
1 changed files with 3 additions and 0 deletions
|
@ -111,6 +111,9 @@ ulong handle_trap(ulong cause, ulong epc, ulong tval, struct pt_regs *regs)
|
|||
{
|
||||
ulong is_irq, irq;
|
||||
|
||||
/* An UEFI application may have changed gd. Restore U-Boot's gd. */
|
||||
efi_restore_gd();
|
||||
|
||||
is_irq = (cause & MCAUSE_INT);
|
||||
irq = (cause & ~MCAUSE_INT);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue