ppc64: Add PREEMPT_ACTIVE and fix HMT macro typo
[opensuse:kernel.git] / include / asm-ppc64 / thread_info.h
1 /* thread_info.h: PPC low-level thread information
2  * adapted from the i386 version by Paul Mackerras
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 #ifdef __KERNEL__
12
13 #ifndef __ASSEMBLY__
14 #include <asm/processor.h>
15 #include <linux/stringify.h>
16
17 /*
18  * low level task data.
19  */
20 struct thread_info {
21         struct task_struct *task;               /* main task structure */
22         struct exec_domain *exec_domain;        /* execution domain */
23         unsigned long   flags;                  /* low level flags */
24         int             cpu;                    /* cpu we're on */
25         int             preempt_count;          /* not used at present */
26 };
27
28 /*
29  * macros/functions for gaining access to the thread information structure
30  */
31 #define INIT_THREAD_INFO(tsk)                   \
32 {                                               \
33         task:           &tsk,                   \
34         exec_domain:    &default_exec_domain,   \
35         flags:          0,                      \
36         cpu:            0,                      \
37 }
38
39 #define init_thread_info        (init_thread_union.thread_info)
40 #define init_stack              (init_thread_union.stack)
41
42 /* thread information allocation */
43
44 #define THREAD_ORDER            2
45 #define THREAD_SIZE             (PAGE_SIZE << THREAD_ORDER)
46 #define THREAD_SHIFT            (PAGE_SHIFT + THREAD_ORDER)
47
48 #define alloc_thread_info() ((struct thread_info *) \
49                                 __get_free_pages(GFP_KERNEL, THREAD_ORDER))
50 #define free_thread_info(ti)    free_pages((unsigned long) (ti), THREAD_ORDER)
51 #define get_thread_info(ti)     get_task_struct((ti)->task)
52 #define put_thread_info(ti)     put_task_struct((ti)->task)
53
54 #if THREAD_SIZE != (4*PAGE_SIZE)
55 #error update vmlinux.lds and current_thread_info to match
56 #endif
57
58 /* how to get the thread information struct from C */
59 static inline struct thread_info *current_thread_info(void)
60 {
61         struct thread_info *ti;
62         __asm__("clrrdi %0,1,14" : "=r"(ti));
63         return ti;
64 }
65
66 #endif /* __ASSEMBLY__ */
67
68 #define PREEMPT_ACTIVE          0x4000000
69
70 /*
71  * thread information flag bit numbers
72  */
73 #define TIF_SYSCALL_TRACE       0       /* syscall trace active */
74 #define TIF_NOTIFY_RESUME       1       /* resumption notification requested */
75 #define TIF_SIGPENDING          2       /* signal pending */
76 #define TIF_NEED_RESCHED        3       /* rescheduling necessary */
77 #define TIF_POLLING_NRFLAG      4       /* true if poll_idle() is polling
78                                            TIF_NEED_RESCHED */
79 #define TIF_32BIT               5       /* 32 bit binary */
80 #define TIF_RUN_LIGHT           6       /* iSeries run light */
81
82 /* as above, but as bit values */
83 #define _TIF_SYSCALL_TRACE      (1<<TIF_SYSCALL_TRACE)
84 #define _TIF_NOTIFY_RESUME      (1<<TIF_NOTIFY_RESUME)
85 #define _TIF_SIGPENDING         (1<<TIF_SIGPENDING)
86 #define _TIF_NEED_RESCHED       (1<<TIF_NEED_RESCHED)
87 #define _TIF_POLLING_NRFLAG     (1<<TIF_POLLING_NRFLAG)
88 #define _TIF_32BIT              (1<<TIF_32BIT)
89 #define _TIF_RUN_LIGHT          (1<<TIF_RUN_LIGHT)
90
91 #define _TIF_USER_WORK_MASK     (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING | \
92                                  _TIF_NEED_RESCHED)
93
94 #endif /* __KERNEL__ */
95
96 #endif /* _ASM_THREAD_INFO_H */