diff options
Diffstat (limited to 'arch/blackfin/include/asm/thread_info.h')
-rw-r--r-- | arch/blackfin/include/asm/thread_info.h | 135 |
1 files changed, 135 insertions, 0 deletions
diff --git a/arch/blackfin/include/asm/thread_info.h b/arch/blackfin/include/asm/thread_info.h new file mode 100644 index 000000000000..642769329d12 --- /dev/null +++ b/arch/blackfin/include/asm/thread_info.h | |||
@@ -0,0 +1,135 @@ | |||
1 | /* | ||
2 | * File: include/asm-blackfin/thread_info.h | ||
3 | * Based on: include/asm-m68knommu/thread_info.h | ||
4 | * Author: LG Soft India | ||
5 | * Copyright (C) 2004-2005 Analog Devices Inc. | ||
6 | * Created: Tue Sep 21 2004 | ||
7 | * Description: Blackfin low-level thread information | ||
8 | * Modified: | ||
9 | * Bugs: Enter bugs at http://blackfin.uclinux.org/ | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License as published by | ||
13 | * the Free Software Foundation; either version 2, or (at your option) | ||
14 | * any later version. | ||
15 | * | ||
16 | * This program is distributed in the hope that it will be useful, | ||
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
19 | * GNU General Public License for more details. | ||
20 | * | ||
21 | * You should have received a copy of the GNU General Public License | ||
22 | * along with this program; see the file COPYING. | ||
23 | * If not, write to the Free Software Foundation, | ||
24 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
25 | */ | ||
26 | |||
27 | #ifndef _ASM_THREAD_INFO_H | ||
28 | #define _ASM_THREAD_INFO_H | ||
29 | |||
30 | #include <asm/page.h> | ||
31 | #include <asm/entry.h> | ||
32 | #include <asm/l1layout.h> | ||
33 | #include <linux/compiler.h> | ||
34 | |||
35 | #ifdef __KERNEL__ | ||
36 | |||
37 | /* Thread Align Mask to reach to the top of the stack | ||
38 | * for any process | ||
39 | */ | ||
40 | #define ALIGN_PAGE_MASK 0xffffe000 | ||
41 | |||
42 | /* | ||
43 | * Size of kernel stack for each process. This must be a power of 2... | ||
44 | */ | ||
45 | #define THREAD_SIZE_ORDER 1 | ||
46 | #define THREAD_SIZE 8192 /* 2 pages */ | ||
47 | |||
48 | #ifndef __ASSEMBLY__ | ||
49 | |||
50 | typedef unsigned long mm_segment_t; | ||
51 | |||
52 | /* | ||
53 | * low level task data. | ||
54 | * If you change this, change the TI_* offsets below to match. | ||
55 | */ | ||
56 | |||
57 | struct thread_info { | ||
58 | struct task_struct *task; /* main task structure */ | ||
59 | struct exec_domain *exec_domain; /* execution domain */ | ||
60 | unsigned long flags; /* low level flags */ | ||
61 | int cpu; /* cpu we're on */ | ||
62 | int preempt_count; /* 0 => preemptable, <0 => BUG */ | ||
63 | mm_segment_t addr_limit; /* address limit */ | ||
64 | struct restart_block restart_block; | ||
65 | struct l1_scratch_task_info l1_task_info; | ||
66 | }; | ||
67 | |||
68 | /* | ||
69 | * macros/functions for gaining access to the thread information structure | ||
70 | */ | ||
71 | #define INIT_THREAD_INFO(tsk) \ | ||
72 | { \ | ||
73 | .task = &tsk, \ | ||
74 | .exec_domain = &default_exec_domain, \ | ||
75 | .flags = 0, \ | ||
76 | .cpu = 0, \ | ||
77 | .preempt_count = 1, \ | ||
78 | .restart_block = { \ | ||
79 | .fn = do_no_restart_syscall, \ | ||
80 | }, \ | ||
81 | } | ||
82 | #define init_thread_info (init_thread_union.thread_info) | ||
83 | #define init_stack (init_thread_union.stack) | ||
84 | |||
85 | /* Given a task stack pointer, you can find its corresponding | ||
86 | * thread_info structure just by masking it to the THREAD_SIZE | ||
87 | * boundary (currently 8K as you can see above). | ||
88 | */ | ||
89 | __attribute_const__ | ||
90 | static inline struct thread_info *current_thread_info(void) | ||
91 | { | ||
92 | struct thread_info *ti; | ||
93 | __asm__("%0 = sp;": "=&d"(ti): | ||
94 | ); | ||
95 | return (struct thread_info *)((long)ti & ~((long)THREAD_SIZE-1)); | ||
96 | } | ||
97 | |||
98 | #endif /* __ASSEMBLY__ */ | ||
99 | |||
100 | /* | ||
101 | * Offsets in thread_info structure, used in assembly code | ||
102 | */ | ||
103 | #define TI_TASK 0 | ||
104 | #define TI_EXECDOMAIN 4 | ||
105 | #define TI_FLAGS 8 | ||
106 | #define TI_CPU 12 | ||
107 | #define TI_PREEMPT 16 | ||
108 | |||
109 | #define PREEMPT_ACTIVE 0x4000000 | ||
110 | |||
111 | /* | ||
112 | * thread information flag bit numbers | ||
113 | */ | ||
114 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ | ||
115 | #define TIF_SIGPENDING 1 /* signal pending */ | ||
116 | #define TIF_NEED_RESCHED 2 /* rescheduling necessary */ | ||
117 | #define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling | ||
118 | TIF_NEED_RESCHED */ | ||
119 | #define TIF_MEMDIE 4 | ||
120 | #define TIF_RESTORE_SIGMASK 5 /* restore signal mask in do_signal() */ | ||
121 | #define TIF_FREEZE 6 /* is freezing for suspend */ | ||
122 | |||
123 | /* as above, but as bit values */ | ||
124 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) | ||
125 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) | ||
126 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) | ||
127 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) | ||
128 | #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) | ||
129 | #define _TIF_FREEZE (1<<TIF_FREEZE) | ||
130 | |||
131 | #define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */ | ||
132 | |||
133 | #endif /* __KERNEL__ */ | ||
134 | |||
135 | #endif /* _ASM_THREAD_INFO_H */ | ||