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