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 <linux/cache.h>
16 #include <asm/processor.h>
18 #include <linux/stringify.h>
21 * low level task data.
24 struct task_struct
*task
; /* main task structure */
25 struct exec_domain
*exec_domain
; /* execution domain */
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
;
31 /* low level flags - has atomic operations done on it */
32 unsigned long flags ____cacheline_aligned_in_smp
;
36 * macros/functions for gaining access to the thread information structure
38 * preempt_count needs to be 1 initially, until the scheduler is functional.
40 #define INIT_THREAD_INFO(tsk) \
43 .exec_domain = &default_exec_domain, \
47 .fn = do_no_restart_syscall, \
52 #define init_thread_info (init_thread_union.thread_info)
53 #define init_stack (init_thread_union.stack)
55 /* thread information allocation */
57 #define THREAD_ORDER 2
58 #define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER)
59 #define THREAD_SHIFT (PAGE_SHIFT + THREAD_ORDER)
60 #ifdef CONFIG_DEBUG_STACK_USAGE
61 #define alloc_thread_info(tsk) \
63 struct thread_info *ret; \
65 ret = kmalloc(THREAD_SIZE, GFP_KERNEL); \
67 memset(ret, 0, THREAD_SIZE); \
71 #define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, GFP_KERNEL)
73 #define free_thread_info(ti) kfree(ti)
74 #define get_thread_info(ti) get_task_struct((ti)->task)
75 #define put_thread_info(ti) put_task_struct((ti)->task)
77 /* how to get the thread information struct from C */
78 static inline struct thread_info
*current_thread_info(void)
80 struct thread_info
*ti
;
81 __asm__("clrrdi %0,1,%1" : "=r"(ti
) : "i" (THREAD_SHIFT
));
85 #endif /* __ASSEMBLY__ */
87 #define PREEMPT_ACTIVE 0x10000000
90 * thread information flag bit numbers
92 #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
93 #define TIF_NOTIFY_RESUME 1 /* resumption notification requested */
94 #define TIF_SIGPENDING 2 /* signal pending */
95 #define TIF_NEED_RESCHED 3 /* rescheduling necessary */
96 #define TIF_POLLING_NRFLAG 4 /* true if poll_idle() is polling
98 #define TIF_32BIT 5 /* 32 bit binary */
99 #define TIF_RUN_LIGHT 6 /* iSeries run light */
100 #define TIF_ABI_PENDING 7 /* 32/64 bit switch needed */
101 #define TIF_SYSCALL_AUDIT 8 /* syscall auditing active */
102 #define TIF_SINGLESTEP 9 /* singlestepping active */
103 #define TIF_MEMDIE 10
104 #define TIF_SECCOMP 11 /* secure computing */
106 /* as above, but as bit values */
107 #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
108 #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
109 #define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
110 #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
111 #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
112 #define _TIF_32BIT (1<<TIF_32BIT)
113 #define _TIF_RUN_LIGHT (1<<TIF_RUN_LIGHT)
114 #define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING)
115 #define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
116 #define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)
117 #define _TIF_SECCOMP (1<<TIF_SECCOMP)
118 #define _TIF_SYSCALL_T_OR_A (_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP)
120 #define _TIF_USER_WORK_MASK (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING | \
123 #endif /* __KERNEL__ */
125 #endif /* _ASM_THREAD_INFO_H */