1 /*
2  *  S390 version
3  *    Copyright IBM Corp. 2002, 2006
4  *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
5  */
6 
7 #ifndef _ASM_THREAD_INFO_H
8 #define _ASM_THREAD_INFO_H
9 
10 /*
11  * Size of kernel stack for each process
12  */
13 #ifndef CONFIG_64BIT
14 #define THREAD_ORDER 1
15 #define ASYNC_ORDER  1
16 #else /* CONFIG_64BIT */
17 #define THREAD_ORDER 2
18 #define ASYNC_ORDER  2
19 #endif /* CONFIG_64BIT */
20 
21 #define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER)
22 #define ASYNC_SIZE  (PAGE_SIZE << ASYNC_ORDER)
23 
24 #ifndef __ASSEMBLY__
25 #include <asm/lowcore.h>
26 #include <asm/page.h>
27 #include <asm/processor.h>
28 
29 /*
30  * low level task data that entry.S needs immediate access to
31  * - this struct should fit entirely inside of one cache line
32  * - this struct shares the supervisor stack pages
33  * - if the contents of this structure are changed, the assembly constants must also be changed
34  */
35 struct thread_info {
36 	struct task_struct	*task;		/* main task structure */
37 	struct exec_domain	*exec_domain;	/* execution domain */
38 	unsigned long		flags;		/* low level flags */
39 	unsigned long		sys_call_table;	/* System call table address */
40 	unsigned int		cpu;		/* current CPU */
41 	int			preempt_count;	/* 0 => preemptable, <0 => BUG */
42 	struct restart_block	restart_block;
43 	unsigned int		system_call;
44 	__u64			user_timer;
45 	__u64			system_timer;
46 	unsigned long		last_break;	/* last breaking-event-address. */
47 };
48 
49 /*
50  * macros/functions for gaining access to the thread information structure
51  */
52 #define INIT_THREAD_INFO(tsk)			\
53 {						\
54 	.task		= &tsk,			\
55 	.exec_domain	= &default_exec_domain,	\
56 	.flags		= 0,			\
57 	.cpu		= 0,			\
58 	.preempt_count	= INIT_PREEMPT_COUNT,	\
59 	.restart_block	= {			\
60 		.fn = do_no_restart_syscall,	\
61 	},					\
62 }
63 
64 #define init_thread_info	(init_thread_union.thread_info)
65 #define init_stack		(init_thread_union.stack)
66 
67 /* how to get the thread information struct from C */
68 static inline struct thread_info *current_thread_info(void)
69 {
70 	return (struct thread_info *) S390_lowcore.thread_info;
71 }
72 
73 #define THREAD_SIZE_ORDER THREAD_ORDER
74 
75 #endif
76 
77 /*
78  * thread information flags bit numbers
79  */
80 #define TIF_SYSCALL		0	/* inside a system call */
81 #define TIF_NOTIFY_RESUME	1	/* callback before returning to user */
82 #define TIF_SIGPENDING		2	/* signal pending */
83 #define TIF_NEED_RESCHED	3	/* rescheduling necessary */
84 #define TIF_TLB_WAIT		4	/* wait for TLB flush completion */
85 #define TIF_ASCE		5	/* primary asce needs fixup / uaccess */
86 #define TIF_PER_TRAP		6	/* deliver sigtrap on return to user */
87 #define TIF_MCCK_PENDING	7	/* machine check handling is pending */
88 #define TIF_SYSCALL_TRACE	8	/* syscall trace active */
89 #define TIF_SYSCALL_AUDIT	9	/* syscall auditing active */
90 #define TIF_SECCOMP		10	/* secure computing */
91 #define TIF_SYSCALL_TRACEPOINT	11	/* syscall tracepoint instrumentation */
92 #define TIF_31BIT		17	/* 32bit process */
93 #define TIF_MEMDIE		18	/* is terminating due to OOM killer */
94 #define TIF_RESTORE_SIGMASK	19	/* restore signal mask in do_signal() */
95 #define TIF_SINGLE_STEP		20	/* This task is single stepped */
96 #define TIF_BLOCK_STEP		21	/* This task is block stepped */
97 
98 #define _TIF_SYSCALL		(1<<TIF_SYSCALL)
99 #define _TIF_NOTIFY_RESUME	(1<<TIF_NOTIFY_RESUME)
100 #define _TIF_SIGPENDING		(1<<TIF_SIGPENDING)
101 #define _TIF_NEED_RESCHED	(1<<TIF_NEED_RESCHED)
102 #define _TIF_TLB_WAIT		(1<<TIF_TLB_WAIT)
103 #define _TIF_ASCE		(1<<TIF_ASCE)
104 #define _TIF_PER_TRAP		(1<<TIF_PER_TRAP)
105 #define _TIF_MCCK_PENDING	(1<<TIF_MCCK_PENDING)
106 #define _TIF_SYSCALL_TRACE	(1<<TIF_SYSCALL_TRACE)
107 #define _TIF_SYSCALL_AUDIT	(1<<TIF_SYSCALL_AUDIT)
108 #define _TIF_SECCOMP		(1<<TIF_SECCOMP)
109 #define _TIF_SYSCALL_TRACEPOINT	(1<<TIF_SYSCALL_TRACEPOINT)
110 #define _TIF_31BIT		(1<<TIF_31BIT)
111 #define _TIF_SINGLE_STEP	(1<<TIF_SINGLE_STEP)
112 
113 #ifdef CONFIG_64BIT
114 #define is_32bit_task()		(test_thread_flag(TIF_31BIT))
115 #else
116 #define is_32bit_task()		(1)
117 #endif
118 
119 #endif /* _ASM_THREAD_INFO_H */
120