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