xref: /linux/arch/parisc/include/asm/thread_info.h (revision d4b996f9ef1fe83d9ce9ad5c1ca0bd8231638ce5)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_PARISC_THREAD_INFO_H
3 #define _ASM_PARISC_THREAD_INFO_H
4 
5 #ifdef __KERNEL__
6 
7 #ifndef __ASSEMBLY__
8 #include <asm/processor.h>
9 #include <asm/special_insns.h>
10 
11 struct thread_info {
12 	struct task_struct *task;	/* main task structure */
13 	unsigned long flags;		/* thread_info flags (see TIF_*) */
14 	mm_segment_t addr_limit;	/* user-level address space limit */
15 	__u32 cpu;			/* current CPU */
16 	int preempt_count;		/* 0=premptable, <0=BUG; will also serve as bh-counter */
17 };
18 
19 #define INIT_THREAD_INFO(tsk)			\
20 {						\
21 	.task		= &tsk,			\
22 	.flags		= 0,			\
23 	.cpu		= 0,			\
24 	.addr_limit	= KERNEL_DS,		\
25 	.preempt_count	= INIT_PREEMPT_COUNT,	\
26 }
27 
28 /* how to get the thread information struct from C */
29 #define current_thread_info()	((struct thread_info *)mfctl(30))
30 
31 #endif /* !__ASSEMBLY */
32 
33 /* thread information allocation */
34 
35 #ifdef CONFIG_IRQSTACKS
36 #define THREAD_SIZE_ORDER	2 /* PA-RISC requires at least 16k stack */
37 #else
38 #define THREAD_SIZE_ORDER	3 /* PA-RISC requires at least 32k stack */
39 #endif
40 
41 /* Be sure to hunt all references to this down when you change the size of
42  * the kernel stack */
43 #define THREAD_SIZE             (PAGE_SIZE << THREAD_SIZE_ORDER)
44 #define THREAD_SHIFT            (PAGE_SHIFT + THREAD_SIZE_ORDER)
45 
46 /*
47  * thread information flags
48  */
49 #define TIF_SYSCALL_TRACE	0	/* syscall trace active */
50 #define TIF_SIGPENDING		1	/* signal pending */
51 #define TIF_NEED_RESCHED	2	/* rescheduling necessary */
52 #define TIF_POLLING_NRFLAG	3	/* true if poll_idle() is polling TIF_NEED_RESCHED */
53 #define TIF_32BIT               4       /* 32 bit binary */
54 #define TIF_MEMDIE		5	/* is terminating due to OOM killer */
55 #define TIF_NOTIFY_SIGNAL	6	/* signal notifications exist */
56 #define TIF_SYSCALL_AUDIT	7	/* syscall auditing active */
57 #define TIF_NOTIFY_RESUME	8	/* callback before returning to user */
58 #define TIF_SINGLESTEP		9	/* single stepping? */
59 #define TIF_BLOCKSTEP		10	/* branch stepping? */
60 #define TIF_SECCOMP		11	/* secure computing */
61 #define TIF_SYSCALL_TRACEPOINT	12	/* syscall tracepoint instrumentation */
62 
63 #define _TIF_SYSCALL_TRACE	(1 << TIF_SYSCALL_TRACE)
64 #define _TIF_SIGPENDING		(1 << TIF_SIGPENDING)
65 #define _TIF_NOTIFY_SIGNAL	(1 << TIF_NOTIFY_SIGNAL)
66 #define _TIF_NEED_RESCHED	(1 << TIF_NEED_RESCHED)
67 #define _TIF_POLLING_NRFLAG	(1 << TIF_POLLING_NRFLAG)
68 #define _TIF_32BIT		(1 << TIF_32BIT)
69 #define _TIF_SYSCALL_AUDIT	(1 << TIF_SYSCALL_AUDIT)
70 #define _TIF_NOTIFY_RESUME	(1 << TIF_NOTIFY_RESUME)
71 #define _TIF_SINGLESTEP		(1 << TIF_SINGLESTEP)
72 #define _TIF_BLOCKSTEP		(1 << TIF_BLOCKSTEP)
73 #define _TIF_SECCOMP		(1 << TIF_SECCOMP)
74 #define _TIF_SYSCALL_TRACEPOINT	(1 << TIF_SYSCALL_TRACEPOINT)
75 
76 #define _TIF_USER_WORK_MASK     (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | \
77                                  _TIF_NEED_RESCHED | _TIF_NOTIFY_SIGNAL)
78 #define _TIF_SYSCALL_TRACE_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP |	\
79 				 _TIF_BLOCKSTEP | _TIF_SYSCALL_AUDIT | \
80 				 _TIF_SECCOMP | _TIF_SYSCALL_TRACEPOINT)
81 
82 #ifdef CONFIG_64BIT
83 # ifdef CONFIG_COMPAT
84 #  define is_32bit_task()	(test_thread_flag(TIF_32BIT))
85 # else
86 #  define is_32bit_task()	(0)
87 # endif
88 #else
89 # define is_32bit_task()	(1)
90 #endif
91 
92 #endif /* __KERNEL__ */
93 
94 #endif /* _ASM_PARISC_THREAD_INFO_H */
95