8846cba545c73e5acd8fa14ac7ab75f984403e30
[linux-flexiantxendom0-3.2.10.git] / include / asm-mips64 / thread_info.h
1 /* thread_info.h: i386 low-level thread information
2  *
3  * Copyright (C) 2002  David Howells (dhowells@redhat.com)
4  * - Incorporating suggestions made by Linus Torvalds and Dave Miller
5  */
6
7 #ifndef _ASM_THREAD_INFO_H
8 #define _ASM_THREAD_INFO_H
9
10 #ifdef __KERNEL__
11
12 #ifndef __ASSEMBLY__
13
14 #include <asm/processor.h>
15
16 /*
17  * low level task data that entry.S needs immediate access to
18  * - this struct should fit entirely inside of one cache line
19  * - this struct shares the supervisor stack pages
20  * - if the contents of this structure are changed, the assembly constants
21  *   must also be changed
22  */
23 struct thread_info {
24         struct task_struct      *task;          /* main task structure */
25         struct exec_domain      *exec_domain;   /* execution domain */
26         unsigned long           flags;          /* low level flags */
27         __u32                   cpu;            /* current CPU */
28         __s32                   preempt_count; /* 0 => preemptable, <0 => BUG */
29
30         mm_segment_t            addr_limit;     /* thread address space:
31                                                    0-0xBFFFFFFF for user-thead
32                                                    0-0xFFFFFFFF for kernel-thread
33                                                 */
34         struct restart_block    restart_block;
35 };
36
37 #define PREEMPT_ACTIVE          0x4000000
38
39 /*
40  * macros/functions for gaining access to the thread information structure
41  *
42  * preempt_count needs to be 1 initially, until the scheduler is functional.
43  */
44 #define INIT_THREAD_INFO(tsk)                   \
45 {                                               \
46         .task           = &tsk,                 \
47         .exec_domain    = &default_exec_domain, \
48         .flags          = 0,                    \
49         .cpu            = 0,                    \
50         .preempt_count  = 1,                    \
51         .addr_limit     = KERNEL_DS,            \
52         .restart_block  = {                     \
53                 .fn = do_no_restart_syscall,    \
54         },                                      \
55 }
56
57 #define init_thread_info        (init_thread_union.thread_info)
58 #define init_stack              (init_thread_union.stack)
59
60 /* How to get the thread information struct from C.  */
61 register struct thread_info *__current_thread_info __asm__("$28");
62 #define current_thread_info()  __current_thread_info
63
64 /* thread information allocation */
65 #define THREAD_SIZE_ORDER (2)
66 #define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
67 #define alloc_thread_info(tsk) ((struct thread_info *) \
68         __get_free_pages(GFP_KERNEL,THREAD_SIZE_ORDER))
69 #define free_thread_info(ti) free_pages((unsigned long) (ti), THREAD_SIZE_ORDER)
70 #define get_thread_info(ti) get_task_struct((ti)->task)
71 #define put_thread_info(ti) put_task_struct((ti)->task)
72
73 #endif /* !__ASSEMBLY__ */
74
75 /*
76  * thread information flags
77  * - these are process state flags that various assembly files may need to
78  *   access
79  * - pending work-to-be-done flags are in LSW
80  * - other flags in MSW
81  */
82 #define TIF_NOTIFY_RESUME       1       /* resumption notification requested */
83 #define TIF_SIGPENDING          2       /* signal pending */
84 #define TIF_NEED_RESCHED        3       /* rescheduling necessary */
85 #define TIF_USEDFPU             16      /* FPU was used by this task this quantum (SMP) */
86 #define TIF_POLLING_NRFLAG      17      /* true if poll_idle() is polling TIF_NEED_RESCHED */
87 #define TIF_SYSCALL_TRACE       31      /* syscall trace active */
88
89 #define _TIF_SYSCALL_TRACE      (1<<TIF_SYSCALL_TRACE)
90 #define _TIF_NOTIFY_RESUME      (1<<TIF_NOTIFY_RESUME)
91 #define _TIF_SIGPENDING         (1<<TIF_SIGPENDING)
92 #define _TIF_NEED_RESCHED       (1<<TIF_NEED_RESCHED)
93 #define _TIF_USEDFPU            (1<<TIF_USEDFPU)
94 #define _TIF_POLLING_NRFLAG     (1<<TIF_POLLING_NRFLAG)
95
96 #define _TIF_WORK_MASK          0x0000fffe      /* work to do on
97                                                    interrupt/exception return */
98 #define _TIF_ALLWORK_MASK       0x8000fffe      /* work to do on any return to
99                                                    u-space */
100
101 #endif /* __KERNEL__ */
102
103 #endif /* _ASM_THREAD_INFO_H */