rt-mutex: fix stale return value
[linux-2.6/mini2440.git] / include / asm-alpha / thread_info.h
blob48a22e3e6f32166570aac056e27d65159181302b
1 #ifndef _ALPHA_THREAD_INFO_H
2 #define _ALPHA_THREAD_INFO_H
4 #ifdef __KERNEL__
6 #ifndef __ASSEMBLY__
7 #include <asm/processor.h>
8 #include <asm/types.h>
9 #include <asm/hwrpb.h>
10 #endif
12 #ifndef __ASSEMBLY__
13 struct thread_info {
14 struct pcb_struct pcb; /* palcode state */
16 struct task_struct *task; /* main task structure */
17 unsigned int flags; /* low level flags */
18 unsigned int ieee_state; /* see fpu.h */
20 struct exec_domain *exec_domain; /* execution domain */
21 mm_segment_t addr_limit; /* thread address space */
22 unsigned cpu; /* current CPU */
23 int preempt_count; /* 0 => preemptable, <0 => BUG */
25 int bpt_nsaved;
26 unsigned long bpt_addr[2]; /* breakpoint handling */
27 unsigned int bpt_insn[2];
29 struct restart_block restart_block;
33 * Macros/functions for gaining access to the thread information structure.
35 #define INIT_THREAD_INFO(tsk) \
36 { \
37 .task = &tsk, \
38 .exec_domain = &default_exec_domain, \
39 .addr_limit = KERNEL_DS, \
40 .restart_block = { \
41 .fn = do_no_restart_syscall, \
42 }, \
45 #define init_thread_info (init_thread_union.thread_info)
46 #define init_stack (init_thread_union.stack)
48 /* How to get the thread information struct from C. */
49 register struct thread_info *__current_thread_info __asm__("$8");
50 #define current_thread_info() __current_thread_info
52 /* Thread information allocation. */
53 #define THREAD_SIZE (2*PAGE_SIZE)
54 #define alloc_thread_info(tsk) \
55 ((struct thread_info *) __get_free_pages(GFP_KERNEL,1))
56 #define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
58 #endif /* __ASSEMBLY__ */
60 #define PREEMPT_ACTIVE 0x40000000
63 * Thread information flags:
64 * - these are process state flags and used from assembly
65 * - pending work-to-be-done flags come first to fit in and immediate operand.
67 * TIF_SYSCALL_TRACE is known to be 0 via blbs.
69 #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
70 #define TIF_NOTIFY_RESUME 1 /* resumption notification requested */
71 #define TIF_SIGPENDING 2 /* signal pending */
72 #define TIF_NEED_RESCHED 3 /* rescheduling necessary */
73 #define TIF_POLLING_NRFLAG 4 /* poll_idle is polling NEED_RESCHED */
74 #define TIF_DIE_IF_KERNEL 5 /* dik recursion lock */
75 #define TIF_UAC_NOPRINT 6 /* see sysinfo.h */
76 #define TIF_UAC_NOFIX 7
77 #define TIF_UAC_SIGBUS 8
78 #define TIF_MEMDIE 9
79 #define TIF_RESTORE_SIGMASK 10 /* restore signal mask in do_signal */
81 #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
82 #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
83 #define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
84 #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
85 #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
86 #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
88 /* Work to do on interrupt/exception return. */
89 #define _TIF_WORK_MASK (_TIF_NOTIFY_RESUME \
90 | _TIF_SIGPENDING \
91 | _TIF_NEED_RESCHED)
93 /* Work to do on any return to userspace. */
94 #define _TIF_ALLWORK_MASK (_TIF_WORK_MASK \
95 | _TIF_SYSCALL_TRACE)
97 #define ALPHA_UAC_SHIFT 6
98 #define ALPHA_UAC_MASK (1 << TIF_UAC_NOPRINT | 1 << TIF_UAC_NOFIX | \
99 1 << TIF_UAC_SIGBUS)
101 #define SET_UNALIGN_CTL(task,value) ({ \
102 task_thread_info(task)->flags = ((task_thread_info(task)->flags & \
103 ~ALPHA_UAC_MASK) \
104 | (((value) << ALPHA_UAC_SHIFT) & (1<<TIF_UAC_NOPRINT))\
105 | (((value) << (ALPHA_UAC_SHIFT + 1)) & (1<<TIF_UAC_SIGBUS)) \
106 | (((value) << (ALPHA_UAC_SHIFT - 1)) & (1<<TIF_UAC_NOFIX)));\
107 0; })
109 #define GET_UNALIGN_CTL(task,value) ({ \
110 put_user((task_thread_info(task)->flags & (1 << TIF_UAC_NOPRINT))\
111 >> ALPHA_UAC_SHIFT \
112 | (task_thread_info(task)->flags & (1 << TIF_UAC_SIGBUS))\
113 >> (ALPHA_UAC_SHIFT + 1) \
114 | (task_thread_info(task)->flags & (1 << TIF_UAC_NOFIX))\
115 >> (ALPHA_UAC_SHIFT - 1), \
116 (int __user *)(value)); \
119 #endif /* __KERNEL__ */
120 #endif /* _ALPHA_THREAD_INFO_H */