1 /* SPDX-License-Identifier: GPL-2.0 */ 2 3 #ifndef _ASM_CSKY_THREAD_INFO_H 4 #define _ASM_CSKY_THREAD_INFO_H 5 6 #ifndef __ASSEMBLY__ 7 8 #include <asm/types.h> 9 #include <asm/page.h> 10 #include <asm/processor.h> 11 #include <abi/switch_context.h> 12 13 struct thread_info { 14 struct task_struct *task; 15 void *dump_exec_domain; 16 unsigned long flags; 17 int preempt_count; 18 unsigned long tp_value; 19 mm_segment_t addr_limit; 20 struct restart_block restart_block; 21 struct pt_regs *regs; 22 unsigned int cpu; 23 }; 24 25 #define INIT_THREAD_INFO(tsk) \ 26 { \ 27 .task = &tsk, \ 28 .preempt_count = INIT_PREEMPT_COUNT, \ 29 .addr_limit = KERNEL_DS, \ 30 .cpu = 0, \ 31 .restart_block = { \ 32 .fn = do_no_restart_syscall, \ 33 }, \ 34 } 35 36 #define THREAD_SIZE_ORDER (THREAD_SHIFT - PAGE_SHIFT) 37 38 #define thread_saved_fp(tsk) \ 39 ((unsigned long)(((struct switch_stack *)(tsk->thread.sp))->r8)) 40 41 #define thread_saved_sp(tsk) \ 42 ((unsigned long)(tsk->thread.sp)) 43 44 #define thread_saved_lr(tsk) \ 45 ((unsigned long)(((struct switch_stack *)(tsk->thread.sp))->r15)) 46 47 static inline struct thread_info *current_thread_info(void) 48 { 49 unsigned long sp; 50 51 asm volatile("mov %0, sp\n":"=r"(sp)); 52 53 return (struct thread_info *)(sp & ~(THREAD_SIZE - 1)); 54 } 55 56 #endif /* !__ASSEMBLY__ */ 57 58 #define TIF_SIGPENDING 0 /* signal pending */ 59 #define TIF_NOTIFY_RESUME 1 /* callback before returning to user */ 60 #define TIF_NEED_RESCHED 2 /* rescheduling necessary */ 61 #define TIF_UPROBE 3 /* uprobe breakpoint or singlestep */ 62 #define TIF_SYSCALL_TRACE 4 /* syscall trace active */ 63 #define TIF_SYSCALL_TRACEPOINT 5 /* syscall tracepoint instrumentation */ 64 #define TIF_SYSCALL_AUDIT 6 /* syscall auditing */ 65 #define TIF_NOTIFY_SIGNAL 7 /* signal notifications exist */ 66 #define TIF_POLLING_NRFLAG 16 /* poll_idle() is TIF_NEED_RESCHED */ 67 #define TIF_MEMDIE 18 /* is terminating due to OOM killer */ 68 #define TIF_RESTORE_SIGMASK 20 /* restore signal mask in do_signal() */ 69 #define TIF_SECCOMP 21 /* secure computing */ 70 71 #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) 72 #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) 73 #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) 74 #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) 75 #define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT) 76 #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) 77 #define _TIF_NOTIFY_SIGNAL (1 << TIF_NOTIFY_SIGNAL) 78 #define _TIF_UPROBE (1 << TIF_UPROBE) 79 #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) 80 #define _TIF_MEMDIE (1 << TIF_MEMDIE) 81 #define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK) 82 #define _TIF_SECCOMP (1 << TIF_SECCOMP) 83 84 #define _TIF_WORK_MASK (_TIF_NEED_RESCHED | _TIF_SIGPENDING | \ 85 _TIF_NOTIFY_RESUME | _TIF_UPROBE | \ 86 _TIF_NOTIFY_SIGNAL) 87 88 #define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \ 89 _TIF_SYSCALL_TRACEPOINT | _TIF_SECCOMP) 90 91 #endif /* _ASM_CSKY_THREAD_INFO_H */ 92