1 /* thread_info.h: PPC low-level thread information
2 * adapted from the i386 version by Paul Mackerras
4 * Copyright (C) 2002 David Howells (dhowells@redhat.com)
5 * - Incorporating suggestions made by Linus Torvalds and Dave Miller
8 #ifndef _ASM_THREAD_INFO_H
9 #define _ASM_THREAD_INFO_H
14 #include <linux/config.h>
15 #include <asm/processor.h>
17 #include <linux/stringify.h>
20 * low level task data.
23 struct task_struct *task; /* main task structure */
24 struct exec_domain *exec_domain; /* execution domain */
25 unsigned long flags; /* low level flags */
26 int cpu; /* cpu we're on */
28 struct restart_block restart_block;
29 /* set by force_successful_syscall_return */
30 unsigned char syscall_noerror;
34 * macros/functions for gaining access to the thread information structure
36 * preempt_count needs to be 1 initially, until the scheduler is functional.
38 #define INIT_THREAD_INFO(tsk) \
41 .exec_domain = &default_exec_domain, \
46 .fn = do_no_restart_syscall, \
50 #define init_thread_info (init_thread_union.thread_info)
51 #define init_stack (init_thread_union.stack)
53 /* thread information allocation */
55 #define THREAD_ORDER 2
56 #define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER)
57 #define THREAD_SHIFT (PAGE_SHIFT + THREAD_ORDER)
58 #ifdef CONFIG_DEBUG_STACK_USAGE
59 #define alloc_thread_info(tsk) \
61 struct thread_info *ret; \
63 ret = kmalloc(THREAD_SIZE, GFP_KERNEL); \
65 memset(ret, 0, THREAD_SIZE); \
69 #define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, GFP_KERNEL)
71 #define free_thread_info(ti) kfree(ti)
72 #define get_thread_info(ti) get_task_struct((ti)->task)
73 #define put_thread_info(ti) put_task_struct((ti)->task)
75 /* how to get the thread information struct from C */
76 static inline struct thread_info *current_thread_info(void)
78 struct thread_info *ti;
79 __asm__("clrrdi %0,1,%1" : "=r"(ti) : "i" (THREAD_SHIFT));
83 #endif /* __ASSEMBLY__ */
85 #define PREEMPT_ACTIVE 0x4000000
88 * thread information flag bit numbers
90 #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
91 #define TIF_NOTIFY_RESUME 1 /* resumption notification requested */
92 #define TIF_SIGPENDING 2 /* signal pending */
93 #define TIF_NEED_RESCHED 3 /* rescheduling necessary */
94 #define TIF_POLLING_NRFLAG 4 /* true if poll_idle() is polling
96 #define TIF_32BIT 5 /* 32 bit binary */
97 #define TIF_RUN_LIGHT 6 /* iSeries run light */
98 #define TIF_ABI_PENDING 7 /* 32/64 bit switch needed */
99 #define TIF_SYSCALL_AUDIT 8 /* syscall auditing active */
101 /* as above, but as bit values */
102 #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
103 #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
104 #define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
105 #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
106 #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
107 #define _TIF_32BIT (1<<TIF_32BIT)
108 #define _TIF_RUN_LIGHT (1<<TIF_RUN_LIGHT)
109 #define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING)
110 #define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
111 #define _TIF_SYSCALL_T_OR_A (_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)
113 #define _TIF_USER_WORK_MASK (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING | \
116 #endif /* __KERNEL__ */
118 #endif /* _ASM_THREAD_INFO_H */