1
2
3
4
5
6
7
8
9#ifndef _ASM_MICROBLAZE_THREAD_INFO_H
10#define _ASM_MICROBLAZE_THREAD_INFO_H
11
12#ifdef __KERNEL__
13
14
15#define THREAD_SHIFT 13
16#define THREAD_SIZE (1 << THREAD_SHIFT)
17#define THREAD_SIZE_ORDER 1
18
19#ifndef __ASSEMBLY__
20# include <linux/types.h>
21# include <asm/processor.h>
22
23
24
25
26
27
28
29
30
31struct cpu_context {
32 __u32 r1;
33 __u32 r2;
34
35 __u32 r13;
36 __u32 r14;
37 __u32 r15;
38 __u32 r16;
39 __u32 r17;
40 __u32 r18;
41
42 __u32 r19;
43 __u32 r20;
44 __u32 r21;
45 __u32 r22;
46 __u32 r23;
47 __u32 r24;
48 __u32 r25;
49 __u32 r26;
50 __u32 r27;
51 __u32 r28;
52 __u32 r29;
53 __u32 r30;
54
55
56 __u32 msr;
57 __u32 ear;
58 __u32 esr;
59 __u32 fsr;
60};
61
62typedef struct {
63 unsigned long seg;
64} mm_segment_t;
65
66struct thread_info {
67 struct task_struct *task;
68 struct exec_domain *exec_domain;
69 unsigned long flags;
70 unsigned long status;
71 __u32 cpu;
72 __s32 preempt_count;
73 mm_segment_t addr_limit;
74 struct restart_block restart_block;
75
76 struct cpu_context cpu_context;
77};
78
79
80
81
82#define INIT_THREAD_INFO(tsk) \
83{ \
84 .task = &tsk, \
85 .exec_domain = &default_exec_domain, \
86 .flags = 0, \
87 .cpu = 0, \
88 .preempt_count = INIT_PREEMPT_COUNT, \
89 .addr_limit = KERNEL_DS, \
90 .restart_block = { \
91 .fn = do_no_restart_syscall, \
92 }, \
93}
94
95#define init_thread_info (init_thread_union.thread_info)
96#define init_stack (init_thread_union.stack)
97
98
99static inline struct thread_info *current_thread_info(void)
100{
101 register unsigned long sp asm("r1");
102
103 return (struct thread_info *)(sp & ~(THREAD_SIZE-1));
104}
105
106
107#endif
108
109#define PREEMPT_ACTIVE 0x10000000
110
111
112
113
114
115
116
117
118#define TIF_SYSCALL_TRACE 0
119#define TIF_NOTIFY_RESUME 1
120#define TIF_SIGPENDING 2
121#define TIF_NEED_RESCHED 3
122
123#define TIF_SINGLESTEP 4
124#define TIF_MEMDIE 6
125#define TIF_SYSCALL_AUDIT 9
126#define TIF_SECCOMP 10
127
128
129#define TIF_POLLING_NRFLAG 16
130
131#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
132#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
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_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
137#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
138#define _TIF_SECCOMP (1 << TIF_SECCOMP)
139
140
141#define _TIF_WORK_SYSCALL_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | \
142 _TIF_SYSCALL_AUDIT | _TIF_SECCOMP)
143
144
145#define _TIF_WORK_MASK 0x0000FFFE
146
147
148#define _TIF_ALLWORK_MASK 0x0000FFFF
149
150
151
152
153
154
155
156
157
158#define TS_USEDFPU 0x0001
159#define TS_RESTORE_SIGMASK 0x0002
160
161#ifndef __ASSEMBLY__
162#define HAVE_SET_RESTORE_SIGMASK 1
163static inline void set_restore_sigmask(void)
164{
165 struct thread_info *ti = current_thread_info();
166 ti->status |= TS_RESTORE_SIGMASK;
167 WARN_ON(!test_bit(TIF_SIGPENDING, (unsigned long *)&ti->flags));
168}
169static inline void clear_restore_sigmask(void)
170{
171 current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
172}
173static inline bool test_restore_sigmask(void)
174{
175 return current_thread_info()->status & TS_RESTORE_SIGMASK;
176}
177static inline bool test_and_clear_restore_sigmask(void)
178{
179 struct thread_info *ti = current_thread_info();
180 if (!(ti->status & TS_RESTORE_SIGMASK))
181 return false;
182 ti->status &= ~TS_RESTORE_SIGMASK;
183 return true;
184}
185#define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG)
186#endif
187
188#endif
189#endif
190