usb: gadget: r8a66597-udc: fix cannot connect after rmmod gadget driver
[linux/fpc-iii.git] / arch / microblaze / include / asm / thread_info.h
blobb73da2ac21b34e350439b2ec4359ba5454a5cf16
1 /*
2 * Copyright (C) 2006 Atmark Techno, Inc.
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 */
9 #ifndef _ASM_MICROBLAZE_THREAD_INFO_H
10 #define _ASM_MICROBLAZE_THREAD_INFO_H
12 #ifdef __KERNEL__
14 /* we have 8k stack */
15 #define THREAD_SHIFT 13
16 #define THREAD_SIZE (1 << THREAD_SHIFT)
17 #define THREAD_SIZE_ORDER 1
19 #ifndef __ASSEMBLY__
20 # include <linux/types.h>
21 # include <asm/processor.h>
24 * low level task data that entry.S needs immediate access to
25 * - this struct should fit entirely inside of one cache line
26 * - this struct shares the supervisor stack pages
27 * - if the contents of this structure are changed, the assembly constants
28 * must also be changed
31 struct cpu_context {
32 __u32 r1; /* stack pointer */
33 __u32 r2;
34 /* dedicated registers */
35 __u32 r13;
36 __u32 r14;
37 __u32 r15;
38 __u32 r16;
39 __u32 r17;
40 __u32 r18;
41 /* non-volatile registers */
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 /* r31 is used as current task pointer */
55 /* special purpose registers */
56 __u32 msr;
57 __u32 ear;
58 __u32 esr;
59 __u32 fsr;
62 typedef struct {
63 unsigned long seg;
64 } mm_segment_t;
66 struct thread_info {
67 struct task_struct *task; /* main task structure */
68 struct exec_domain *exec_domain; /* execution domain */
69 unsigned long flags; /* low level flags */
70 unsigned long status; /* thread-synchronous flags */
71 __u32 cpu; /* current CPU */
72 __s32 preempt_count; /* 0 => preemptable,< 0 => BUG*/
73 mm_segment_t addr_limit; /* thread address space */
74 struct restart_block restart_block;
76 struct cpu_context cpu_context;
80 * macros/functions for gaining access to the thread information structure
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 }, \
95 #define init_thread_info (init_thread_union.thread_info)
96 #define init_stack (init_thread_union.stack)
98 /* how to get the thread information struct from C */
99 static inline struct thread_info *current_thread_info(void)
101 register unsigned long sp asm("r1");
103 return (struct thread_info *)(sp & ~(THREAD_SIZE-1));
106 /* thread information allocation */
107 #endif /* __ASSEMBLY__ */
109 #define PREEMPT_ACTIVE 0x10000000
112 * thread information flags
113 * - these are process state flags that various assembly files may
114 * need to access
115 * - pending work-to-be-done flags are in LSW
116 * - other flags in MSW
118 #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
119 #define TIF_NOTIFY_RESUME 1 /* resumption notification requested */
120 #define TIF_SIGPENDING 2 /* signal pending */
121 #define TIF_NEED_RESCHED 3 /* rescheduling necessary */
122 /* restore singlestep on return to user mode */
123 #define TIF_SINGLESTEP 4
124 #define TIF_IRET 5 /* return with iret */
125 #define TIF_MEMDIE 6 /* is terminating due to OOM killer */
126 #define TIF_SYSCALL_AUDIT 9 /* syscall auditing active */
127 #define TIF_SECCOMP 10 /* secure computing */
128 #define TIF_FREEZE 14 /* Freezing for suspend */
130 /* true if poll_idle() is polling TIF_NEED_RESCHED */
131 #define TIF_POLLING_NRFLAG 16
133 #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
134 #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
135 #define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
136 #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
137 #define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP)
138 #define _TIF_IRET (1 << TIF_IRET)
139 #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
140 #define _TIF_FREEZE (1 << TIF_FREEZE)
141 #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
142 #define _TIF_SECCOMP (1 << TIF_SECCOMP)
144 /* work to do in syscall trace */
145 #define _TIF_WORK_SYSCALL_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | \
146 _TIF_SYSCALL_AUDIT | _TIF_SECCOMP)
148 /* work to do on interrupt/exception return */
149 #define _TIF_WORK_MASK 0x0000FFFE
151 /* work to do on any return to u-space */
152 #define _TIF_ALLWORK_MASK 0x0000FFFF
155 * Thread-synchronous status.
157 * This is different from the flags in that nobody else
158 * ever touches our thread-synchronous status, so we don't
159 * have to worry about atomic accesses.
161 /* FPU was used by this task this quantum (SMP) */
162 #define TS_USEDFPU 0x0001
163 #define TS_RESTORE_SIGMASK 0x0002
165 #ifndef __ASSEMBLY__
166 #define HAVE_SET_RESTORE_SIGMASK 1
167 static inline void set_restore_sigmask(void)
169 struct thread_info *ti = current_thread_info();
170 ti->status |= TS_RESTORE_SIGMASK;
171 set_bit(TIF_SIGPENDING, (unsigned long *)&ti->flags);
173 #endif
175 #endif /* __KERNEL__ */
176 #endif /* _ASM_MICROBLAZE_THREAD_INFO_H */