vserver 1.9.5.x5
[linux-2.6.git] / include / asm-m68knommu / thread_info.h
1 /* thread_info.h: m68knommu low-level thread information
2  * adapted from the i386 and PPC versions by Greg Ungerer (gerg@snapgear.com)
3  *
4  * Copyright (C) 2002  David Howells (dhowells@redhat.com)
5  * - Incorporating suggestions made by Linus Torvalds and Dave Miller
6  */
7
8 #ifndef _ASM_THREAD_INFO_H
9 #define _ASM_THREAD_INFO_H
10
11 #include <asm/page.h>
12
13 #ifdef __KERNEL__
14
15 #ifndef __ASSEMBLY__
16
17 /*
18  * low level task data.
19  * If you change this, change the TI_* offsets below to match.
20  */
21 struct thread_info {
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;       /* 0 => preemptable, <0 => BUG*/
27         struct restart_block restart_block;
28 };
29
30 /*
31  * macros/functions for gaining access to the thread information structure
32  */
33 #define INIT_THREAD_INFO(tsk)                   \
34 {                                               \
35         .task           = &tsk,                 \
36         .exec_domain    = &default_exec_domain, \
37         .flags          = 0,                    \
38         .cpu            = 0,                    \
39         .restart_block  = {                     \
40                 .fn = do_no_restart_syscall,    \
41         },                                      \
42 }
43
44 #define init_thread_info        (init_thread_union.thread_info)
45 #define init_stack              (init_thread_union.stack)
46
47
48 /* how to get the thread information struct from C */
49 static inline struct thread_info *current_thread_info(void)
50 {
51         struct thread_info *ti;
52         __asm__(
53                 "move.l %%sp, %0 \n\t"
54                 "and.l  %1, %0"
55                 : "=&d"(ti)
56                 : "di" (~(THREAD_SIZE-1))
57                 );
58         return ti;
59 }
60
61 /* thread information allocation */
62 #define alloc_thread_info(tsk) ((struct thread_info *) \
63                                 __get_free_pages(GFP_KERNEL, 1))
64 #define free_thread_info(ti)    free_pages((unsigned long) (ti), 1)
65 #define get_thread_info(ti)     get_task_struct((ti)->task)
66 #define put_thread_info(ti)     put_task_struct((ti)->task)
67 #endif /* __ASSEMBLY__ */
68
69 /*
70  * Offsets in thread_info structure, used in assembly code
71  */
72 #define TI_TASK         0
73 #define TI_EXECDOMAIN   4
74 #define TI_FLAGS        8
75 #define TI_CPU          12
76
77 #define PREEMPT_ACTIVE  0x4000000
78
79 /*
80  * thread information flag bit numbers
81  */
82 #define TIF_SYSCALL_TRACE       0       /* syscall trace active */
83 #define TIF_NOTIFY_RESUME       1       /* resumption notification requested */
84 #define TIF_SIGPENDING          2       /* signal pending */
85 #define TIF_NEED_RESCHED        3       /* rescheduling necessary */
86 #define TIF_POLLING_NRFLAG      4       /* true if poll_idle() is polling
87                                            TIF_NEED_RESCHED */
88 #define TIF_MEMDIE              5
89
90 /* as above, but as bit values */
91 #define _TIF_SYSCALL_TRACE      (1<<TIF_SYSCALL_TRACE)
92 #define _TIF_NOTIFY_RESUME      (1<<TIF_NOTIFY_RESUME)
93 #define _TIF_SIGPENDING         (1<<TIF_SIGPENDING)
94 #define _TIF_NEED_RESCHED       (1<<TIF_NEED_RESCHED)
95 #define _TIF_POLLING_NRFLAG     (1<<TIF_POLLING_NRFLAG)
96
97 #define _TIF_WORK_MASK          0x0000FFFE      /* work to do on interrupt/exception return */
98
99 #endif /* __KERNEL__ */
100
101 #endif /* _ASM_THREAD_INFO_H */