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>
16 #include <linux/stringify.h>
19 * low level task data.
22 struct task_struct *task; /* main task structure */
23 struct exec_domain *exec_domain; /* execution domain */
24 unsigned long flags; /* low level flags */
25 int cpu; /* cpu we're on */
26 int preempt_count; /* not used at present */
27 struct restart_block restart_block;
31 * macros/functions for gaining access to the thread information structure
33 * preempt_count needs to be 1 initially, until the scheduler is functional.
35 #define INIT_THREAD_INFO(tsk) \
38 .exec_domain = &default_exec_domain, \
43 .fn = do_no_restart_syscall, \
47 #define init_thread_info (init_thread_union.thread_info)
48 #define init_stack (init_thread_union.stack)
50 /* thread information allocation */
52 #define THREAD_ORDER 2
53 #define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER)
54 #define THREAD_SHIFT (PAGE_SHIFT + THREAD_ORDER)
55 #ifdef CONFIG_DEBUG_STACK_USAGE
56 #define alloc_thread_info(tsk) \
58 struct thread_info *ret; \
60 ret = kmalloc(THREAD_SIZE, GFP_KERNEL); \
62 memset(ret, 0, THREAD_SIZE); \
66 #define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, GFP_KERNEL)
68 #define free_thread_info(ti) kfree(ti)
69 #define get_thread_info(ti) get_task_struct((ti)->task)
70 #define put_thread_info(ti) put_task_struct((ti)->task)
72 /* how to get the thread information struct from C */
73 static inline struct thread_info *current_thread_info(void)
75 struct thread_info *ti;
76 __asm__("clrrdi %0,1,14" : "=r"(ti));
80 #endif /* __ASSEMBLY__ */
82 #define PREEMPT_ACTIVE 0x4000000
85 * thread information flag bit numbers
87 #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
88 #define TIF_NOTIFY_RESUME 1 /* resumption notification requested */
89 #define TIF_SIGPENDING 2 /* signal pending */
90 #define TIF_NEED_RESCHED 3 /* rescheduling necessary */
91 #define TIF_POLLING_NRFLAG 4 /* true if poll_idle() is polling
93 #define TIF_32BIT 5 /* 32 bit binary */
94 #define TIF_RUN_LIGHT 6 /* iSeries run light */
95 #define TIF_ABI_PENDING 7 /* 32/64 bit switch needed */
96 #define TIF_SYSCALL_AUDIT 8 /* syscall auditing active */
98 /* as above, but as bit values */
99 #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
100 #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
101 #define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
102 #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
103 #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
104 #define _TIF_32BIT (1<<TIF_32BIT)
105 #define _TIF_RUN_LIGHT (1<<TIF_RUN_LIGHT)
106 #define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING)
107 #define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
108 #define _TIF_SYSCALL_T_OR_A (_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)
110 #define _TIF_USER_WORK_MASK (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING | \
113 #endif /* __KERNEL__ */
115 #endif /* _ASM_THREAD_INFO_H */