]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
csky: add arch support current_stack_pointer
authorTong Tiangen <tongtiangen@huawei.com>
Sat, 22 Oct 2022 01:43:40 +0000 (01:43 +0000)
committerGuo Ren <guoren@linux.alibaba.com>
Sat, 22 Oct 2022 03:52:29 +0000 (23:52 -0400)
To follow the existing per-arch conventions, using "current_stack_pointer"
to set sp.

This will let it be used in non-arch places(like HARDENED_USERCOPY).

Refer to the implementation of riscv commit fdecfea09328 ("riscv: Rename
"sp_in_global" to "current_stack_pointer"").

Link: https://lore.kernel.org/lkml/20220224060411.1855683-1-keescook@chromium.org/
Signed-off-by: Tong Tiangen <tongtiangen@huawei.com>
Signed-off-by: Guo Ren <guoren@kernel.org>
arch/csky/Kconfig
arch/csky/include/asm/processor.h
arch/csky/kernel/stacktrace.c

index adee6ab36862e6a1a2a92ff68bfd93f57d0fd14c..2236b5c0c2136ce0b637914f594deef2a4898e5e 100644 (file)
@@ -9,6 +9,7 @@ config CSKY
        select ARCH_USE_BUILTIN_BSWAP
        select ARCH_USE_QUEUED_RWLOCKS
        select ARCH_USE_QUEUED_SPINLOCKS
+       select ARCH_HAS_CURRENT_STACK_POINTER
        select ARCH_INLINE_READ_LOCK if !PREEMPTION
        select ARCH_INLINE_READ_LOCK_BH if !PREEMPTION
        select ARCH_INLINE_READ_LOCK_IRQ if !PREEMPTION
index 63ad71fab30d7bbe5af9a42b7581e3c486554a41..ea75d72dea86966232dd4b04ec4fa4ea419ef784 100644 (file)
@@ -84,4 +84,6 @@ unsigned long __get_wchan(struct task_struct *p);
 
 #define cpu_relax() barrier()
 
+register unsigned long current_stack_pointer __asm__("sp");
+
 #endif /* __ASM_CSKY_PROCESSOR_H */
index 9f78f5d2151172460d3effa09358b9a814a903df..27ecd63e321bba5e8d62f837e40e73e596441856 100644 (file)
@@ -23,10 +23,9 @@ void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs,
                sp = user_stack_pointer(regs);
                pc = instruction_pointer(regs);
        } else if (task == NULL || task == current) {
-               const register unsigned long current_sp __asm__ ("sp");
                const register unsigned long current_fp __asm__ ("r8");
                fp = current_fp;
-               sp = current_sp;
+               sp = current_stack_pointer;
                pc = (unsigned long)walk_stackframe;
        } else {
                /* task blocked in __switch_to */
@@ -68,8 +67,7 @@ static void notrace walk_stackframe(struct task_struct *task,
                sp = user_stack_pointer(regs);
                pc = instruction_pointer(regs);
        } else if (task == NULL || task == current) {
-               const register unsigned long current_sp __asm__ ("sp");
-               sp = current_sp;
+               sp = current_stack_pointer;
                pc = (unsigned long)walk_stackframe;
        } else {
                /* task blocked in __switch_to */