1#ifndef _ASM_M32R_THREAD_INFO_H
2#define _ASM_M32R_THREAD_INFO_H
3
4
5
6
7
8
9
10
11#ifdef __KERNEL__
12
13#ifndef __ASSEMBLY__
14#include <asm/processor.h>
15#endif
16
17
18
19
20
21
22
23#ifndef __ASSEMBLY__
24
25struct thread_info {
26 struct task_struct *task;
27 struct exec_domain *exec_domain;
28 unsigned long flags;
29 unsigned long status;
30 __u32 cpu;
31 int preempt_count;
32
33 mm_segment_t addr_limit;
34
35
36
37 struct restart_block restart_block;
38
39 __u8 supervisor_stack[0];
40};
41
42#else
43
44
45#define TI_TASK 0x00000000
46#define TI_EXEC_DOMAIN 0x00000004
47#define TI_FLAGS 0x00000008
48#define TI_STATUS 0x0000000C
49#define TI_CPU 0x00000010
50#define TI_PRE_COUNT 0x00000014
51#define TI_ADDR_LIMIT 0x00000018
52#define TI_RESTART_BLOCK 0x000001C
53
54#endif
55
56#define THREAD_SIZE (PAGE_SIZE << 1)
57#define THREAD_SIZE_ORDER 1
58
59
60
61#ifndef __ASSEMBLY__
62
63#define INIT_THREAD_INFO(tsk) \
64{ \
65 .task = &tsk, \
66 .exec_domain = &default_exec_domain, \
67 .flags = 0, \
68 .cpu = 0, \
69 .preempt_count = INIT_PREEMPT_COUNT, \
70 .addr_limit = KERNEL_DS, \
71 .restart_block = { \
72 .fn = do_no_restart_syscall, \
73 }, \
74}
75
76#define init_thread_info (init_thread_union.thread_info)
77#define init_stack (init_thread_union.stack)
78
79
80static inline struct thread_info *current_thread_info(void)
81{
82 struct thread_info *ti;
83
84 __asm__ __volatile__ (
85 "ldi %0, #%1 \n\t"
86 "and %0, sp \n\t"
87 : "=r" (ti) : "i" (~(THREAD_SIZE - 1))
88 );
89
90 return ti;
91}
92
93#define TI_FLAG_FAULT_CODE_SHIFT 28
94
95static inline void set_thread_fault_code(unsigned int val)
96{
97 struct thread_info *ti = current_thread_info();
98 ti->flags = (ti->flags & (~0 >> (32 - TI_FLAG_FAULT_CODE_SHIFT)))
99 | (val << TI_FLAG_FAULT_CODE_SHIFT);
100}
101
102static inline unsigned int get_thread_fault_code(void)
103{
104 struct thread_info *ti = current_thread_info();
105 return ti->flags >> TI_FLAG_FAULT_CODE_SHIFT;
106}
107
108#endif
109
110
111
112
113
114
115
116#define TIF_SYSCALL_TRACE 0
117#define TIF_SIGPENDING 1
118#define TIF_NEED_RESCHED 2
119#define TIF_SINGLESTEP 3
120#define TIF_NOTIFY_RESUME 5
121#define TIF_RESTORE_SIGMASK 8
122#define TIF_USEDFPU 16
123#define TIF_MEMDIE 18
124
125#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
126#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
127#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
128#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)
129#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
130#define _TIF_USEDFPU (1<<TIF_USEDFPU)
131
132#define _TIF_WORK_MASK (_TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_NOTIFY_RESUME)
133#define _TIF_ALLWORK_MASK (_TIF_WORK_MASK | _TIF_SYSCALL_TRACE)
134
135
136
137
138
139
140
141
142#define TS_USEDFPU 0x0001
143
144#endif
145
146#endif
147