]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
riscv: Fix context restore before returning from trap handler
authorBin Meng <bmeng.cn@gmail.com>
Wed, 12 Dec 2018 14:12:42 +0000 (06:12 -0800)
committerAndes <uboot@andestech.com>
Tue, 18 Dec 2018 01:56:27 +0000 (09:56 +0800)
sp cannot be loaded before restoring other registers.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Reviewed-by: Anup Patel <anup@brainfault.org>
arch/riscv/cpu/mtrap.S

index a5ad558621d848bdd152af2f4f5bfb779c607411..da307e4273bed072e70f75b344ef14a6821cc31f 100644 (file)
@@ -77,7 +77,6 @@ trap_entry:
 #endif
        csrs MODE_PREFIX(status), t0
        LREG x1,   1 * REGBYTES(sp)
-       LREG x2,   2 * REGBYTES(sp)
        LREG x3,   3 * REGBYTES(sp)
        LREG x4,   4 * REGBYTES(sp)
        LREG x5,   5 * REGBYTES(sp)
@@ -107,5 +106,6 @@ trap_entry:
        LREG x29, 29 * REGBYTES(sp)
        LREG x30, 30 * REGBYTES(sp)
        LREG x31, 31 * REGBYTES(sp)
+       LREG x2,   2 * REGBYTES(sp)
        addi sp, sp, 32 * REGBYTES
        MODE_PREFIX(ret)