1
2
3
4
5
6
7
8
9
10
11#ifndef _ASM_PROCESSOR_H
12#define _ASM_PROCESSOR_H
13
14#include <linux/cpumask.h>
15#include <linux/threads.h>
16
17#include <asm/cachectl.h>
18#include <asm/cpu.h>
19#include <asm/cpu-info.h>
20#include <asm/mipsregs.h>
21#include <asm/prefetch.h>
22#include <asm/system.h>
23
24
25
26
27#define current_text_addr() ({ __label__ _l; _l: &&_l;})
28
29
30
31
32extern void (*cpu_wait)(void);
33
34extern unsigned int vced_count, vcei_count;
35
36#ifdef CONFIG_32BIT
37
38
39
40
41#define TASK_SIZE 0x7fff8000UL
42
43
44
45
46
47#define TASK_UNMAPPED_BASE (PAGE_ALIGN(TASK_SIZE / 3))
48#endif
49
50#ifdef CONFIG_64BIT
51
52
53
54
55
56
57
58#define TASK_SIZE32 0x7fff8000UL
59#define TASK_SIZE 0x10000000000UL
60
61
62
63
64
65#define TASK_UNMAPPED_BASE \
66 (test_thread_flag(TIF_32BIT_ADDR) ? \
67 PAGE_ALIGN(TASK_SIZE32 / 3) : PAGE_ALIGN(TASK_SIZE / 3))
68#endif
69
70#define NUM_FPU_REGS 32
71
72typedef __u64 fpureg_t;
73
74
75
76
77
78
79
80
81struct mips_fpu_struct {
82 fpureg_t fpr[NUM_FPU_REGS];
83 unsigned int fcr31;
84};
85
86#define NUM_DSP_REGS 6
87
88typedef __u32 dspreg_t;
89
90struct mips_dsp_state {
91 dspreg_t dspr[NUM_DSP_REGS];
92 unsigned int dspcontrol;
93};
94
95#define INIT_CPUMASK { \
96 {0,} \
97}
98
99typedef struct {
100 unsigned long seg;
101} mm_segment_t;
102
103#define ARCH_MIN_TASKALIGN 8
104
105struct mips_abi;
106
107
108
109
110struct thread_struct {
111
112 unsigned long reg16;
113 unsigned long reg17, reg18, reg19, reg20, reg21, reg22, reg23;
114 unsigned long reg29, reg30, reg31;
115
116
117 unsigned long cp0_status;
118
119
120 struct mips_fpu_struct fpu;
121#ifdef CONFIG_MIPS_MT_FPAFF
122
123 unsigned long emulated_fp;
124
125 cpumask_t user_cpus_allowed;
126#endif
127
128
129 struct mips_dsp_state dsp;
130
131
132 unsigned long cp0_badvaddr;
133 unsigned long cp0_baduaddr;
134 unsigned long error_code;
135 unsigned long trap_no;
136 unsigned long irix_trampoline;
137 unsigned long irix_oldctx;
138 struct mips_abi *abi;
139};
140
141#ifdef CONFIG_MIPS_MT_FPAFF
142#define FPAFF_INIT \
143 .emulated_fp = 0, \
144 .user_cpus_allowed = INIT_CPUMASK,
145#else
146#define FPAFF_INIT
147#endif
148
149#define INIT_THREAD { \
150
151
152 \
153 .reg16 = 0, \
154 .reg17 = 0, \
155 .reg18 = 0, \
156 .reg19 = 0, \
157 .reg20 = 0, \
158 .reg21 = 0, \
159 .reg22 = 0, \
160 .reg23 = 0, \
161 .reg29 = 0, \
162 .reg30 = 0, \
163 .reg31 = 0, \
164
165
166 \
167 .cp0_status = 0, \
168
169
170 \
171 .fpu = { \
172 .fpr = {0,}, \
173 .fcr31 = 0, \
174 }, \
175
176
177 \
178 FPAFF_INIT \
179
180
181 \
182 .dsp = { \
183 .dspr = {0, }, \
184 .dspcontrol = 0, \
185 }, \
186
187
188 \
189 .cp0_badvaddr = 0, \
190 .cp0_baduaddr = 0, \
191 .error_code = 0, \
192 .trap_no = 0, \
193 .irix_trampoline = 0, \
194 .irix_oldctx = 0, \
195}
196
197struct task_struct;
198
199
200#define release_thread(thread) do { } while(0)
201
202
203#define prepare_to_copy(tsk) do { } while (0)
204
205extern long kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
206
207extern unsigned long thread_saved_pc(struct task_struct *tsk);
208
209
210
211
212extern void start_thread(struct pt_regs * regs, unsigned long pc, unsigned long sp);
213
214unsigned long get_wchan(struct task_struct *p);
215
216#define __KSTK_TOS(tsk) ((unsigned long)task_stack_page(tsk) + THREAD_SIZE - 32)
217#define task_pt_regs(tsk) ((struct pt_regs *)__KSTK_TOS(tsk) - 1)
218#define KSTK_EIP(tsk) (task_pt_regs(tsk)->cp0_epc)
219#define KSTK_ESP(tsk) (task_pt_regs(tsk)->regs[29])
220#define KSTK_STATUS(tsk) (task_pt_regs(tsk)->cp0_status)
221
222#define cpu_relax() barrier()
223
224
225
226
227
228
229
230
231
232
233
234
235
236#define return_address() ({__asm__ __volatile__("":::"$31");__builtin_return_address(0);})
237
238#ifdef CONFIG_CPU_HAS_PREFETCH
239
240#define ARCH_HAS_PREFETCH
241
242static inline void prefetch(const void *addr)
243{
244 __asm__ __volatile__(
245 " .set mips4 \n"
246 " pref %0, (%1) \n"
247 " .set mips0 \n"
248 :
249 : "i" (Pref_Load), "r" (addr));
250}
251
252#endif
253
254#endif
255