1
2
3
4
5
6
7#ifndef _ASM_THREAD_INFO_H
8#define _ASM_THREAD_INFO_H
9
10#ifdef __KERNEL__
11
12#include <linux/config.h>
13#include <linux/compiler.h>
14#include <asm/page.h>
15
16#ifndef __ASSEMBLY__
17#include <asm/processor.h>
18#endif
19
20
21
22
23
24
25
26#ifndef __ASSEMBLY__
27
28struct thread_info {
29 struct task_struct *task;
30 struct exec_domain *exec_domain;
31 unsigned long flags;
32 unsigned long status;
33 __u32 cpu;
34 __s32 preempt_count;
35
36
37 mm_segment_t addr_limit;
38
39
40
41 struct restart_block restart_block;
42
43 unsigned long previous_esp;
44
45
46 __u8 supervisor_stack[0];
47};
48
49#else
50
51#include <asm/asm_offsets.h>
52
53#endif
54
55#define PREEMPT_ACTIVE 0x10000000
56#ifdef CONFIG_4KSTACKS
57#define THREAD_SIZE (4096)
58#else
59#define THREAD_SIZE (8192)
60#endif
61
62#define STACK_WARN (THREAD_SIZE/8)
63
64
65
66
67
68#ifndef __ASSEMBLY__
69
70#define INIT_THREAD_INFO(tsk) \
71{ \
72 .task = &tsk, \
73 .exec_domain = &default_exec_domain, \
74 .flags = 0, \
75 .cpu = 0, \
76 .preempt_count = 1, \
77 .addr_limit = KERNEL_DS, \
78 .restart_block = { \
79 .fn = do_no_restart_syscall, \
80 }, \
81}
82
83#define init_thread_info (init_thread_union.thread_info)
84#define init_stack (init_thread_union.stack)
85
86
87
88static inline struct thread_info *current_thread_info(void)
89{
90 struct thread_info *ti;
91 __asm__("andl %%esp,%0; ":"=r" (ti) : "0" (~(THREAD_SIZE - 1)));
92 return ti;
93}
94
95
96register unsigned long current_stack_pointer asm("esp") __attribute_used__;
97
98
99#ifdef CONFIG_DEBUG_STACK_USAGE
100#define alloc_thread_info(tsk) \
101 ({ \
102 struct thread_info *ret; \
103 \
104 ret = kmalloc(THREAD_SIZE, GFP_KERNEL); \
105 if (ret) \
106 memset(ret, 0, THREAD_SIZE); \
107 ret; \
108 })
109#else
110#define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, GFP_KERNEL)
111#endif
112
113#define free_thread_info(info) kfree(info)
114#define get_thread_info(ti) get_task_struct((ti)->task)
115#define put_thread_info(ti) put_task_struct((ti)->task)
116
117#else
118
119
120#define GET_THREAD_INFO(reg) \
121 movl $-THREAD_SIZE, reg; \
122 andl %esp, reg
123
124
125#define GET_THREAD_INFO_WITH_ESP(reg) \
126 andl $-THREAD_SIZE, reg
127
128#endif
129
130
131
132
133
134
135
136#define TIF_SYSCALL_TRACE 0
137#define TIF_NOTIFY_RESUME 1
138#define TIF_SIGPENDING 2
139#define TIF_NEED_RESCHED 3
140#define TIF_SINGLESTEP 4
141#define TIF_IRET 5
142#define TIF_SYSCALL_AUDIT 7
143#define TIF_POLLING_NRFLAG 16
144#define TIF_MEMDIE 17
145
146#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
147#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
148#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
149#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
150#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)
151#define _TIF_IRET (1<<TIF_IRET)
152#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
153#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
154
155
156#define _TIF_WORK_MASK \
157 (0x0000FFFF & ~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP))
158#define _TIF_ALLWORK_MASK 0x0000FFFF
159
160
161
162
163
164
165
166
167#define TS_USEDFPU 0x0001
168
169#endif
170
171#endif
172