Merge tag 'mfd-for-linus-3.20' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd
[pandora-kernel.git] / arch / frv / include / asm / thread_info.h
1 /* thread_info.h: description
2  *
3  * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4  * Written by David Howells (dhowells@redhat.com)
5  * Derived from include/asm-i386/thread_info.h
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version
10  * 2 of the License, or (at your option) any later version.
11  */
12
13 #ifndef _ASM_THREAD_INFO_H
14 #define _ASM_THREAD_INFO_H
15
16 #ifdef __KERNEL__
17
18 #ifndef __ASSEMBLY__
19 #include <asm/processor.h>
20 #endif
21
22 #define THREAD_SIZE             8192
23
24 /*
25  * low level task data that entry.S needs immediate access to
26  * - this struct should fit entirely inside of one cache line
27  * - this struct shares the supervisor stack pages
28  * - if the contents of this structure are changed, the assembly constants must also be changed
29  */
30 #ifndef __ASSEMBLY__
31
32 struct thread_info {
33         struct task_struct      *task;          /* main task structure */
34         struct exec_domain      *exec_domain;   /* execution domain */
35         unsigned long           flags;          /* low level flags */
36         unsigned long           status;         /* thread-synchronous flags */
37         __u32                   cpu;            /* current CPU */
38         int                     preempt_count;  /* 0 => preemptable, <0 => BUG */
39
40         mm_segment_t            addr_limit;     /* thread address space:
41                                                  * 0-0xBFFFFFFF for user-thead
42                                                  * 0-0xFFFFFFFF for kernel-thread
43                                                  */
44
45         __u8                    supervisor_stack[0];
46 };
47
48 #else /* !__ASSEMBLY__ */
49
50 #include <asm/asm-offsets.h>
51
52 #endif
53
54 /*
55  * macros/functions for gaining access to the thread information structure
56  */
57 #ifndef __ASSEMBLY__
58
59 #define INIT_THREAD_INFO(tsk)                   \
60 {                                               \
61         .task           = &tsk,                 \
62         .exec_domain    = &default_exec_domain, \
63         .flags          = 0,                    \
64         .cpu            = 0,                    \
65         .preempt_count  = INIT_PREEMPT_COUNT,   \
66         .addr_limit     = KERNEL_DS,            \
67 }
68
69 #define init_thread_info        (init_thread_union.thread_info)
70 #define init_stack              (init_thread_union.stack)
71
72 /* how to get the thread information struct from C */
73 register struct thread_info *__current_thread_info asm("gr15");
74
75 #define current_thread_info() ({ __current_thread_info; })
76
77 #endif /* __ASSEMBLY__ */
78
79 /*
80  * thread information flags
81  * - these are process state flags that various assembly files may need to access
82  * - pending work-to-be-done flags are in LSW
83  * - other flags in MSW
84  */
85 #define TIF_SYSCALL_TRACE       0       /* syscall trace active */
86 #define TIF_NOTIFY_RESUME       1       /* callback before returning to user */
87 #define TIF_SIGPENDING          2       /* signal pending */
88 #define TIF_NEED_RESCHED        3       /* rescheduling necessary */
89 #define TIF_SINGLESTEP          4       /* restore singlestep on return to user mode */
90 #define TIF_RESTORE_SIGMASK     5       /* restore signal mask in do_signal() */
91 #define TIF_MEMDIE              7       /* is terminating due to OOM killer */
92
93 #define _TIF_SYSCALL_TRACE      (1 << TIF_SYSCALL_TRACE)
94 #define _TIF_NOTIFY_RESUME      (1 << TIF_NOTIFY_RESUME)
95 #define _TIF_SIGPENDING         (1 << TIF_SIGPENDING)
96 #define _TIF_NEED_RESCHED       (1 << TIF_NEED_RESCHED)
97 #define _TIF_SINGLESTEP         (1 << TIF_SINGLESTEP)
98
99 /* work to do on interrupt/exception return */
100 #define _TIF_WORK_MASK          \
101         (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_SINGLESTEP)
102
103 /* work to do on any return to u-space */
104 #define _TIF_ALLWORK_MASK       (_TIF_WORK_MASK | _TIF_SYSCALL_TRACE)
105
106 #if _TIF_ALLWORK_MASK >= 0x2000
107 #error "_TIF_ALLWORK_MASK won't fit in an ANDI now (see entry.S)"
108 #endif
109
110 /*
111  * Thread-synchronous status.
112  *
113  * This is different from the flags in that nobody else
114  * ever touches our thread-synchronous status, so we don't
115  * have to worry about atomic accesses.
116  */
117 #define TS_USEDFPM              0x0001  /* FPU/Media was used by this task this quantum (SMP) */
118
119 #endif /* __KERNEL__ */
120
121 #endif /* _ASM_THREAD_INFO_H */