patch-2_6_7-vs1_9_1_12
[linux-2.6.git] / include / asm-s390 / thread_info.h
1 /*
2  *  include/asm-s390/thread_info.h
3  *
4  *  S390 version
5  *    Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, IBM Corporation
6  *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
7  */
8
9 #ifndef _ASM_THREAD_INFO_H
10 #define _ASM_THREAD_INFO_H
11
12 #ifdef __KERNEL__
13
14 #ifndef __ASSEMBLY__
15 #include <asm/processor.h>
16 #include <asm/lowcore.h>
17
18 /*
19  * low level task data that entry.S needs immediate access to
20  * - this struct should fit entirely inside of one cache line
21  * - this struct shares the supervisor stack pages
22  * - if the contents of this structure are changed, the assembly constants must also be changed
23  */
24 struct thread_info {
25         struct task_struct      *task;          /* main task structure */
26         struct exec_domain      *exec_domain;   /* execution domain */
27         unsigned long           flags;          /* low level flags */
28         unsigned int            cpu;            /* current CPU */
29         unsigned int            preempt_count; /* 0 => preemptable */
30         struct restart_block    restart_block;
31 };
32
33 /*
34  * macros/functions for gaining access to the thread information structure
35  */
36 #define INIT_THREAD_INFO(tsk)                   \
37 {                                               \
38         .task           = &tsk,                 \
39         .exec_domain    = &default_exec_domain, \
40         .flags          = 0,                    \
41         .cpu            = 0,                    \
42         .restart_block  = {                     \
43                 .fn = do_no_restart_syscall,    \
44         },                                      \
45 }
46
47 #define init_thread_info        (init_thread_union.thread_info)
48 #define init_stack              (init_thread_union.stack)
49
50 /*
51  * Size of kernel stack for each process
52  */
53 #ifndef __s390x__
54 #define THREAD_ORDER 1
55 #define ASYNC_ORDER  1
56 #else /* __s390x__ */
57 #define THREAD_ORDER 2
58 #define ASYNC_ORDER  2
59 #endif /* __s390x__ */
60
61 #define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER)
62 #define ASYNC_SIZE  (PAGE_SIZE << ASYNC_ORDER)
63
64 /* how to get the thread information struct from C */
65 static inline struct thread_info *current_thread_info(void)
66 {
67         return (struct thread_info *)((*(unsigned long *) __LC_KERNEL_STACK)-THREAD_SIZE);
68 }
69
70 /* thread information allocation */
71 #define alloc_thread_info(tsk) ((struct thread_info *) \
72         __get_free_pages(GFP_KERNEL,THREAD_ORDER))
73 #define free_thread_info(ti) free_pages((unsigned long) (ti),THREAD_ORDER)
74 #define get_thread_info(ti) get_task_struct((ti)->task)
75 #define put_thread_info(ti) put_task_struct((ti)->task)
76
77 #endif
78
79 /*
80  * thread information flags 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_RESTART_SVC         4       /* restart svc with new svc number */
87 #define TIF_SYSCALL_AUDIT       5       /* syscall auditing active */
88 #define TIF_SINGLE_STEP         6       /* single stepped svc */
89 #define TIF_USEDFPU             16      /* FPU was used by this task this quantum (SMP) */
90 #define TIF_POLLING_NRFLAG      17      /* true if poll_idle() is polling 
91                                            TIF_NEED_RESCHED */
92 #define TIF_31BIT               18      /* 32bit process */ 
93
94 #define _TIF_SYSCALL_TRACE      (1<<TIF_SYSCALL_TRACE)
95 #define _TIF_NOTIFY_RESUME      (1<<TIF_NOTIFY_RESUME)
96 #define _TIF_SIGPENDING         (1<<TIF_SIGPENDING)
97 #define _TIF_NEED_RESCHED       (1<<TIF_NEED_RESCHED)
98 #define _TIF_RESTART_SVC        (1<<TIF_RESTART_SVC)
99 #define _TIF_SYSCALL_AUDIT      (1<<TIF_SYSCALL_AUDIT)
100 #define _TIF_SINGLE_STEP        (1<<TIF_SINGLE_STEP)
101 #define _TIF_USEDFPU            (1<<TIF_USEDFPU)
102 #define _TIF_POLLING_NRFLAG     (1<<TIF_POLLING_NRFLAG)
103 #define _TIF_31BIT              (1<<TIF_31BIT)
104
105 #endif /* __KERNEL__ */
106
107 #define PREEMPT_ACTIVE          0x4000000
108
109 #endif /* _ASM_THREAD_INFO_H */