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