1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16#ifndef _ASM_TILE_THREAD_INFO_H
17#define _ASM_TILE_THREAD_INFO_H
18
19#include <asm/processor.h>
20#include <asm/page.h>
21#ifndef __ASSEMBLY__
22
23
24
25
26
27struct thread_info {
28 struct task_struct *task;
29 struct exec_domain *exec_domain;
30 unsigned long flags;
31 unsigned long status;
32 __u32 homecache_cpu;
33 __u32 cpu;
34 int preempt_count;
35
36
37 mm_segment_t addr_limit;
38
39 struct restart_block restart_block;
40 struct single_step_state *step_state;
41
42 int align_ctl;
43#ifdef __tilegx__
44 unsigned long unalign_jit_tmp[4];
45 void __user *unalign_jit_base;
46#endif
47};
48
49
50
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 .addr_limit = KERNEL_DS, \
60 .restart_block = { \
61 .fn = do_no_restart_syscall, \
62 }, \
63 .step_state = NULL, \
64 .align_ctl = 0, \
65}
66
67#define init_thread_info (init_thread_union.thread_info)
68#define init_stack (init_thread_union.stack)
69
70#endif
71
72#if PAGE_SIZE < 8192
73#define THREAD_SIZE_ORDER (13 - PAGE_SHIFT)
74#else
75#define THREAD_SIZE_ORDER (0)
76#endif
77#define THREAD_SIZE_PAGES (1 << THREAD_SIZE_ORDER)
78
79#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
80#define LOG2_THREAD_SIZE (PAGE_SHIFT + THREAD_SIZE_ORDER)
81
82#define STACK_WARN (THREAD_SIZE/8)
83
84#ifndef __ASSEMBLY__
85
86void arch_release_thread_info(struct thread_info *info);
87
88
89register unsigned long stack_pointer __asm__("sp");
90
91#define current_thread_info() \
92 ((struct thread_info *)(stack_pointer & -THREAD_SIZE))
93
94
95extern void smp_nap(void);
96
97
98extern void _cpu_idle(void);
99
100#else
101
102
103
104
105
106
107
108#ifdef __tilegx__
109#define EXTRACT_THREAD_INFO(reg) mm reg, zero, LOG2_THREAD_SIZE, 63
110#else
111#define GET_THREAD_INFO(reg) mm reg, sp, zero, LOG2_THREAD_SIZE, 31
112#endif
113
114#endif
115
116
117
118
119
120
121#define TIF_SIGPENDING 0
122#define TIF_NEED_RESCHED 1
123#define TIF_SINGLESTEP 2
124
125#define TIF_ASYNC_TLB 3
126#define TIF_SYSCALL_TRACE 4
127#define TIF_SYSCALL_AUDIT 5
128#define TIF_SECCOMP 6
129#define TIF_MEMDIE 7
130#define TIF_NOTIFY_RESUME 8
131#define TIF_SYSCALL_TRACEPOINT 9
132
133#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
134#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
135#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)
136#define _TIF_ASYNC_TLB (1<<TIF_ASYNC_TLB)
137#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
138#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
139#define _TIF_SECCOMP (1<<TIF_SECCOMP)
140#define _TIF_MEMDIE (1<<TIF_MEMDIE)
141#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
142#define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT)
143
144
145#define _TIF_ALLWORK_MASK \
146 (_TIF_SIGPENDING|_TIF_NEED_RESCHED|_TIF_SINGLESTEP|\
147 _TIF_ASYNC_TLB|_TIF_NOTIFY_RESUME)
148
149
150#define _TIF_SYSCALL_ENTRY_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_TRACEPOINT)
151
152
153#define _TIF_SYSCALL_EXIT_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_TRACEPOINT)
154
155
156
157
158
159
160
161
162#ifdef __tilegx__
163#define TS_COMPAT 0x0001
164#endif
165#define TS_POLLING 0x0004
166#define TS_RESTORE_SIGMASK 0x0008
167
168#ifndef __ASSEMBLY__
169#define HAVE_SET_RESTORE_SIGMASK 1
170static inline void set_restore_sigmask(void)
171{
172 struct thread_info *ti = current_thread_info();
173 ti->status |= TS_RESTORE_SIGMASK;
174 WARN_ON(!test_bit(TIF_SIGPENDING, &ti->flags));
175}
176static inline void clear_restore_sigmask(void)
177{
178 current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
179}
180static inline bool test_restore_sigmask(void)
181{
182 return current_thread_info()->status & TS_RESTORE_SIGMASK;
183}
184static inline bool test_and_clear_restore_sigmask(void)
185{
186 struct thread_info *ti = current_thread_info();
187 if (!(ti->status & TS_RESTORE_SIGMASK))
188 return false;
189 ti->status &= ~TS_RESTORE_SIGMASK;
190 return true;
191}
192#endif
193
194#endif
195