1
2
3
4
5
6
7
8
9 #ifndef __ASM_PARISC_PROCESSOR_H
10 #define __ASM_PARISC_PROCESSOR_H
11
12 #ifndef __ASSEMBLY__
13 #include <linux/threads.h>
14
15 #include <asm/prefetch.h>
16 #include <asm/hardware.h>
17 #include <asm/pdc.h>
18 #include <asm/ptrace.h>
19 #include <asm/types.h>
20 #include <asm/percpu.h>
21 #endif
22
23 #define HAVE_ARCH_PICK_MMAP_LAYOUT
24
25 #define TASK_SIZE_OF(tsk) ((tsk)->thread.task_size)
26 #define TASK_SIZE TASK_SIZE_OF(current)
27 #define TASK_UNMAPPED_BASE (current->thread.map_base)
28
29 #define DEFAULT_TASK_SIZE32 (0xFFF00000UL)
30 #define DEFAULT_MAP_BASE32 (0x40000000UL)
31
32 #ifdef CONFIG_64BIT
33 #define DEFAULT_TASK_SIZE (MAX_ADDRESS-0xf000000)
34 #define DEFAULT_MAP_BASE (0x200000000UL)
35 #else
36 #define DEFAULT_TASK_SIZE DEFAULT_TASK_SIZE32
37 #define DEFAULT_MAP_BASE DEFAULT_MAP_BASE32
38 #endif
39
40 #ifdef __KERNEL__
41
42
43
44
45 #define STACK_TOP TASK_SIZE
46 #define STACK_TOP_MAX DEFAULT_TASK_SIZE
47
48
49 #define STACK_SIZE_MAX (USER_WIDE_MODE \
50 ? (1 << 30) \
51 : (CONFIG_MAX_STACK_SIZE_MB*1024*1024))
52
53 #endif
54
55 #ifndef __ASSEMBLY__
56
57
58
59
60
61
62
63 struct system_cpuinfo_parisc {
64 unsigned int cpu_count;
65 unsigned int cpu_hz;
66 unsigned int hversion;
67 unsigned int sversion;
68 enum cpu_type cpu_type;
69
70 struct {
71 struct pdc_model model;
72 unsigned long versions;
73 unsigned long cpuid;
74 unsigned long capabilities;
75 char sys_model_name[81];
76 } pdc;
77
78 const char *cpu_name;
79 const char *family_name;
80 };
81
82
83
84 struct cpuinfo_parisc {
85 unsigned long it_value;
86 unsigned long irq_count;
87 unsigned long cpuid;
88 unsigned long hpa;
89 unsigned long txn_addr;
90 #ifdef CONFIG_SMP
91 unsigned long pending_ipi;
92 #endif
93 unsigned long bh_count;
94 unsigned long fp_rev;
95 unsigned long fp_model;
96 unsigned long cpu_num;
97 unsigned long cpu_loc;
98 unsigned int state;
99 struct parisc_device *dev;
100 unsigned long loops_per_jiffy;
101 };
102
103 extern struct system_cpuinfo_parisc boot_cpu_data;
104 DECLARE_PER_CPU(struct cpuinfo_parisc, cpu_data);
105
106 #define CPU_HVERSION ((boot_cpu_data.hversion >> 4) & 0x0FFF)
107
108 typedef struct {
109 int seg;
110 } mm_segment_t;
111
112 #define ARCH_MIN_TASKALIGN 8
113
114 struct thread_struct {
115 struct pt_regs regs;
116 unsigned long task_size;
117 unsigned long map_base;
118 unsigned long flags;
119 };
120
121 #define task_pt_regs(tsk) ((struct pt_regs *)&((tsk)->thread.regs))
122
123
124 #define PARISC_UAC_NOPRINT (1UL << 0)
125 #define PARISC_UAC_SIGBUS (1UL << 1)
126 #define PARISC_KERNEL_DEATH (1UL << 31)
127
128 #define PARISC_UAC_SHIFT 0
129 #define PARISC_UAC_MASK (PARISC_UAC_NOPRINT|PARISC_UAC_SIGBUS)
130
131 #define SET_UNALIGN_CTL(task,value) \
132 ({ \
133 (task)->thread.flags = (((task)->thread.flags & ~PARISC_UAC_MASK) \
134 | (((value) << PARISC_UAC_SHIFT) & \
135 PARISC_UAC_MASK)); \
136 0; \
137 })
138
139 #define GET_UNALIGN_CTL(task,addr) \
140 ({ \
141 put_user(((task)->thread.flags & PARISC_UAC_MASK) \
142 >> PARISC_UAC_SHIFT, (int __user *) (addr)); \
143 })
144
145 #define INIT_THREAD { \
146 .regs = { .gr = { 0, }, \
147 .fr = { 0, }, \
148 .sr = { 0, }, \
149 .iasq = { 0, }, \
150 .iaoq = { 0, }, \
151 .cr27 = 0, \
152 }, \
153 .task_size = DEFAULT_TASK_SIZE, \
154 .map_base = DEFAULT_MAP_BASE, \
155 .flags = 0 \
156 }
157
158 struct task_struct;
159 void show_trace(struct task_struct *task, unsigned long *stack);
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176 typedef unsigned int elf_caddr_t;
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248 #define USER_WIDE_MODE (!is_32bit_task())
249
250 #define start_thread(regs, new_pc, new_sp) do { \
251 elf_addr_t *sp = (elf_addr_t *)new_sp; \
252 __u32 spaceid = (__u32)current->mm->context; \
253 elf_addr_t pc = (elf_addr_t)new_pc | 3; \
254 elf_caddr_t *argv = (elf_caddr_t *)bprm->exec + 1; \
255 \
256 regs->iasq[0] = spaceid; \
257 regs->iasq[1] = spaceid; \
258 regs->iaoq[0] = pc; \
259 regs->iaoq[1] = pc + 4; \
260 regs->sr[2] = LINUX_GATEWAY_SPACE; \
261 regs->sr[3] = 0xffff; \
262 regs->sr[4] = spaceid; \
263 regs->sr[5] = spaceid; \
264 regs->sr[6] = spaceid; \
265 regs->sr[7] = spaceid; \
266 regs->gr[ 0] = USER_PSW | (USER_WIDE_MODE ? PSW_W : 0); \
267 regs->fr[ 0] = 0LL; \
268 regs->fr[ 1] = 0LL; \
269 regs->fr[ 2] = 0LL; \
270 regs->fr[ 3] = 0LL; \
271 regs->gr[30] = (((unsigned long)sp + 63) &~ 63) | (USER_WIDE_MODE ? 1 : 0); \
272 regs->gr[31] = pc; \
273 \
274 get_user(regs->gr[25], (argv - 1)); \
275 regs->gr[24] = (long) argv; \
276 regs->gr[23] = 0; \
277 } while(0)
278
279 struct task_struct;
280 struct mm_struct;
281
282
283 extern void release_thread(struct task_struct *);
284
285 extern unsigned long get_wchan(struct task_struct *p);
286
287 #define KSTK_EIP(tsk) ((tsk)->thread.regs.iaoq[0])
288 #define KSTK_ESP(tsk) ((tsk)->thread.regs.gr[30])
289
290 #define cpu_relax() barrier()
291
292
293
294
295
296
297 #ifdef CONFIG_PA8X00
298 extern int _parisc_requires_coherency;
299 #define parisc_requires_coherency() _parisc_requires_coherency
300 #else
301 #define parisc_requires_coherency() (0)
302 #endif
303
304 extern int running_on_qemu;
305
306 #endif
307
308 #endif