mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-29 05:44:11 +00:00
csky: add arch support current_stack_pointer
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 fdecfea093
("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>
This commit is contained in:
parent
9abf2313ad
commit
b203c67ebe
3 changed files with 5 additions and 4 deletions
|
@ -9,6 +9,7 @@ config CSKY
|
||||||
select ARCH_USE_BUILTIN_BSWAP
|
select ARCH_USE_BUILTIN_BSWAP
|
||||||
select ARCH_USE_QUEUED_RWLOCKS
|
select ARCH_USE_QUEUED_RWLOCKS
|
||||||
select ARCH_USE_QUEUED_SPINLOCKS
|
select ARCH_USE_QUEUED_SPINLOCKS
|
||||||
|
select ARCH_HAS_CURRENT_STACK_POINTER
|
||||||
select ARCH_INLINE_READ_LOCK if !PREEMPTION
|
select ARCH_INLINE_READ_LOCK if !PREEMPTION
|
||||||
select ARCH_INLINE_READ_LOCK_BH if !PREEMPTION
|
select ARCH_INLINE_READ_LOCK_BH if !PREEMPTION
|
||||||
select ARCH_INLINE_READ_LOCK_IRQ if !PREEMPTION
|
select ARCH_INLINE_READ_LOCK_IRQ if !PREEMPTION
|
||||||
|
|
|
@ -84,4 +84,6 @@ unsigned long __get_wchan(struct task_struct *p);
|
||||||
|
|
||||||
#define cpu_relax() barrier()
|
#define cpu_relax() barrier()
|
||||||
|
|
||||||
|
register unsigned long current_stack_pointer __asm__("sp");
|
||||||
|
|
||||||
#endif /* __ASM_CSKY_PROCESSOR_H */
|
#endif /* __ASM_CSKY_PROCESSOR_H */
|
||||||
|
|
|
@ -23,10 +23,9 @@ void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs,
|
||||||
sp = user_stack_pointer(regs);
|
sp = user_stack_pointer(regs);
|
||||||
pc = instruction_pointer(regs);
|
pc = instruction_pointer(regs);
|
||||||
} else if (task == NULL || task == current) {
|
} else if (task == NULL || task == current) {
|
||||||
const register unsigned long current_sp __asm__ ("sp");
|
|
||||||
const register unsigned long current_fp __asm__ ("r8");
|
const register unsigned long current_fp __asm__ ("r8");
|
||||||
fp = current_fp;
|
fp = current_fp;
|
||||||
sp = current_sp;
|
sp = current_stack_pointer;
|
||||||
pc = (unsigned long)walk_stackframe;
|
pc = (unsigned long)walk_stackframe;
|
||||||
} else {
|
} else {
|
||||||
/* task blocked in __switch_to */
|
/* task blocked in __switch_to */
|
||||||
|
@ -68,8 +67,7 @@ static void notrace walk_stackframe(struct task_struct *task,
|
||||||
sp = user_stack_pointer(regs);
|
sp = user_stack_pointer(regs);
|
||||||
pc = instruction_pointer(regs);
|
pc = instruction_pointer(regs);
|
||||||
} else if (task == NULL || task == current) {
|
} else if (task == NULL || task == current) {
|
||||||
const register unsigned long current_sp __asm__ ("sp");
|
sp = current_stack_pointer;
|
||||||
sp = current_sp;
|
|
||||||
pc = (unsigned long)walk_stackframe;
|
pc = (unsigned long)walk_stackframe;
|
||||||
} else {
|
} else {
|
||||||
/* task blocked in __switch_to */
|
/* task blocked in __switch_to */
|
||||||
|
|
Loading…
Reference in a new issue