summaryrefslogtreecommitdiffstats
path: root/arch/csky/abiv1
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/abiv1
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/abiv1')
-rw-r--r--arch/csky/abiv1/inc/abi/entry.h19
1 files changed, 14 insertions, 5 deletions
diff --git a/arch/csky/abiv1/inc/abi/entry.h b/arch/csky/abiv1/inc/abi/entry.h
index 7ab78bd0f3b1..f35a9f3315ee 100644
--- a/arch/csky/abiv1/inc/abi/entry.h
+++ b/arch/csky/abiv1/inc/abi/entry.h
@@ -16,14 +16,16 @@
#define LSAVE_A4 40
#define LSAVE_A5 44
+#define usp ss1
+
.macro USPTOKSP
- mtcr sp, ss1
+ mtcr sp, usp
mfcr sp, ss0
.endm
.macro KSPTOUSP
mtcr sp, ss0
- mfcr sp, ss1
+ mfcr sp, usp
.endm
.macro SAVE_ALL epc_inc
@@ -45,7 +47,13 @@
add lr, r13
stw lr, (sp, 8)
+ mov lr, sp
+ addi lr, 32
+ addi lr, 32
+ addi lr, 16
+ bt 2f
mfcr lr, ss1
+2:
stw lr, (sp, 16)
stw a0, (sp, 20)
@@ -79,9 +87,10 @@
ldw a0, (sp, 12)
mtcr a0, epsr
btsti a0, 31
+ bt 1f
ldw a0, (sp, 16)
mtcr a0, ss1
-
+1:
ldw a0, (sp, 24)
ldw a1, (sp, 28)
ldw a2, (sp, 32)
@@ -102,9 +111,9 @@
addi sp, 32
addi sp, 8
- bt 1f
+ bt 2f
KSPTOUSP
-1:
+2:
rte
.endm