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 HAVE_ARCH_PICK_MMAP_LAYOUT
34
35#define TASK_SIZE_OF(tsk) ((tsk)->thread.task_size)
36#define TASK_SIZE TASK_SIZE_OF(current)
37#define TASK_UNMAPPED_BASE (current->thread.map_base)
38
39#define DEFAULT_TASK_SIZE32 (0xFFF00000UL)
40#define DEFAULT_MAP_BASE32 (0x40000000UL)
41
42#ifdef CONFIG_64BIT
43#define DEFAULT_TASK_SIZE (MAX_ADDRESS-0xf000000)
44#define DEFAULT_MAP_BASE (0x200000000UL)
45#else
46#define DEFAULT_TASK_SIZE DEFAULT_TASK_SIZE32
47#define DEFAULT_MAP_BASE DEFAULT_MAP_BASE32
48#endif
49
50#ifdef __KERNEL__
51
52
53
54
55#define STACK_TOP TASK_SIZE
56#define STACK_TOP_MAX DEFAULT_TASK_SIZE
57
58
59#define STACK_SIZE_MAX (USER_WIDE_MODE \
60 ? (1 << 30) \
61 : (CONFIG_MAX_STACK_SIZE_MB*1024*1024))
62
63#endif
64
65#ifndef __ASSEMBLY__
66
67
68
69
70
71
72
73struct system_cpuinfo_parisc {
74 unsigned int cpu_count;
75 unsigned int cpu_hz;
76 unsigned int hversion;
77 unsigned int sversion;
78 enum cpu_type cpu_type;
79
80 struct {
81 struct pdc_model model;
82 unsigned long versions;
83 unsigned long cpuid;
84 unsigned long capabilities;
85 char sys_model_name[81];
86 } pdc;
87
88 const char *cpu_name;
89 const char *family_name;
90};
91
92
93
94struct cpuinfo_parisc {
95 unsigned long it_value;
96 unsigned long irq_count;
97 unsigned long cpuid;
98 unsigned long hpa;
99 unsigned long txn_addr;
100#ifdef CONFIG_SMP
101 unsigned long pending_ipi;
102#endif
103 unsigned long bh_count;
104 unsigned long fp_rev;
105 unsigned long fp_model;
106 unsigned int state;
107 struct parisc_device *dev;
108 unsigned long loops_per_jiffy;
109};
110
111extern struct system_cpuinfo_parisc boot_cpu_data;
112DECLARE_PER_CPU(struct cpuinfo_parisc, cpu_data);
113
114#define CPU_HVERSION ((boot_cpu_data.hversion >> 4) & 0x0FFF)
115
116typedef struct {
117 int seg;
118} mm_segment_t;
119
120#define ARCH_MIN_TASKALIGN 8
121
122struct thread_struct {
123 struct pt_regs regs;
124 unsigned long task_size;
125 unsigned long map_base;
126 unsigned long flags;
127};
128
129#define task_pt_regs(tsk) ((struct pt_regs *)&((tsk)->thread.regs))
130
131
132#define PARISC_UAC_NOPRINT (1UL << 0)
133#define PARISC_UAC_SIGBUS (1UL << 1)
134#define PARISC_KERNEL_DEATH (1UL << 31)
135
136#define PARISC_UAC_SHIFT 0
137#define PARISC_UAC_MASK (PARISC_UAC_NOPRINT|PARISC_UAC_SIGBUS)
138
139#define SET_UNALIGN_CTL(task,value) \
140 ({ \
141 (task)->thread.flags = (((task)->thread.flags & ~PARISC_UAC_MASK) \
142 | (((value) << PARISC_UAC_SHIFT) & \
143 PARISC_UAC_MASK)); \
144 0; \
145 })
146
147#define GET_UNALIGN_CTL(task,addr) \
148 ({ \
149 put_user(((task)->thread.flags & PARISC_UAC_MASK) \
150 >> PARISC_UAC_SHIFT, (int __user *) (addr)); \
151 })
152
153#define INIT_THREAD { \
154 .regs = { .gr = { 0, }, \
155 .fr = { 0, }, \
156 .sr = { 0, }, \
157 .iasq = { 0, }, \
158 .iaoq = { 0, }, \
159 .cr27 = 0, \
160 }, \
161 .task_size = DEFAULT_TASK_SIZE, \
162 .map_base = DEFAULT_MAP_BASE, \
163 .flags = 0 \
164 }
165
166
167
168
169
170struct task_struct;
171unsigned long thread_saved_pc(struct task_struct *t);
172void show_trace(struct task_struct *task, unsigned long *stack);
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189typedef unsigned int elf_caddr_t;
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
249
250
251
252
253
254
255
256
257
258
259
260
261#ifdef CONFIG_64BIT
262#define USER_WIDE_MODE (!test_thread_flag(TIF_32BIT))
263#else
264#define USER_WIDE_MODE 0
265#endif
266
267#define start_thread(regs, new_pc, new_sp) do { \
268 elf_addr_t *sp = (elf_addr_t *)new_sp; \
269 __u32 spaceid = (__u32)current->mm->context; \
270 elf_addr_t pc = (elf_addr_t)new_pc | 3; \
271 elf_caddr_t *argv = (elf_caddr_t *)bprm->exec + 1; \
272 \
273 regs->iasq[0] = spaceid; \
274 regs->iasq[1] = spaceid; \
275 regs->iaoq[0] = pc; \
276 regs->iaoq[1] = pc + 4; \
277 regs->sr[2] = LINUX_GATEWAY_SPACE; \
278 regs->sr[3] = 0xffff; \
279 regs->sr[4] = spaceid; \
280 regs->sr[5] = spaceid; \
281 regs->sr[6] = spaceid; \
282 regs->sr[7] = spaceid; \
283 regs->gr[ 0] = USER_PSW | (USER_WIDE_MODE ? PSW_W : 0); \
284 regs->fr[ 0] = 0LL; \
285 regs->fr[ 1] = 0LL; \
286 regs->fr[ 2] = 0LL; \
287 regs->fr[ 3] = 0LL; \
288 regs->gr[30] = (((unsigned long)sp + 63) &~ 63) | (USER_WIDE_MODE ? 1 : 0); \
289 regs->gr[31] = pc; \
290 \
291 get_user(regs->gr[25], (argv - 1)); \
292 regs->gr[24] = (long) argv; \
293 regs->gr[23] = 0; \
294} while(0)
295
296struct task_struct;
297struct mm_struct;
298
299
300extern void release_thread(struct task_struct *);
301
302extern unsigned long get_wchan(struct task_struct *p);
303
304#define KSTK_EIP(tsk) ((tsk)->thread.regs.iaoq[0])
305#define KSTK_ESP(tsk) ((tsk)->thread.regs.gr[30])
306
307#define cpu_relax() barrier()
308
309
310
311
312
313
314#ifdef CONFIG_PA8X00
315extern int _parisc_requires_coherency;
316#define parisc_requires_coherency() _parisc_requires_coherency
317#else
318#define parisc_requires_coherency() (0)
319#endif
320
321#endif
322
323#endif
324