summaryrefslogtreecommitdiffstats
path: root/arch/csky/abiv2
diff options
context:
space:
mode:
authorGuo Ren <guoren@linux.alibaba.com>2019-12-17 04:12:55 +0100
committerGuo Ren <guoren@linux.alibaba.com>2020-02-21 08:43:24 +0100
commitf8e17c17b81070f38062dce79ca7f4541851dadd (patch)
tree0de930c6cf557570a44beb5c167384ca0692d791 /arch/csky/abiv2
parentcsky/mm: Fixup export invalid_pte_table symbol (diff)
downloadlinux-f8e17c17b81070f38062dce79ca7f4541851dadd.tar.xz
linux-f8e17c17b81070f38062dce79ca7f4541851dadd.zip
csky: Set regs->usp to kernel sp, when the exception is from kernel
In the past, we didn't care about kernel sp when saving pt_reg. But in some cases, we still need pt_reg->usp to represent the kernel stack before enter exception. For cmpxhg in atomic.S, we need save and restore usp for above. Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
Diffstat (limited to 'arch/csky/abiv2')
-rw-r--r--arch/csky/abiv2/inc/abi/entry.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/arch/csky/abiv2/inc/abi/entry.h b/arch/csky/abiv2/inc/abi/entry.h
index 9897a16b45e5..94a7a58765df 100644
--- a/arch/csky/abiv2/inc/abi/entry.h
+++ b/arch/csky/abiv2/inc/abi/entry.h
@@ -31,7 +31,13 @@
mfcr lr, epsr
stw lr, (sp, 12)
+ btsti lr, 31
+ bf 1f
+ addi lr, sp, 152
+ br 2f
+1:
mfcr lr, usp
+2:
stw lr, (sp, 16)
stw a0, (sp, 20)
@@ -64,8 +70,10 @@
mtcr a0, epc
ldw a0, (sp, 12)
mtcr a0, epsr
+ btsti a0, 31
ldw a0, (sp, 16)
mtcr a0, usp
+ mtcr a0, ss0
#ifdef CONFIG_CPU_HAS_HILO
ldw a0, (sp, 140)
@@ -86,6 +94,9 @@
addi sp, 40
ldm r16-r30, (sp)
addi sp, 72
+ bf 1f
+ mfcr sp, ss0
+1:
rte
.endm