diff options
author | Richard Kuo <rkuo@codeaurora.org> | 2011-10-31 19:36:46 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-11-01 10:34:18 -0400 |
commit | 52f710249e2ec20f2d03fc31b7fb281126507097 (patch) | |
tree | 1871e9e03ddeb130af82d795d1961ef10e29d4fe | |
parent | 99a70aa051d2aef6a91761c2230264cfcf20ae74 (diff) |
Hexagon: Add threadinfo
Signed-off-by: Richard Kuo <rkuo@codeaurora.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | arch/hexagon/include/asm/thread_info.h | 154 |
1 files changed, 154 insertions, 0 deletions
diff --git a/arch/hexagon/include/asm/thread_info.h b/arch/hexagon/include/asm/thread_info.h new file mode 100644 index 000000000000..9c2934ff5756 --- /dev/null +++ b/arch/hexagon/include/asm/thread_info.h | |||
@@ -0,0 +1,154 @@ | |||
1 | /* | ||
2 | * Thread support for the Hexagon architecture | ||
3 | * | ||
4 | * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 and | ||
8 | * only version 2 as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
18 | * 02110-1301, USA. | ||
19 | */ | ||
20 | |||
21 | #ifndef _ASM_THREAD_INFO_H | ||
22 | #define _ASM_THREAD_INFO_H | ||
23 | |||
24 | #ifdef __KERNEL__ | ||
25 | |||
26 | #ifndef __ASSEMBLY__ | ||
27 | #include <asm/processor.h> | ||
28 | #include <asm/registers.h> | ||
29 | #include <asm/page.h> | ||
30 | #endif | ||
31 | |||
32 | #define THREAD_SHIFT 12 | ||
33 | #define THREAD_SIZE (1<<THREAD_SHIFT) | ||
34 | |||
35 | #if THREAD_SHIFT >= PAGE_SHIFT | ||
36 | #define THREAD_SIZE_ORDER (THREAD_SHIFT - PAGE_SHIFT) | ||
37 | #else /* don't use standard allocator */ | ||
38 | #define __HAVE_ARCH_THREAD_INFO_ALLOCATOR | ||
39 | extern struct thread_info *alloc_thread_info_node(struct task_struct *tsk, int node); | ||
40 | extern void free_thread_info(struct thread_info *ti); | ||
41 | #endif | ||
42 | |||
43 | |||
44 | #ifndef __ASSEMBLY__ | ||
45 | |||
46 | typedef struct { | ||
47 | unsigned long seg; | ||
48 | } mm_segment_t; | ||
49 | |||
50 | /* | ||
51 | * This is union'd with the "bottom" of the kernel stack. | ||
52 | * It keeps track of thread info which is handy for routines | ||
53 | * to access quickly. | ||
54 | */ | ||
55 | |||
56 | struct thread_info { | ||
57 | struct task_struct *task; /* main task structure */ | ||
58 | struct exec_domain *exec_domain; /* execution domain */ | ||
59 | unsigned long flags; /* low level flags */ | ||
60 | __u32 cpu; /* current cpu */ | ||
61 | int preempt_count; /* 0=>preemptible,<0=>BUG */ | ||
62 | mm_segment_t addr_limit; /* segmentation sux */ | ||
63 | /* | ||
64 | * used for syscalls somehow; | ||
65 | * seems to have a function pointer and four arguments | ||
66 | */ | ||
67 | struct restart_block restart_block; | ||
68 | /* Points to the current pt_regs frame */ | ||
69 | struct pt_regs *regs; | ||
70 | /* | ||
71 | * saved kernel sp at switch_to time; | ||
72 | * not sure if this is used (it's not in the VM model it seems; | ||
73 | * see thread_struct) | ||
74 | */ | ||
75 | unsigned long sp; | ||
76 | }; | ||
77 | |||
78 | #else /* !__ASSEMBLY__ */ | ||
79 | |||
80 | #include <asm/asm-offsets.h> | ||
81 | |||
82 | #endif /* __ASSEMBLY__ */ | ||
83 | |||
84 | /* looks like "linux/hardirq.h" uses this. */ | ||
85 | |||
86 | #define PREEMPT_ACTIVE 0x10000000 | ||
87 | |||
88 | #ifndef __ASSEMBLY__ | ||
89 | |||
90 | #define INIT_THREAD_INFO(tsk) \ | ||
91 | { \ | ||
92 | .task = &tsk, \ | ||
93 | .exec_domain = &default_exec_domain, \ | ||
94 | .flags = 0, \ | ||
95 | .cpu = 0, \ | ||
96 | .preempt_count = 1, \ | ||
97 | .addr_limit = KERNEL_DS, \ | ||
98 | .restart_block = { \ | ||
99 | .fn = do_no_restart_syscall, \ | ||
100 | }, \ | ||
101 | .sp = 0, \ | ||
102 | .regs = NULL, \ | ||
103 | } | ||
104 | |||
105 | #define init_thread_info (init_thread_union.thread_info) | ||
106 | #define init_stack (init_thread_union.stack) | ||
107 | |||
108 | /* Tacky preprocessor trickery */ | ||
109 | #define qqstr(s) qstr(s) | ||
110 | #define qstr(s) #s | ||
111 | #define QUOTED_THREADINFO_REG qqstr(THREADINFO_REG) | ||
112 | |||
113 | register struct thread_info *__current_thread_info asm(QUOTED_THREADINFO_REG); | ||
114 | #define current_thread_info() __current_thread_info | ||
115 | |||
116 | #endif /* __ASSEMBLY__ */ | ||
117 | |||
118 | /* | ||
119 | * thread information flags | ||
120 | * - these are process state flags that various assembly files | ||
121 | * may need to access | ||
122 | * - pending work-to-be-done flags are in LSW | ||
123 | * - other flags in MSW | ||
124 | */ | ||
125 | |||
126 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ | ||
127 | #define TIF_NOTIFY_RESUME 1 /* resumption notification requested */ | ||
128 | #define TIF_SIGPENDING 2 /* signal pending */ | ||
129 | #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ | ||
130 | #define TIF_SINGLESTEP 4 /* restore ss @ return to usr mode */ | ||
131 | #define TIF_IRET 5 /* return with iret */ | ||
132 | #define TIF_RESTORE_SIGMASK 6 /* restore sig mask in do_signal() */ | ||
133 | /* true if poll_idle() is polling TIF_NEED_RESCHED */ | ||
134 | #define TIF_POLLING_NRFLAG 16 | ||
135 | #define TIF_MEMDIE 17 /* OOM killer killed process */ | ||
136 | |||
137 | #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) | ||
138 | #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) | ||
139 | #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) | ||
140 | #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) | ||
141 | #define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP) | ||
142 | #define _TIF_IRET (1 << TIF_IRET) | ||
143 | #define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK) | ||
144 | #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) | ||
145 | |||
146 | /* work to do on interrupt/exception return - All but TIF_SYSCALL_TRACE */ | ||
147 | #define _TIF_WORK_MASK (0x0000FFFF & ~_TIF_SYSCALL_TRACE) | ||
148 | |||
149 | /* work to do on any return to u-space */ | ||
150 | #define _TIF_ALLWORK_MASK 0x0000FFFF | ||
151 | |||
152 | #endif /* __KERNEL__ */ | ||
153 | |||
154 | #endif | ||