18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef _ASM_PARISC_THREAD_INFO_H
38c2ecf20Sopenharmony_ci#define _ASM_PARISC_THREAD_INFO_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#ifdef __KERNEL__
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__
88c2ecf20Sopenharmony_ci#include <asm/processor.h>
98c2ecf20Sopenharmony_ci#include <asm/special_insns.h>
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_cistruct thread_info {
128c2ecf20Sopenharmony_ci	struct task_struct *task;	/* main task structure */
138c2ecf20Sopenharmony_ci	unsigned long flags;		/* thread_info flags (see TIF_*) */
148c2ecf20Sopenharmony_ci	mm_segment_t addr_limit;	/* user-level address space limit */
158c2ecf20Sopenharmony_ci	__u32 cpu;			/* current CPU */
168c2ecf20Sopenharmony_ci	int preempt_count;		/* 0=premptable, <0=BUG; will also serve as bh-counter */
178c2ecf20Sopenharmony_ci};
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci#define INIT_THREAD_INFO(tsk)			\
208c2ecf20Sopenharmony_ci{						\
218c2ecf20Sopenharmony_ci	.task		= &tsk,			\
228c2ecf20Sopenharmony_ci	.flags		= 0,			\
238c2ecf20Sopenharmony_ci	.cpu		= 0,			\
248c2ecf20Sopenharmony_ci	.addr_limit	= KERNEL_DS,		\
258c2ecf20Sopenharmony_ci	.preempt_count	= INIT_PREEMPT_COUNT,	\
268c2ecf20Sopenharmony_ci}
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci/* how to get the thread information struct from C */
298c2ecf20Sopenharmony_ci#define current_thread_info()	((struct thread_info *)mfctl(30))
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci#endif /* !__ASSEMBLY */
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci/* thread information allocation */
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#ifdef CONFIG_IRQSTACKS
368c2ecf20Sopenharmony_ci#define THREAD_SIZE_ORDER	2 /* PA-RISC requires at least 16k stack */
378c2ecf20Sopenharmony_ci#else
388c2ecf20Sopenharmony_ci#define THREAD_SIZE_ORDER	3 /* PA-RISC requires at least 32k stack */
398c2ecf20Sopenharmony_ci#endif
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci/* Be sure to hunt all references to this down when you change the size of
428c2ecf20Sopenharmony_ci * the kernel stack */
438c2ecf20Sopenharmony_ci#define THREAD_SIZE             (PAGE_SIZE << THREAD_SIZE_ORDER)
448c2ecf20Sopenharmony_ci#define THREAD_SHIFT            (PAGE_SHIFT + THREAD_SIZE_ORDER)
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci/*
478c2ecf20Sopenharmony_ci * thread information flags
488c2ecf20Sopenharmony_ci */
498c2ecf20Sopenharmony_ci#define TIF_SYSCALL_TRACE	0	/* syscall trace active */
508c2ecf20Sopenharmony_ci#define TIF_SIGPENDING		1	/* signal pending */
518c2ecf20Sopenharmony_ci#define TIF_NEED_RESCHED	2	/* rescheduling necessary */
528c2ecf20Sopenharmony_ci#define TIF_POLLING_NRFLAG	3	/* true if poll_idle() is polling TIF_NEED_RESCHED */
538c2ecf20Sopenharmony_ci#define TIF_32BIT               4       /* 32 bit binary */
548c2ecf20Sopenharmony_ci#define TIF_MEMDIE		5	/* is terminating due to OOM killer */
558c2ecf20Sopenharmony_ci#define TIF_NOTIFY_SIGNAL	6	/* signal notifications exist */
568c2ecf20Sopenharmony_ci#define TIF_SYSCALL_AUDIT	7	/* syscall auditing active */
578c2ecf20Sopenharmony_ci#define TIF_NOTIFY_RESUME	8	/* callback before returning to user */
588c2ecf20Sopenharmony_ci#define TIF_SINGLESTEP		9	/* single stepping? */
598c2ecf20Sopenharmony_ci#define TIF_BLOCKSTEP		10	/* branch stepping? */
608c2ecf20Sopenharmony_ci#define TIF_SECCOMP		11	/* secure computing */
618c2ecf20Sopenharmony_ci#define TIF_SYSCALL_TRACEPOINT	12	/* syscall tracepoint instrumentation */
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci#define _TIF_SYSCALL_TRACE	(1 << TIF_SYSCALL_TRACE)
648c2ecf20Sopenharmony_ci#define _TIF_SIGPENDING		(1 << TIF_SIGPENDING)
658c2ecf20Sopenharmony_ci#define _TIF_NOTIFY_SIGNAL	(1 << TIF_NOTIFY_SIGNAL)
668c2ecf20Sopenharmony_ci#define _TIF_NEED_RESCHED	(1 << TIF_NEED_RESCHED)
678c2ecf20Sopenharmony_ci#define _TIF_POLLING_NRFLAG	(1 << TIF_POLLING_NRFLAG)
688c2ecf20Sopenharmony_ci#define _TIF_32BIT		(1 << TIF_32BIT)
698c2ecf20Sopenharmony_ci#define _TIF_SYSCALL_AUDIT	(1 << TIF_SYSCALL_AUDIT)
708c2ecf20Sopenharmony_ci#define _TIF_NOTIFY_RESUME	(1 << TIF_NOTIFY_RESUME)
718c2ecf20Sopenharmony_ci#define _TIF_SINGLESTEP		(1 << TIF_SINGLESTEP)
728c2ecf20Sopenharmony_ci#define _TIF_BLOCKSTEP		(1 << TIF_BLOCKSTEP)
738c2ecf20Sopenharmony_ci#define _TIF_SECCOMP		(1 << TIF_SECCOMP)
748c2ecf20Sopenharmony_ci#define _TIF_SYSCALL_TRACEPOINT	(1 << TIF_SYSCALL_TRACEPOINT)
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci#define _TIF_USER_WORK_MASK     (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | \
778c2ecf20Sopenharmony_ci                                 _TIF_NEED_RESCHED | _TIF_NOTIFY_SIGNAL)
788c2ecf20Sopenharmony_ci#define _TIF_SYSCALL_TRACE_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP |	\
798c2ecf20Sopenharmony_ci				 _TIF_BLOCKSTEP | _TIF_SYSCALL_AUDIT | \
808c2ecf20Sopenharmony_ci				 _TIF_SECCOMP | _TIF_SYSCALL_TRACEPOINT)
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci#ifdef CONFIG_64BIT
838c2ecf20Sopenharmony_ci# ifdef CONFIG_COMPAT
848c2ecf20Sopenharmony_ci#  define is_32bit_task()	(test_thread_flag(TIF_32BIT))
858c2ecf20Sopenharmony_ci# else
868c2ecf20Sopenharmony_ci#  define is_32bit_task()	(0)
878c2ecf20Sopenharmony_ci# endif
888c2ecf20Sopenharmony_ci#else
898c2ecf20Sopenharmony_ci# define is_32bit_task()	(1)
908c2ecf20Sopenharmony_ci#endif
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci#endif /* __KERNEL__ */
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ci#endif /* _ASM_PARISC_THREAD_INFO_H */
95