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