1
2
3
4
5
6
7
8#ifndef __ASM_PARISC_PROCESSOR_H
9#define __ASM_PARISC_PROCESSOR_H
10
11#ifndef __ASSEMBLY__
12#include <linux/threads.h>
13
14#include <asm/prefetch.h>
15#include <asm/hardware.h>
16#include <asm/pdc.h>
17#include <asm/ptrace.h>
18#include <asm/types.h>
19#include <asm/percpu.h>
20#endif
21
22
23
24
25
26#ifdef CONFIG_PA20
27#define current_ia(x) __asm__("mfia %0" : "=r"(x))
28#else
29#define current_ia(x) __asm__("blr 0,%0\n\tnop" : "=r"(x))
30#endif
31#define current_text_addr() ({ void *pc; current_ia(pc); pc; })
32
33#define TASK_SIZE_OF(tsk) ((tsk)->thread.task_size)
34#define TASK_SIZE TASK_SIZE_OF(current)
35#define TASK_UNMAPPED_BASE (current->thread.map_base)
36
37#define DEFAULT_TASK_SIZE32 (0xFFF00000UL)
38#define DEFAULT_MAP_BASE32 (0x40000000UL)
39
40#ifdef CONFIG_64BIT
41#define DEFAULT_TASK_SIZE (MAX_ADDRESS-0xf000000)
42#define DEFAULT_MAP_BASE (0x200000000UL)
43#else
44#define DEFAULT_TASK_SIZE DEFAULT_TASK_SIZE32
45#define DEFAULT_MAP_BASE DEFAULT_MAP_BASE32
46#endif
47
48#ifdef __KERNEL__
49
50
51
52
53#define STACK_TOP TASK_SIZE
54#define STACK_TOP_MAX DEFAULT_TASK_SIZE
55
56#endif
57
58#ifndef __ASSEMBLY__
59
60
61
62
63
64
65
66struct system_cpuinfo_parisc {
67 unsigned int cpu_count;
68 unsigned int cpu_hz;
69 unsigned int hversion;
70 unsigned int sversion;
71 enum cpu_type cpu_type;
72
73 struct {
74 struct pdc_model model;
75 unsigned long versions;
76 unsigned long cpuid;
77 unsigned long capabilities;
78 char sys_model_name[81];
79 } pdc;
80
81 const char *cpu_name;
82 const char *family_name;
83};
84
85
86
87struct cpuinfo_parisc {
88 unsigned long it_value;
89 unsigned long it_delta;
90 unsigned long irq_count;
91 unsigned long irq_max_cr16;
92 unsigned long cpuid;
93 unsigned long hpa;
94 unsigned long txn_addr;
95#ifdef CONFIG_SMP
96 unsigned long pending_ipi;
97#endif
98 unsigned long bh_count;
99 unsigned long prof_counter;
100 unsigned long prof_multiplier;
101 unsigned long fp_rev;
102 unsigned long fp_model;
103 unsigned int state;
104 struct parisc_device *dev;
105 unsigned long loops_per_jiffy;
106};
107
108extern struct system_cpuinfo_parisc boot_cpu_data;
109DECLARE_PER_CPU(struct cpuinfo_parisc, cpu_data);
110
111#define CPU_HVERSION ((boot_cpu_data.hversion >> 4) & 0x0FFF)
112
113typedef struct {
114 int seg;
115} mm_segment_t;
116
117#define ARCH_MIN_TASKALIGN 8
118
119struct thread_struct {
120 struct pt_regs regs;
121 unsigned long task_size;
122 unsigned long map_base;
123 unsigned long flags;
124};
125
126#define task_pt_regs(tsk) ((struct pt_regs *)&((tsk)->thread.regs))
127
128
129#define PARISC_UAC_NOPRINT (1UL << 0)
130#define PARISC_UAC_SIGBUS (1UL << 1)
131#define PARISC_KERNEL_DEATH (1UL << 31)
132
133#define PARISC_UAC_SHIFT 0
134#define PARISC_UAC_MASK (PARISC_UAC_NOPRINT|PARISC_UAC_SIGBUS)
135
136#define SET_UNALIGN_CTL(task,value) \
137 ({ \
138 (task)->thread.flags = (((task)->thread.flags & ~PARISC_UAC_MASK) \
139 | (((value) << PARISC_UAC_SHIFT) & \
140 PARISC_UAC_MASK)); \
141 0; \
142 })
143
144#define GET_UNALIGN_CTL(task,addr) \
145 ({ \
146 put_user(((task)->thread.flags & PARISC_UAC_MASK) \
147 >> PARISC_UAC_SHIFT, (int __user *) (addr)); \
148 })
149
150#define INIT_THREAD { \
151 .regs = { .gr = { 0, }, \
152 .fr = { 0, }, \
153 .sr = { 0, }, \
154 .iasq = { 0, }, \
155 .iaoq = { 0, }, \
156 .cr27 = 0, \
157 }, \
158 .task_size = DEFAULT_TASK_SIZE, \
159 .map_base = DEFAULT_MAP_BASE, \
160 .flags = 0 \
161 }
162
163
164
165
166
167struct task_struct;
168unsigned long thread_saved_pc(struct task_struct *t);
169void show_trace(struct task_struct *task, unsigned long *stack);
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186typedef unsigned int elf_caddr_t;
187
188#define start_thread_som(regs, new_pc, new_sp) do { \
189 unsigned long *sp = (unsigned long *)new_sp; \
190 __u32 spaceid = (__u32)current->mm->context; \
191 unsigned long pc = (unsigned long)new_pc; \
192 \
193 pc |= 3; \
194 \
195 regs->iasq[0] = spaceid; \
196 regs->iasq[1] = spaceid; \
197 regs->iaoq[0] = pc; \
198 regs->iaoq[1] = pc + 4; \
199 regs->sr[2] = LINUX_GATEWAY_SPACE; \
200 regs->sr[3] = 0xffff; \
201 regs->sr[4] = spaceid; \
202 regs->sr[5] = spaceid; \
203 regs->sr[6] = spaceid; \
204 regs->sr[7] = spaceid; \
205 regs->gr[ 0] = USER_PSW; \
206 regs->gr[30] = ((new_sp)+63)&~63; \
207 regs->gr[31] = pc; \
208 \
209 get_user(regs->gr[26],&sp[0]); \
210 get_user(regs->gr[25],&sp[-1]); \
211 get_user(regs->gr[24],&sp[-2]); \
212 get_user(regs->gr[23],&sp[-3]); \
213} while(0)
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
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285#ifdef CONFIG_64BIT
286#define USER_WIDE_MODE (!test_thread_flag(TIF_32BIT))
287#else
288#define USER_WIDE_MODE 0
289#endif
290
291#define start_thread(regs, new_pc, new_sp) do { \
292 elf_addr_t *sp = (elf_addr_t *)new_sp; \
293 __u32 spaceid = (__u32)current->mm->context; \
294 elf_addr_t pc = (elf_addr_t)new_pc | 3; \
295 elf_caddr_t *argv = (elf_caddr_t *)bprm->exec + 1; \
296 \
297 regs->iasq[0] = spaceid; \
298 regs->iasq[1] = spaceid; \
299 regs->iaoq[0] = pc; \
300 regs->iaoq[1] = pc + 4; \
301 regs->sr[2] = LINUX_GATEWAY_SPACE; \
302 regs->sr[3] = 0xffff; \
303 regs->sr[4] = spaceid; \
304 regs->sr[5] = spaceid; \
305 regs->sr[6] = spaceid; \
306 regs->sr[7] = spaceid; \
307 regs->gr[ 0] = USER_PSW | (USER_WIDE_MODE ? PSW_W : 0); \
308 regs->fr[ 0] = 0LL; \
309 regs->fr[ 1] = 0LL; \
310 regs->fr[ 2] = 0LL; \
311 regs->fr[ 3] = 0LL; \
312 regs->gr[30] = (((unsigned long)sp + 63) &~ 63) | (USER_WIDE_MODE ? 1 : 0); \
313 regs->gr[31] = pc; \
314 \
315 get_user(regs->gr[25], (argv - 1)); \
316 regs->gr[24] = (long) argv; \
317 regs->gr[23] = 0; \
318} while(0)
319
320struct task_struct;
321struct mm_struct;
322
323
324extern void release_thread(struct task_struct *);
325
326extern void map_hpux_gateway_page(struct task_struct *tsk, struct mm_struct *mm);
327
328extern unsigned long get_wchan(struct task_struct *p);
329
330#define KSTK_EIP(tsk) ((tsk)->thread.regs.iaoq[0])
331#define KSTK_ESP(tsk) ((tsk)->thread.regs.gr[30])
332
333#define cpu_relax() barrier()
334
335
336
337
338static inline int parisc_requires_coherency(void)
339{
340#ifdef CONFIG_PA8X00
341 return (boot_cpu_data.cpu_type == mako) ||
342 (boot_cpu_data.cpu_type == mako2);
343#else
344 return 0;
345#endif
346}
347
348#endif
349
350#endif
351