1 #ifndef _ALPHA_THREAD_INFO_H
2 #define _ALPHA_THREAD_INFO_H
7 #include <asm/processor.h>
10 #include <asm/sysinfo.h>
15 struct pcb_struct pcb; /* palcode state */
17 struct task_struct *task; /* main task structure */
18 unsigned int flags; /* low level flags */
19 unsigned int ieee_state; /* see fpu.h */
21 struct exec_domain *exec_domain; /* execution domain */
22 mm_segment_t addr_limit; /* thread address space */
23 unsigned cpu; /* current CPU */
24 int preempt_count; /* 0 => preemptable, <0 => BUG */
25 unsigned int status; /* thread-synchronous flags */
28 unsigned long bpt_addr[2]; /* breakpoint handling */
29 unsigned int bpt_insn[2];
33 * Macros/functions for gaining access to the thread information structure.
35 #define INIT_THREAD_INFO(tsk) \
38 .exec_domain = &default_exec_domain, \
39 .addr_limit = KERNEL_DS, \
40 .preempt_count = INIT_PREEMPT_COUNT, \
43 #define init_thread_info (init_thread_union.thread_info)
44 #define init_stack (init_thread_union.stack)
46 /* How to get the thread information struct from C. */
47 register struct thread_info *__current_thread_info __asm__("$8");
48 #define current_thread_info() __current_thread_info
50 #endif /* __ASSEMBLY__ */
52 /* Thread information allocation. */
53 #define THREAD_SIZE_ORDER 1
54 #define THREAD_SIZE (2*PAGE_SIZE)
57 * Thread information flags:
58 * - these are process state flags and used from assembly
59 * - pending work-to-be-done flags come first and must be assigned to be
60 * within bits 0 to 7 to fit in and immediate operand.
62 * TIF_SYSCALL_TRACE is known to be 0 via blbs.
64 #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
65 #define TIF_NOTIFY_RESUME 1 /* callback before returning to user */
66 #define TIF_SIGPENDING 2 /* signal pending */
67 #define TIF_NEED_RESCHED 3 /* rescheduling necessary */
68 #define TIF_SYSCALL_AUDIT 4 /* syscall audit active */
69 #define TIF_DIE_IF_KERNEL 9 /* dik recursion lock */
70 #define TIF_MEMDIE 13 /* is terminating due to OOM killer */
71 #define TIF_POLLING_NRFLAG 14 /* idle is polling for TIF_NEED_RESCHED */
73 #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
74 #define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
75 #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
76 #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
77 #define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
78 #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
80 /* Work to do on interrupt/exception return. */
81 #define _TIF_WORK_MASK (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \
84 /* Work to do on any return to userspace. */
85 #define _TIF_ALLWORK_MASK (_TIF_WORK_MASK \
88 #define TS_UAC_NOPRINT 0x0001 /* ! Preserve the following three */
89 #define TS_UAC_NOFIX 0x0002 /* ! flags as they match */
90 #define TS_UAC_SIGBUS 0x0004 /* ! userspace part of 'osf_sysinfo' */
91 #define TS_RESTORE_SIGMASK 0x0008 /* restore signal mask in do_signal() */
94 #define HAVE_SET_RESTORE_SIGMASK 1
95 static inline void set_restore_sigmask(void)
97 struct thread_info *ti = current_thread_info();
98 ti->status |= TS_RESTORE_SIGMASK;
99 WARN_ON(!test_bit(TIF_SIGPENDING, (unsigned long *)&ti->flags));
101 static inline void clear_restore_sigmask(void)
103 current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
105 static inline bool test_restore_sigmask(void)
107 return current_thread_info()->status & TS_RESTORE_SIGMASK;
109 static inline bool test_and_clear_restore_sigmask(void)
111 struct thread_info *ti = current_thread_info();
112 if (!(ti->status & TS_RESTORE_SIGMASK))
114 ti->status &= ~TS_RESTORE_SIGMASK;
119 #define SET_UNALIGN_CTL(task,value) ({ \
120 __u32 status = task_thread_info(task)->status & ~UAC_BITMASK; \
121 if (value & PR_UNALIGN_NOPRINT) \
122 status |= TS_UAC_NOPRINT; \
123 if (value & PR_UNALIGN_SIGBUS) \
124 status |= TS_UAC_SIGBUS; \
125 if (value & 4) /* alpha-specific */ \
126 status |= TS_UAC_NOFIX; \
127 task_thread_info(task)->status = status; \
130 #define GET_UNALIGN_CTL(task,value) ({ \
131 __u32 status = task_thread_info(task)->status & ~UAC_BITMASK; \
133 if (status & TS_UAC_NOPRINT) \
134 res |= PR_UNALIGN_NOPRINT; \
135 if (status & TS_UAC_SIGBUS) \
136 res |= PR_UNALIGN_SIGBUS; \
137 if (status & TS_UAC_NOFIX) \
139 put_user(res, (int __user *)(value)); \
142 #endif /* __KERNEL__ */
143 #endif /* _ALPHA_THREAD_INFO_H */