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);
98extern int time_keeper_id;
99
100#define CPU_HVERSION ((boot_cpu_data.hversion >> 4) & 0x0FFF)
101
102struct thread_struct {
103 struct pt_regs regs;
104 unsigned long task_size;
105 unsigned long map_base;
106 unsigned long flags;
107};
108
109#define task_pt_regs(tsk) ((struct pt_regs *)&((tsk)->thread.regs))
110
111
112#define PARISC_UAC_NOPRINT (1UL << 0)
113#define PARISC_UAC_SIGBUS (1UL << 1)
114#define PARISC_KERNEL_DEATH (1UL << 31)
115
116#define PARISC_UAC_SHIFT 0
117#define PARISC_UAC_MASK (PARISC_UAC_NOPRINT|PARISC_UAC_SIGBUS)
118
119#define SET_UNALIGN_CTL(task,value) \
120 ({ \
121 (task)->thread.flags = (((task)->thread.flags & ~PARISC_UAC_MASK) \
122 | (((value) << PARISC_UAC_SHIFT) & \
123 PARISC_UAC_MASK)); \
124 0; \
125 })
126
127#define GET_UNALIGN_CTL(task,addr) \
128 ({ \
129 put_user(((task)->thread.flags & PARISC_UAC_MASK) \
130 >> PARISC_UAC_SHIFT, (int __user *) (addr)); \
131 })
132
133#define INIT_THREAD { \
134 .regs = { .gr = { 0, }, \
135 .fr = { 0, }, \
136 .sr = { 0, }, \
137 .iasq = { 0, }, \
138 .iaoq = { 0, }, \
139 .cr27 = 0, \
140 }, \
141 .task_size = DEFAULT_TASK_SIZE, \
142 .map_base = DEFAULT_MAP_BASE, \
143 .flags = 0 \
144 }
145
146struct task_struct;
147void show_trace(struct task_struct *task, unsigned long *stack);
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164typedef unsigned int elf_caddr_t;
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
236#define USER_WIDE_MODE (!is_32bit_task())
237
238#define start_thread(regs, new_pc, new_sp) do { \
239 elf_addr_t *sp = (elf_addr_t *)new_sp; \
240 __u32 spaceid = (__u32)current->mm->context.space_id; \
241 elf_addr_t pc = (elf_addr_t)new_pc | 3; \
242 elf_caddr_t *argv = (elf_caddr_t *)bprm->exec + 1; \
243 \
244 regs->iasq[0] = spaceid; \
245 regs->iasq[1] = spaceid; \
246 regs->iaoq[0] = pc; \
247 regs->iaoq[1] = pc + 4; \
248 regs->sr[2] = LINUX_GATEWAY_SPACE; \
249 regs->sr[3] = 0xffff; \
250 regs->sr[4] = spaceid; \
251 regs->sr[5] = spaceid; \
252 regs->sr[6] = spaceid; \
253 regs->sr[7] = spaceid; \
254 regs->gr[ 0] = USER_PSW | (USER_WIDE_MODE ? PSW_W : 0); \
255 regs->fr[ 0] = 0LL; \
256 regs->fr[ 1] = 0LL; \
257 regs->fr[ 2] = 0LL; \
258 regs->fr[ 3] = 0LL; \
259 regs->gr[30] = (((unsigned long)sp + 63) &~ 63) | (USER_WIDE_MODE ? 1 : 0); \
260 regs->gr[31] = pc; \
261 \
262 get_user(regs->gr[25], (argv - 1)); \
263 regs->gr[24] = (long) argv; \
264 regs->gr[23] = 0; \
265} while(0)
266
267struct mm_struct;
268
269
270extern void release_thread(struct task_struct *);
271
272extern unsigned long __get_wchan(struct task_struct *p);
273
274#define KSTK_EIP(tsk) ((tsk)->thread.regs.iaoq[0])
275#define KSTK_ESP(tsk) ((tsk)->thread.regs.gr[30])
276
277#define cpu_relax() barrier()
278
279
280
281
282
283
284#ifdef CONFIG_PA8X00
285extern int _parisc_requires_coherency;
286#define parisc_requires_coherency() _parisc_requires_coherency
287#else
288#define parisc_requires_coherency() (0)
289#endif
290
291extern int running_on_qemu;
292
293extern void __noreturn toc_intr(struct pt_regs *regs);
294extern void toc_handler(void);
295extern unsigned int toc_handler_size;
296extern unsigned int toc_handler_csum;
297
298#endif
299
300#endif
301