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
24
25
26
27#ifdef CONFIG_PA20
28#define current_ia(x) __asm__("mfia %0" : "=r"(x))
29#else
30#define current_ia(x) __asm__("blr 0,%0\n\tnop" : "=r"(x))
31#endif
32#define current_text_addr() ({ void *pc; current_ia(pc); pc; })
33
34#define HAVE_ARCH_PICK_MMAP_LAYOUT
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
60#define STACK_SIZE_MAX (USER_WIDE_MODE \
61 ? (1 << 30) \
62 : (CONFIG_MAX_STACK_SIZE_MB*1024*1024))
63
64#endif
65
66#ifndef __ASSEMBLY__
67
68
69
70
71
72
73
74struct system_cpuinfo_parisc {
75 unsigned int cpu_count;
76 unsigned int cpu_hz;
77 unsigned int hversion;
78 unsigned int sversion;
79 enum cpu_type cpu_type;
80
81 struct {
82 struct pdc_model model;
83 unsigned long versions;
84 unsigned long cpuid;
85 unsigned long capabilities;
86 char sys_model_name[81];
87 } pdc;
88
89 const char *cpu_name;
90 const char *family_name;
91};
92
93
94
95struct cpuinfo_parisc {
96 unsigned long it_value;
97 unsigned long irq_count;
98 unsigned long cpuid;
99 unsigned long hpa;
100 unsigned long txn_addr;
101#ifdef CONFIG_SMP
102 unsigned long pending_ipi;
103#endif
104 unsigned long bh_count;
105 unsigned long fp_rev;
106 unsigned long fp_model;
107 unsigned long cpu_num;
108 unsigned long cpu_loc;
109 unsigned int state;
110 struct parisc_device *dev;
111 unsigned long loops_per_jiffy;
112};
113
114extern struct system_cpuinfo_parisc boot_cpu_data;
115DECLARE_PER_CPU(struct cpuinfo_parisc, cpu_data);
116
117#define CPU_HVERSION ((boot_cpu_data.hversion >> 4) & 0x0FFF)
118
119typedef struct {
120 int seg;
121} mm_segment_t;
122
123#define ARCH_MIN_TASKALIGN 8
124
125struct thread_struct {
126 struct pt_regs regs;
127 unsigned long task_size;
128 unsigned long map_base;
129 unsigned long flags;
130};
131
132#define task_pt_regs(tsk) ((struct pt_regs *)&((tsk)->thread.regs))
133
134
135#define PARISC_UAC_NOPRINT (1UL << 0)
136#define PARISC_UAC_SIGBUS (1UL << 1)
137#define PARISC_KERNEL_DEATH (1UL << 31)
138
139#define PARISC_UAC_SHIFT 0
140#define PARISC_UAC_MASK (PARISC_UAC_NOPRINT|PARISC_UAC_SIGBUS)
141
142#define SET_UNALIGN_CTL(task,value) \
143 ({ \
144 (task)->thread.flags = (((task)->thread.flags & ~PARISC_UAC_MASK) \
145 | (((value) << PARISC_UAC_SHIFT) & \
146 PARISC_UAC_MASK)); \
147 0; \
148 })
149
150#define GET_UNALIGN_CTL(task,addr) \
151 ({ \
152 put_user(((task)->thread.flags & PARISC_UAC_MASK) \
153 >> PARISC_UAC_SHIFT, (int __user *) (addr)); \
154 })
155
156#define INIT_THREAD { \
157 .regs = { .gr = { 0, }, \
158 .fr = { 0, }, \
159 .sr = { 0, }, \
160 .iasq = { 0, }, \
161 .iaoq = { 0, }, \
162 .cr27 = 0, \
163 }, \
164 .task_size = DEFAULT_TASK_SIZE, \
165 .map_base = DEFAULT_MAP_BASE, \
166 .flags = 0 \
167 }
168
169struct task_struct;
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
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#ifdef CONFIG_64BIT
260#define USER_WIDE_MODE (!test_thread_flag(TIF_32BIT))
261#else
262#define USER_WIDE_MODE 0
263#endif
264
265#define start_thread(regs, new_pc, new_sp) do { \
266 elf_addr_t *sp = (elf_addr_t *)new_sp; \
267 __u32 spaceid = (__u32)current->mm->context; \
268 elf_addr_t pc = (elf_addr_t)new_pc | 3; \
269 elf_caddr_t *argv = (elf_caddr_t *)bprm->exec + 1; \
270 \
271 regs->iasq[0] = spaceid; \
272 regs->iasq[1] = spaceid; \
273 regs->iaoq[0] = pc; \
274 regs->iaoq[1] = pc + 4; \
275 regs->sr[2] = LINUX_GATEWAY_SPACE; \
276 regs->sr[3] = 0xffff; \
277 regs->sr[4] = spaceid; \
278 regs->sr[5] = spaceid; \
279 regs->sr[6] = spaceid; \
280 regs->sr[7] = spaceid; \
281 regs->gr[ 0] = USER_PSW | (USER_WIDE_MODE ? PSW_W : 0); \
282 regs->fr[ 0] = 0LL; \
283 regs->fr[ 1] = 0LL; \
284 regs->fr[ 2] = 0LL; \
285 regs->fr[ 3] = 0LL; \
286 regs->gr[30] = (((unsigned long)sp + 63) &~ 63) | (USER_WIDE_MODE ? 1 : 0); \
287 regs->gr[31] = pc; \
288 \
289 get_user(regs->gr[25], (argv - 1)); \
290 regs->gr[24] = (long) argv; \
291 regs->gr[23] = 0; \
292} while(0)
293
294struct task_struct;
295struct mm_struct;
296
297
298extern void release_thread(struct task_struct *);
299
300extern unsigned long get_wchan(struct task_struct *p);
301
302#define KSTK_EIP(tsk) ((tsk)->thread.regs.iaoq[0])
303#define KSTK_ESP(tsk) ((tsk)->thread.regs.gr[30])
304
305#define cpu_relax() barrier()
306
307
308
309
310
311
312#ifdef CONFIG_PA8X00
313extern int _parisc_requires_coherency;
314#define parisc_requires_coherency() _parisc_requires_coherency
315#else
316#define parisc_requires_coherency() (0)
317#endif
318
319#endif
320
321#endif
322