1
2
3
4
5
6
7
8 #ifndef __ASM_MIPS_PROCESSOR_H
9 #define __ASM_MIPS_PROCESSOR_H
10
11 #if !defined (__ASSEMBLY__)
12 #include <asm/system.h>
13
14
15
16
17 extern char wait_available;
18
19 extern unsigned long intr_count;
20 extern unsigned long event;
21
22 #if defined (__R4000__)
23
24 #define start_bh_atomic() \
25 __asm__ __volatile__( \
26 ".set\tnoreorder\n\t" \
27 ".set\tnoat\n\t" \
28 "ll\t$1,(%0)\n" \
29 "1:\taddiu\t$1,$1,1\n\t" \
30 "sc\t$1,(%0)\n\t" \
31 "beqzl\t$1,1b\n\t" \
32 "ll\t$1,(%0)\n\t" \
33 ".set\tat\n\t" \
34 ".set\treorder" \
35 : \
36 : "r" (&intr_count));
37
38 #define end_bh_atomic() \
39 __asm__ __volatile__( \
40 ".set\tnoreorder\n\t" \
41 ".set\tnoat\n\t" \
42 "ll\t$1,(%0)\n" \
43 "1:\tsubu\t$1,$1,1\n\t" \
44 "sc\t$1,(%0)\n\t" \
45 "beqzl\t$1,1b\n\t" \
46 "ll\t$1,(%0)\n\t" \
47 ".set\tat\n\t" \
48 ".set\treorder" \
49 : \
50 : "r" (&intr_count));
51
52 #else
53
54 #define start_bh_atomic() \
55 {int flags; save_flags(flags); cli(); intr_count++; restore_flags(flags)}
56
57 #define end_bh_atomic() \
58 {int flags; save_flags(flags); cli(); intr_count--; restore_flags(flags)}
59
60 #endif
61
62
63
64
65
66
67
68
69 extern int EISA_bus;
70 #define MCA_bus 0
71 #define MCA_bus__is_a_macro
72
73
74
75
76 #define wp_works_ok 1
77 #define wp_works_ok__is_a_macro
78
79
80
81
82
83 #define TASK_SIZE (0x80000000UL)
84
85
86
87
88 #define IO_BITMAP_SIZE 32
89
90 #define NUM_FPU_REGS 32
91
92 struct mips_fpu_hard_struct {
93 double fp_regs[NUM_FPU_REGS];
94 unsigned int control;
95 };
96
97
98
99
100 struct mips_fpu_soft_struct {
101 long dummy;
102 };
103
104 union mips_fpu_union {
105 struct mips_fpu_hard_struct hard;
106 struct mips_fpu_soft_struct soft;
107 };
108
109 #define INIT_FPU { \
110 0, \
111 }
112
113
114
115
116 struct thread_struct {
117
118
119
120 unsigned long reg16, reg17, reg18, reg19, reg20, reg21, reg22, reg23;
121 unsigned long reg28, reg29, reg30, reg31;
122
123
124
125 unsigned long cp0_status;
126
127
128
129 union mips_fpu_union fpu;
130
131
132
133 unsigned long cp0_badvaddr;
134 unsigned long error_code;
135 unsigned long trap_no;
136 unsigned long ksp;
137 unsigned long fs;
138 unsigned long pg_dir;
139 };
140
141 #endif
142
143
144
145
146 #define TOFF_REG16 0
147 #define TOFF_REG17 (TOFF_REG16+4)
148 #define TOFF_REG18 (TOFF_REG17+4)
149 #define TOFF_REG19 (TOFF_REG18+4)
150 #define TOFF_REG20 (TOFF_REG19+4)
151 #define TOFF_REG21 (TOFF_REG20+4)
152 #define TOFF_REG22 (TOFF_REG21+4)
153 #define TOFF_REG23 (TOFF_REG22+4)
154 #define TOFF_REG28 (TOFF_REG23+4)
155 #define TOFF_REG29 (TOFF_REG28+4)
156 #define TOFF_REG30 (TOFF_REG29+4)
157 #define TOFF_REG31 (TOFF_REG30+4)
158 #define TOFF_CP0_STATUS (TOFF_REG31+4)
159
160
161
162 #define TOFF_FPU (((TOFF_CP0_STATUS+4)+(8-1))&~(8-1))
163 #define TOFF_CP0_BADVADDR (TOFF_FPU+264)
164 #define TOFF_ERROR_CODE (TOFF_CP0_BADVADDR+4)
165 #define TOFF_TRAP_NO (TOFF_ERROR_CODE+4)
166 #define TOFF_KSP (TOFF_TRAP_NO+4)
167 #define TOFF_FS (TOFF_KSP+4)
168 #define TOFF_PG_DIR (TOFF_FS+4)
169
170 #if !defined (__ASSEMBLY__)
171
172 #define INIT_TSS { \
173
174
175 \
176 0, 0, 0, 0, 0, 0, 0, 0, \
177 0, 0, 0, 0, \
178
179
180 \
181 0, \
182
183
184 \
185 INIT_FPU, \
186
187
188 \
189 0, 0, 0, (((unsigned long)init_kernel_stack)+4096-8), \
190 KERNEL_DS, (unsigned long) swapper_pg_dir \
191 }
192
193 #ifdef __KERNEL__
194
195
196
197
198
199 asmlinkage void resume(struct task_struct *tsk, int offset);
200
201 #define switch_to(n) \
202 resume(n, ((int)(&((struct task_struct *)0)->tss)))
203
204
205
206
207 #if defined (__R4000__)
208
209 #define USES_USER_TIME(regs) (!((regs)->cp0_status & 0x18))
210
211 #else
212
213 #error "#define USES_USER_TIME(regs)!"
214
215 #endif
216
217 #endif
218
219 #endif
220
221 #endif