Linux-2.6.12-rc2
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / include / asm-m68knommu / thread_info.h
blobc8153b7c1f5cee5d3c9ab65578ae8f56903fc0bf
1 /* thread_info.h: m68knommu low-level thread information
2 * adapted from the i386 and PPC versions by Greg Ungerer (gerg@snapgear.com)
4 * Copyright (C) 2002 David Howells (dhowells@redhat.com)
5 * - Incorporating suggestions made by Linus Torvalds and Dave Miller
6 */
8 #ifndef _ASM_THREAD_INFO_H
9 #define _ASM_THREAD_INFO_H
11 #include <asm/page.h>
13 #ifdef __KERNEL__
15 #ifndef __ASSEMBLY__
18 * Size of kernel stack for each process. This must be a power of 2...
20 #ifdef CONFIG_4KSTACKS
21 #define THREAD_SIZE_ORDER (0)
22 #else
23 #define THREAD_SIZE_ORDER (1)
24 #endif
27 * for asm files, THREAD_SIZE is now generated by asm-offsets.c
29 #define THREAD_SIZE (PAGE_SIZE<<THREAD_SIZE_ORDER)
32 * low level task data.
34 struct thread_info {
35 struct task_struct *task; /* main task structure */
36 struct exec_domain *exec_domain; /* execution domain */
37 unsigned long flags; /* low level flags */
38 int cpu; /* cpu we're on */
39 int preempt_count; /* 0 => preemptable, <0 => BUG*/
40 struct restart_block restart_block;
44 * macros/functions for gaining access to the thread information structure
46 #define INIT_THREAD_INFO(tsk) \
47 { \
48 .task = &tsk, \
49 .exec_domain = &default_exec_domain, \
50 .flags = 0, \
51 .cpu = 0, \
52 .restart_block = { \
53 .fn = do_no_restart_syscall, \
54 }, \
57 #define init_thread_info (init_thread_union.thread_info)
58 #define init_stack (init_thread_union.stack)
61 /* how to get the thread information struct from C */
62 static inline struct thread_info *current_thread_info(void)
64 struct thread_info *ti;
65 __asm__(
66 "move.l %%sp, %0 \n\t"
67 "and.l %1, %0"
68 : "=&d"(ti)
69 : "di" (~(THREAD_SIZE-1))
71 return ti;
74 /* thread information allocation */
75 #define alloc_thread_info(tsk) ((struct thread_info *) \
76 __get_free_pages(GFP_KERNEL, THREAD_SIZE_ORDER))
77 #define free_thread_info(ti) free_pages((unsigned long) (ti), THREAD_SIZE_ORDER)
78 #define get_thread_info(ti) get_task_struct((ti)->task)
79 #define put_thread_info(ti) put_task_struct((ti)->task)
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
92 TIF_NEED_RESCHED */
93 #define TIF_MEMDIE 5
95 /* as above, but as bit values */
96 #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
97 #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
98 #define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
99 #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
100 #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
102 #define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */
104 #endif /* __KERNEL__ */
106 #endif /* _ASM_THREAD_INFO_H */