diff options
author | Guo Ren <guoren@linux.alibaba.com> | 2019-12-17 04:12:55 +0100 |
---|---|---|
committer | Guo Ren <guoren@linux.alibaba.com> | 2020-02-21 08:43:24 +0100 |
commit | f8e17c17b81070f38062dce79ca7f4541851dadd (patch) | |
tree | 0de930c6cf557570a44beb5c167384ca0692d791 /arch/csky/kernel/atomic.S | |
parent | csky/mm: Fixup export invalid_pte_table symbol (diff) | |
download | linux-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/kernel/atomic.S')
-rw-r--r-- | arch/csky/kernel/atomic.S | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/arch/csky/kernel/atomic.S b/arch/csky/kernel/atomic.S index 5b84f11485ae..3821ef9b7567 100644 --- a/arch/csky/kernel/atomic.S +++ b/arch/csky/kernel/atomic.S @@ -17,10 +17,12 @@ ENTRY(csky_cmpxchg) mfcr a3, epc addi a3, TRAP0_SIZE - subi sp, 8 + subi sp, 16 stw a3, (sp, 0) mfcr a3, epsr stw a3, (sp, 4) + mfcr a3, usp + stw a3, (sp, 8) psrset ee #ifdef CONFIG_CPU_HAS_LDSTEX @@ -47,7 +49,9 @@ ENTRY(csky_cmpxchg) mtcr a3, epc ldw a3, (sp, 4) mtcr a3, epsr - addi sp, 8 + ldw a3, (sp, 8) + mtcr a3, usp + addi sp, 16 KSPTOUSP rte END(csky_cmpxchg) |