Sun Feb 27 19:22:12 2022 UTC ()
mips: Redefine BDSYNC as sync on Octeon, not syncw.

BDSYNC is used for membar_sync, which is supposed to be a full
sequential consistency barrier, which is not provided by syncw, so
this is necessary for correctness.

BDSYNC is not used for anything else, so this can't hurt performance,
except where it was necessary for correctness anyway or where the
semantic choice of membar_sync was too strong anyway.


(riastradh)
diff -r1.67 -r1.68 src/sys/arch/mips/include/asm.h

cvs diff -r1.67 -r1.68 src/sys/arch/mips/include/asm.h (switch to unified diff)

--- src/sys/arch/mips/include/asm.h 2022/02/27 19:22:02 1.67
+++ src/sys/arch/mips/include/asm.h 2022/02/27 19:22:12 1.68
@@ -1,728 +1,728 @@ @@ -1,728 +1,728 @@
1/* $NetBSD: asm.h,v 1.67 2022/02/27 19:22:02 riastradh Exp $ */ 1/* $NetBSD: asm.h,v 1.68 2022/02/27 19:22:12 riastradh Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1992, 1993 4 * Copyright (c) 1992, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to Berkeley by 7 * This code is derived from software contributed to Berkeley by
8 * Ralph Campbell. 8 * Ralph Campbell.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright 15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the 16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution. 17 * documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of the University nor the names of its contributors 18 * 3. Neither the name of the University nor the names of its contributors
19 * may be used to endorse or promote products derived from this software 19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission. 20 * without specific prior written permission.
21 * 21 *
22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE. 32 * SUCH DAMAGE.
33 * 33 *
34 * @(#)machAsmDefs.h 8.1 (Berkeley) 6/10/93 34 * @(#)machAsmDefs.h 8.1 (Berkeley) 6/10/93
35 */ 35 */
36 36
37/* 37/*
38 * machAsmDefs.h -- 38 * machAsmDefs.h --
39 * 39 *
40 * Macros used when writing assembler programs. 40 * Macros used when writing assembler programs.
41 * 41 *
42 * Copyright (C) 1989 Digital Equipment Corporation. 42 * Copyright (C) 1989 Digital Equipment Corporation.
43 * Permission to use, copy, modify, and distribute this software and 43 * Permission to use, copy, modify, and distribute this software and
44 * its documentation for any purpose and without fee is hereby granted, 44 * its documentation for any purpose and without fee is hereby granted,
45 * provided that the above copyright notice appears in all copies. 45 * provided that the above copyright notice appears in all copies.
46 * Digital Equipment Corporation makes no representations about the 46 * Digital Equipment Corporation makes no representations about the
47 * suitability of this software for any purpose. It is provided "as is" 47 * suitability of this software for any purpose. It is provided "as is"
48 * without express or implied warranty. 48 * without express or implied warranty.
49 * 49 *
50 * from: Header: /sprite/src/kernel/mach/ds3100.md/RCS/machAsmDefs.h, 50 * from: Header: /sprite/src/kernel/mach/ds3100.md/RCS/machAsmDefs.h,
51 * v 1.2 89/08/15 18:28:24 rab Exp SPRITE (DECWRL) 51 * v 1.2 89/08/15 18:28:24 rab Exp SPRITE (DECWRL)
52 */ 52 */
53 53
54#ifndef _MIPS_ASM_H 54#ifndef _MIPS_ASM_H
55#define _MIPS_ASM_H 55#define _MIPS_ASM_H
56 56
57#include <sys/cdefs.h> /* for API selection */ 57#include <sys/cdefs.h> /* for API selection */
58#include <mips/regdef.h> 58#include <mips/regdef.h>
59 59
60#if defined(_KERNEL_OPT) 60#if defined(_KERNEL_OPT)
61#include "opt_gprof.h" 61#include "opt_gprof.h"
62#endif 62#endif
63 63
64#define __BIT(n) (1 << (n)) 64#define __BIT(n) (1 << (n))
65#define __BITS(hi,lo) ((~((~0)<<((hi)+1)))&((~0)<<(lo))) 65#define __BITS(hi,lo) ((~((~0)<<((hi)+1)))&((~0)<<(lo)))
66 66
67#define __LOWEST_SET_BIT(__mask) ((((__mask) - 1) & (__mask)) ^ (__mask)) 67#define __LOWEST_SET_BIT(__mask) ((((__mask) - 1) & (__mask)) ^ (__mask))
68#define __SHIFTOUT(__x, __mask) (((__x) & (__mask)) / __LOWEST_SET_BIT(__mask)) 68#define __SHIFTOUT(__x, __mask) (((__x) & (__mask)) / __LOWEST_SET_BIT(__mask))
69#define __SHIFTIN(__x, __mask) ((__x) * __LOWEST_SET_BIT(__mask)) 69#define __SHIFTIN(__x, __mask) ((__x) * __LOWEST_SET_BIT(__mask))
70 70
71/* 71/*
72 * Define -pg profile entry code. 72 * Define -pg profile entry code.
73 * Must always be noreorder, must never use a macro instruction. 73 * Must always be noreorder, must never use a macro instruction.
74 */ 74 */
75#if defined(__mips_o32) /* Old 32-bit ABI */ 75#if defined(__mips_o32) /* Old 32-bit ABI */
76/* 76/*
77 * The old ABI version must also decrement two less words off the 77 * The old ABI version must also decrement two less words off the
78 * stack and the final addiu to t9 must always equal the size of this 78 * stack and the final addiu to t9 must always equal the size of this
79 * _MIPS_ASM_MCOUNT. 79 * _MIPS_ASM_MCOUNT.
80 */ 80 */
81#define _MIPS_ASM_MCOUNT \ 81#define _MIPS_ASM_MCOUNT \
82 .set push; \ 82 .set push; \
83 .set noreorder; \ 83 .set noreorder; \
84 .set noat; \ 84 .set noat; \
85 subu sp,16; \ 85 subu sp,16; \
86 sw t9,12(sp); \ 86 sw t9,12(sp); \
87 move AT,ra; \ 87 move AT,ra; \
88 lui t9,%hi(_mcount); \ 88 lui t9,%hi(_mcount); \
89 addiu t9,t9,%lo(_mcount); \ 89 addiu t9,t9,%lo(_mcount); \
90 jalr t9; \ 90 jalr t9; \
91 nop; \ 91 nop; \
92 lw t9,4(sp); \ 92 lw t9,4(sp); \
93 addiu sp,8; \ 93 addiu sp,8; \
94 addiu t9,40; \ 94 addiu t9,40; \
95 .set pop; 95 .set pop;
96#elif defined(__mips_o64) /* Old 64-bit ABI */ 96#elif defined(__mips_o64) /* Old 64-bit ABI */
97# error yeahnah 97# error yeahnah
98#else /* New (n32/n64) ABI */ 98#else /* New (n32/n64) ABI */
99/* 99/*
100 * The new ABI version just needs to put the return address in AT and 100 * The new ABI version just needs to put the return address in AT and
101 * call _mcount(). For the no abicalls case, skip the reloc dance. 101 * call _mcount(). For the no abicalls case, skip the reloc dance.
102 */ 102 */
103#ifdef __mips_abicalls 103#ifdef __mips_abicalls
104#define _MIPS_ASM_MCOUNT \ 104#define _MIPS_ASM_MCOUNT \
105 .set push; \ 105 .set push; \
106 .set noreorder; \ 106 .set noreorder; \
107 .set noat; \ 107 .set noat; \
108 subu sp,16; \ 108 subu sp,16; \
109 sw t9,8(sp); \ 109 sw t9,8(sp); \
110 move AT,ra; \ 110 move AT,ra; \
111 lui t9,%hi(_mcount); \ 111 lui t9,%hi(_mcount); \
112 addiu t9,t9,%lo(_mcount); \ 112 addiu t9,t9,%lo(_mcount); \
113 jalr t9; \ 113 jalr t9; \
114 nop; \ 114 nop; \
115 lw t9,8(sp); \ 115 lw t9,8(sp); \
116 addiu sp,16; \ 116 addiu sp,16; \
117 .set pop; 117 .set pop;
118#else /* !__mips_abicalls */ 118#else /* !__mips_abicalls */
119#define _MIPS_ASM_MCOUNT \ 119#define _MIPS_ASM_MCOUNT \
120 .set push; \ 120 .set push; \
121 .set noreorder; \ 121 .set noreorder; \
122 .set noat; \ 122 .set noat; \
123 move AT,ra; \ 123 move AT,ra; \
124 jal _mcount; \ 124 jal _mcount; \
125 nop; \ 125 nop; \
126 .set pop; 126 .set pop;
127#endif /* !__mips_abicalls */ 127#endif /* !__mips_abicalls */
128#endif /* n32/n64 */ 128#endif /* n32/n64 */
129 129
130#ifdef GPROF 130#ifdef GPROF
131#define MCOUNT _MIPS_ASM_MCOUNT 131#define MCOUNT _MIPS_ASM_MCOUNT
132#else 132#else
133#define MCOUNT 133#define MCOUNT
134#endif 134#endif
135 135
136#ifdef USE_AENT 136#ifdef USE_AENT
137#define AENT(x) \ 137#define AENT(x) \
138 .aent x, 0 138 .aent x, 0
139#else 139#else
140#define AENT(x) 140#define AENT(x)
141#endif 141#endif
142 142
143/* 143/*
144 * WEAK_ALIAS: create a weak alias. 144 * WEAK_ALIAS: create a weak alias.
145 */ 145 */
146#define WEAK_ALIAS(alias,sym) \ 146#define WEAK_ALIAS(alias,sym) \
147 .weak alias; \ 147 .weak alias; \
148 alias = sym 148 alias = sym
149/* 149/*
150 * STRONG_ALIAS: create a strong alias. 150 * STRONG_ALIAS: create a strong alias.
151 */ 151 */
152#define STRONG_ALIAS(alias,sym) \ 152#define STRONG_ALIAS(alias,sym) \
153 .globl alias; \ 153 .globl alias; \
154 alias = sym 154 alias = sym
155 155
156/* 156/*
157 * WARN_REFERENCES: create a warning if the specified symbol is referenced. 157 * WARN_REFERENCES: create a warning if the specified symbol is referenced.
158 */ 158 */
159#define WARN_REFERENCES(sym,msg) \ 159#define WARN_REFERENCES(sym,msg) \
160 .pushsection __CONCAT(.gnu.warning.,sym); \ 160 .pushsection __CONCAT(.gnu.warning.,sym); \
161 .ascii msg; \ 161 .ascii msg; \
162 .popsection 162 .popsection
163 163
164/* 164/*
165 * STATIC_LEAF_NOPROFILE 165 * STATIC_LEAF_NOPROFILE
166 * No profilable local leaf routine. 166 * No profilable local leaf routine.
167 */ 167 */
168#define STATIC_LEAF_NOPROFILE(x) \ 168#define STATIC_LEAF_NOPROFILE(x) \
169 .ent _C_LABEL(x); \ 169 .ent _C_LABEL(x); \
170_C_LABEL(x): ; \ 170_C_LABEL(x): ; \
171 .frame sp, 0, ra 171 .frame sp, 0, ra
172 172
173/* 173/*
174 * LEAF_NOPROFILE 174 * LEAF_NOPROFILE
175 * No profilable leaf routine. 175 * No profilable leaf routine.
176 */ 176 */
177#define LEAF_NOPROFILE(x) \ 177#define LEAF_NOPROFILE(x) \
178 .globl _C_LABEL(x); \ 178 .globl _C_LABEL(x); \
179 STATIC_LEAF_NOPROFILE(x) 179 STATIC_LEAF_NOPROFILE(x)
180 180
181/* 181/*
182 * STATIC_LEAF 182 * STATIC_LEAF
183 * Declare a local leaf function. 183 * Declare a local leaf function.
184 */ 184 */
185#define STATIC_LEAF(x) \ 185#define STATIC_LEAF(x) \
186 STATIC_LEAF_NOPROFILE(x); \ 186 STATIC_LEAF_NOPROFILE(x); \
187 MCOUNT 187 MCOUNT
188 188
189/* 189/*
190 * LEAF 190 * LEAF
191 * A leaf routine does 191 * A leaf routine does
192 * - call no other function, 192 * - call no other function,
193 * - never use any register that callee-saved (S0-S8), and 193 * - never use any register that callee-saved (S0-S8), and
194 * - not use any local stack storage. 194 * - not use any local stack storage.
195 */ 195 */
196#define LEAF(x) \ 196#define LEAF(x) \
197 LEAF_NOPROFILE(x); \ 197 LEAF_NOPROFILE(x); \
198 MCOUNT 198 MCOUNT
199 199
200/* 200/*
201 * STATIC_XLEAF 201 * STATIC_XLEAF
202 * declare alternate entry to a static leaf routine 202 * declare alternate entry to a static leaf routine
203 */ 203 */
204#define STATIC_XLEAF(x) \ 204#define STATIC_XLEAF(x) \
205 AENT (_C_LABEL(x)); \ 205 AENT (_C_LABEL(x)); \
206_C_LABEL(x): 206_C_LABEL(x):
207 207
208/* 208/*
209 * XLEAF 209 * XLEAF
210 * declare alternate entry to leaf routine 210 * declare alternate entry to leaf routine
211 */ 211 */
212#define XLEAF(x) \ 212#define XLEAF(x) \
213 .globl _C_LABEL(x); \ 213 .globl _C_LABEL(x); \
214 STATIC_XLEAF(x) 214 STATIC_XLEAF(x)
215 215
216/* 216/*
217 * STATIC_NESTED_NOPROFILE 217 * STATIC_NESTED_NOPROFILE
218 * No profilable local nested routine. 218 * No profilable local nested routine.
219 */ 219 */
220#define STATIC_NESTED_NOPROFILE(x, fsize, retpc) \ 220#define STATIC_NESTED_NOPROFILE(x, fsize, retpc) \
221 .ent _C_LABEL(x); \ 221 .ent _C_LABEL(x); \
222 .type _C_LABEL(x), @function; \ 222 .type _C_LABEL(x), @function; \
223_C_LABEL(x): ; \ 223_C_LABEL(x): ; \
224 .frame sp, fsize, retpc 224 .frame sp, fsize, retpc
225 225
226/* 226/*
227 * NESTED_NOPROFILE 227 * NESTED_NOPROFILE
228 * No profilable nested routine. 228 * No profilable nested routine.
229 */ 229 */
230#define NESTED_NOPROFILE(x, fsize, retpc) \ 230#define NESTED_NOPROFILE(x, fsize, retpc) \
231 .globl _C_LABEL(x); \ 231 .globl _C_LABEL(x); \
232 STATIC_NESTED_NOPROFILE(x, fsize, retpc) 232 STATIC_NESTED_NOPROFILE(x, fsize, retpc)
233 233
234/* 234/*
235 * NESTED 235 * NESTED
236 * A function calls other functions and needs 236 * A function calls other functions and needs
237 * therefore stack space to save/restore registers. 237 * therefore stack space to save/restore registers.
238 */ 238 */
239#define NESTED(x, fsize, retpc) \ 239#define NESTED(x, fsize, retpc) \
240 NESTED_NOPROFILE(x, fsize, retpc); \ 240 NESTED_NOPROFILE(x, fsize, retpc); \
241 MCOUNT 241 MCOUNT
242 242
243/* 243/*
244 * STATIC_NESTED 244 * STATIC_NESTED
245 * No profilable local nested routine. 245 * No profilable local nested routine.
246 */ 246 */
247#define STATIC_NESTED(x, fsize, retpc) \ 247#define STATIC_NESTED(x, fsize, retpc) \
248 STATIC_NESTED_NOPROFILE(x, fsize, retpc); \ 248 STATIC_NESTED_NOPROFILE(x, fsize, retpc); \
249 MCOUNT 249 MCOUNT
250 250
251/* 251/*
252 * XNESTED 252 * XNESTED
253 * declare alternate entry point to nested routine. 253 * declare alternate entry point to nested routine.
254 */ 254 */
255#define XNESTED(x) \ 255#define XNESTED(x) \
256 .globl _C_LABEL(x); \ 256 .globl _C_LABEL(x); \
257 AENT (_C_LABEL(x)); \ 257 AENT (_C_LABEL(x)); \
258_C_LABEL(x): 258_C_LABEL(x):
259 259
260/* 260/*
261 * END 261 * END
262 * Mark end of a procedure. 262 * Mark end of a procedure.
263 */ 263 */
264#define END(x) \ 264#define END(x) \
265 .end _C_LABEL(x); \ 265 .end _C_LABEL(x); \
266 .size _C_LABEL(x), . - _C_LABEL(x) 266 .size _C_LABEL(x), . - _C_LABEL(x)
267 267
268/* 268/*
269 * IMPORT -- import external symbol 269 * IMPORT -- import external symbol
270 */ 270 */
271#define IMPORT(sym, size) \ 271#define IMPORT(sym, size) \
272 .extern _C_LABEL(sym),size 272 .extern _C_LABEL(sym),size
273 273
274/* 274/*
275 * EXPORT -- export definition of symbol 275 * EXPORT -- export definition of symbol
276 */ 276 */
277#define EXPORT(x) \ 277#define EXPORT(x) \
278 .globl _C_LABEL(x); \ 278 .globl _C_LABEL(x); \
279_C_LABEL(x): 279_C_LABEL(x):
280 280
281/* 281/*
282 * EXPORT_OBJECT -- export definition of symbol of symbol 282 * EXPORT_OBJECT -- export definition of symbol of symbol
283 * type Object, visible to ksyms(4) address search. 283 * type Object, visible to ksyms(4) address search.
284 */ 284 */
285#define EXPORT_OBJECT(x) \ 285#define EXPORT_OBJECT(x) \
286 EXPORT(x); \ 286 EXPORT(x); \
287 .type _C_LABEL(x), @object; 287 .type _C_LABEL(x), @object;
288 288
289/* 289/*
290 * VECTOR 290 * VECTOR
291 * exception vector entrypoint 291 * exception vector entrypoint
292 * XXX: regmask should be used to generate .mask 292 * XXX: regmask should be used to generate .mask
293 */ 293 */
294#define VECTOR(x, regmask) \ 294#define VECTOR(x, regmask) \
295 .ent _C_LABEL(x); \ 295 .ent _C_LABEL(x); \
296 EXPORT(x); \ 296 EXPORT(x); \
297 297
298#define VECTOR_END(x) \ 298#define VECTOR_END(x) \
299 EXPORT(__CONCAT(x,_end)); \ 299 EXPORT(__CONCAT(x,_end)); \
300 END(x); \ 300 END(x); \
301 .org _C_LABEL(x) + 0x80 301 .org _C_LABEL(x) + 0x80
302 302
303/* 303/*
304 * Macros to panic and printf from assembly language. 304 * Macros to panic and printf from assembly language.
305 */ 305 */
306#define PANIC(msg) \ 306#define PANIC(msg) \
307 PTR_LA a0, 9f; \ 307 PTR_LA a0, 9f; \
308 jal _C_LABEL(panic); \ 308 jal _C_LABEL(panic); \
309 nop; \ 309 nop; \
310 MSG(msg) 310 MSG(msg)
311 311
312#define PRINTF(msg) \ 312#define PRINTF(msg) \
313 PTR_LA a0, 9f; \ 313 PTR_LA a0, 9f; \
314 jal _C_LABEL(printf); \ 314 jal _C_LABEL(printf); \
315 nop; \ 315 nop; \
316 MSG(msg) 316 MSG(msg)
317 317
318#define MSG(msg) \ 318#define MSG(msg) \
319 .rdata; \ 319 .rdata; \
3209: .asciz msg; \ 3209: .asciz msg; \
321 .text 321 .text
322 322
323#define ASMSTR(str) \ 323#define ASMSTR(str) \
324 .asciz str; \ 324 .asciz str; \
325 .align 3 325 .align 3
326 326
327#define RCSID(x) .pushsection ".ident","MS",@progbits,1; \ 327#define RCSID(x) .pushsection ".ident","MS",@progbits,1; \
328 .asciz x; \ 328 .asciz x; \
329 .popsection 329 .popsection
330 330
331/* 331/*
332 * XXX retain dialects XXX 332 * XXX retain dialects XXX
333 */ 333 */
334#define ALEAF(x) XLEAF(x) 334#define ALEAF(x) XLEAF(x)
335#define NLEAF(x) LEAF_NOPROFILE(x) 335#define NLEAF(x) LEAF_NOPROFILE(x)
336#define NON_LEAF(x, fsize, retpc) NESTED(x, fsize, retpc) 336#define NON_LEAF(x, fsize, retpc) NESTED(x, fsize, retpc)
337#define NNON_LEAF(x, fsize, retpc) NESTED_NOPROFILE(x, fsize, retpc) 337#define NNON_LEAF(x, fsize, retpc) NESTED_NOPROFILE(x, fsize, retpc)
338 338
339#if defined(__mips_o32) 339#if defined(__mips_o32)
340#define SZREG 4 340#define SZREG 4
341#else 341#else
342#define SZREG 8 342#define SZREG 8
343#endif 343#endif
344 344
345#if defined(__mips_o32) || defined(__mips_o64) 345#if defined(__mips_o32) || defined(__mips_o64)
346#define ALSK 7 /* stack alignment */ 346#define ALSK 7 /* stack alignment */
347#define ALMASK -7 /* stack alignment */ 347#define ALMASK -7 /* stack alignment */
348#define SZFPREG 4 348#define SZFPREG 4
349#define FP_L lwc1 349#define FP_L lwc1
350#define FP_S swc1 350#define FP_S swc1
351#else 351#else
352#define ALSK 15 /* stack alignment */ 352#define ALSK 15 /* stack alignment */
353#define ALMASK -15 /* stack alignment */ 353#define ALMASK -15 /* stack alignment */
354#define SZFPREG 8 354#define SZFPREG 8
355#define FP_L ldc1 355#define FP_L ldc1
356#define FP_S sdc1 356#define FP_S sdc1
357#endif 357#endif
358 358
359/* 359/*
360 * standard callframe { 360 * standard callframe {
361 * register_t cf_args[4]; arg0 - arg3 (only on o32 and o64) 361 * register_t cf_args[4]; arg0 - arg3 (only on o32 and o64)
362 * register_t cf_pad[N]; o32/64 (N=0), n32 (N=1) n64 (N=1) 362 * register_t cf_pad[N]; o32/64 (N=0), n32 (N=1) n64 (N=1)
363 * register_t cf_gp; global pointer (only on n32 and n64) 363 * register_t cf_gp; global pointer (only on n32 and n64)
364 * register_t cf_sp; frame pointer 364 * register_t cf_sp; frame pointer
365 * register_t cf_ra; return address 365 * register_t cf_ra; return address
366 * }; 366 * };
367 */ 367 */
368#if defined(__mips_o32) || defined(__mips_o64) 368#if defined(__mips_o32) || defined(__mips_o64)
369#define CALLFRAME_SIZ (SZREG * (4 + 2)) 369#define CALLFRAME_SIZ (SZREG * (4 + 2))
370#define CALLFRAME_S0 0 370#define CALLFRAME_S0 0
371#elif defined(__mips_n32) || defined(__mips_n64) 371#elif defined(__mips_n32) || defined(__mips_n64)
372#define CALLFRAME_SIZ (SZREG * 4) 372#define CALLFRAME_SIZ (SZREG * 4)
373#define CALLFRAME_S0 (CALLFRAME_SIZ - 4 * SZREG) 373#define CALLFRAME_S0 (CALLFRAME_SIZ - 4 * SZREG)
374#endif 374#endif
375#ifndef _KERNEL 375#ifndef _KERNEL
376#define CALLFRAME_GP (CALLFRAME_SIZ - 3 * SZREG) 376#define CALLFRAME_GP (CALLFRAME_SIZ - 3 * SZREG)
377#endif 377#endif
378#define CALLFRAME_SP (CALLFRAME_SIZ - 2 * SZREG) 378#define CALLFRAME_SP (CALLFRAME_SIZ - 2 * SZREG)
379#define CALLFRAME_RA (CALLFRAME_SIZ - 1 * SZREG) 379#define CALLFRAME_RA (CALLFRAME_SIZ - 1 * SZREG)
380 380
381/* 381/*
382 * While it would be nice to be compatible with the SGI 382 * While it would be nice to be compatible with the SGI
383 * REG_L and REG_S macros, because they do not take parameters, it 383 * REG_L and REG_S macros, because they do not take parameters, it
384 * is impossible to use them with the _MIPS_SIM_ABIX32 model. 384 * is impossible to use them with the _MIPS_SIM_ABIX32 model.
385 * 385 *
386 * These macros hide the use of mips3 instructions from the 386 * These macros hide the use of mips3 instructions from the
387 * assembler to prevent the assembler from generating 64-bit style 387 * assembler to prevent the assembler from generating 64-bit style
388 * ABI calls. 388 * ABI calls.
389 */ 389 */
390#ifdef __mips_o32 390#ifdef __mips_o32
391#define PTR_ADD add 391#define PTR_ADD add
392#define PTR_ADDI addi 392#define PTR_ADDI addi
393#define PTR_ADDU addu 393#define PTR_ADDU addu
394#define PTR_ADDIU addiu 394#define PTR_ADDIU addiu
395#define PTR_SUB subu 395#define PTR_SUB subu
396#define PTR_SUBI subi 396#define PTR_SUBI subi
397#define PTR_SUBU subu 397#define PTR_SUBU subu
398#define PTR_SUBIU subu 398#define PTR_SUBIU subu
399#define PTR_L lw 399#define PTR_L lw
400#define PTR_LA la 400#define PTR_LA la
401#define PTR_S sw 401#define PTR_S sw
402#define PTR_SLL sll 402#define PTR_SLL sll
403#define PTR_SLLV sllv 403#define PTR_SLLV sllv
404#define PTR_SRL srl 404#define PTR_SRL srl
405#define PTR_SRLV srlv 405#define PTR_SRLV srlv
406#define PTR_SRA sra 406#define PTR_SRA sra
407#define PTR_SRAV srav 407#define PTR_SRAV srav
408#define PTR_LL ll 408#define PTR_LL ll
409#define PTR_SC sc 409#define PTR_SC sc
410#define PTR_WORD .word 410#define PTR_WORD .word
411#define PTR_SCALESHIFT 2 411#define PTR_SCALESHIFT 2
412#else /* _MIPS_SZPTR == 64 */ 412#else /* _MIPS_SZPTR == 64 */
413#define PTR_ADD dadd 413#define PTR_ADD dadd
414#define PTR_ADDI daddi 414#define PTR_ADDI daddi
415#define PTR_ADDU daddu 415#define PTR_ADDU daddu
416#define PTR_ADDIU daddiu 416#define PTR_ADDIU daddiu
417#define PTR_SUB dsubu 417#define PTR_SUB dsubu
418#define PTR_SUBI dsubi 418#define PTR_SUBI dsubi
419#define PTR_SUBU dsubu 419#define PTR_SUBU dsubu
420#define PTR_SUBIU dsubu 420#define PTR_SUBIU dsubu
421#ifdef __mips_n32 421#ifdef __mips_n32
422#define PTR_L lw 422#define PTR_L lw
423#define PTR_LL ll 423#define PTR_LL ll
424#define PTR_SC sc 424#define PTR_SC sc
425#define PTR_S sw 425#define PTR_S sw
426#define PTR_SCALESHIFT 2 426#define PTR_SCALESHIFT 2
427#define PTR_WORD .word 427#define PTR_WORD .word
428#else 428#else
429#define PTR_L ld 429#define PTR_L ld
430#define PTR_LL lld 430#define PTR_LL lld
431#define PTR_SC scd 431#define PTR_SC scd
432#define PTR_S sd 432#define PTR_S sd
433#define PTR_SCALESHIFT 3 433#define PTR_SCALESHIFT 3
434#define PTR_WORD .dword 434#define PTR_WORD .dword
435#endif 435#endif
436#define PTR_LA dla 436#define PTR_LA dla
437#define PTR_SLL dsll 437#define PTR_SLL dsll
438#define PTR_SLLV dsllv 438#define PTR_SLLV dsllv
439#define PTR_SRL dsrl 439#define PTR_SRL dsrl
440#define PTR_SRLV dsrlv 440#define PTR_SRLV dsrlv
441#define PTR_SRA dsra 441#define PTR_SRA dsra
442#define PTR_SRAV dsrav 442#define PTR_SRAV dsrav
443#endif /* _MIPS_SZPTR == 64 */ 443#endif /* _MIPS_SZPTR == 64 */
444 444
445#if _MIPS_SZINT == 32 445#if _MIPS_SZINT == 32
446#define INT_ADD add 446#define INT_ADD add
447#define INT_ADDI addi 447#define INT_ADDI addi
448#define INT_ADDU addu 448#define INT_ADDU addu
449#define INT_ADDIU addiu 449#define INT_ADDIU addiu
450#define INT_SUB subu 450#define INT_SUB subu
451#define INT_SUBI subi 451#define INT_SUBI subi
452#define INT_SUBU subu 452#define INT_SUBU subu
453#define INT_SUBIU subu 453#define INT_SUBIU subu
454#define INT_L lw 454#define INT_L lw
455#define INT_LA la 455#define INT_LA la
456#define INT_S sw 456#define INT_S sw
457#define INT_SLL sll 457#define INT_SLL sll
458#define INT_SLLV sllv 458#define INT_SLLV sllv
459#define INT_SRL srl 459#define INT_SRL srl
460#define INT_SRLV srlv 460#define INT_SRLV srlv
461#define INT_SRA sra 461#define INT_SRA sra
462#define INT_SRAV srav 462#define INT_SRAV srav
463#define INT_LL ll 463#define INT_LL ll
464#define INT_SC sc 464#define INT_SC sc
465#define INT_WORD .word 465#define INT_WORD .word
466#define INT_SCALESHIFT 2 466#define INT_SCALESHIFT 2
467#else 467#else
468#define INT_ADD dadd 468#define INT_ADD dadd
469#define INT_ADDI daddi 469#define INT_ADDI daddi
470#define INT_ADDU daddu 470#define INT_ADDU daddu
471#define INT_ADDIU daddiu 471#define INT_ADDIU daddiu
472#define INT_SUB dsubu 472#define INT_SUB dsubu
473#define INT_SUBI dsubi 473#define INT_SUBI dsubi
474#define INT_SUBU dsubu 474#define INT_SUBU dsubu
475#define INT_SUBIU dsubu 475#define INT_SUBIU dsubu
476#define INT_L ld 476#define INT_L ld
477#define INT_LA dla 477#define INT_LA dla
478#define INT_S sd 478#define INT_S sd
479#define INT_SLL dsll 479#define INT_SLL dsll
480#define INT_SLLV dsllv 480#define INT_SLLV dsllv
481#define INT_SRL dsrl 481#define INT_SRL dsrl
482#define INT_SRLV dsrlv 482#define INT_SRLV dsrlv
483#define INT_SRA dsra 483#define INT_SRA dsra
484#define INT_SRAV dsrav 484#define INT_SRAV dsrav
485#define INT_LL lld 485#define INT_LL lld
486#define INT_SC scd 486#define INT_SC scd
487#define INT_WORD .dword 487#define INT_WORD .dword
488#define INT_SCALESHIFT 3 488#define INT_SCALESHIFT 3
489#endif 489#endif
490 490
491#if _MIPS_SZLONG == 32 491#if _MIPS_SZLONG == 32
492#define LONG_ADD add 492#define LONG_ADD add
493#define LONG_ADDI addi 493#define LONG_ADDI addi
494#define LONG_ADDU addu 494#define LONG_ADDU addu
495#define LONG_ADDIU addiu 495#define LONG_ADDIU addiu
496#define LONG_SUB subu 496#define LONG_SUB subu
497#define LONG_SUBI subi 497#define LONG_SUBI subi
498#define LONG_SUBU subu 498#define LONG_SUBU subu
499#define LONG_SUBIU subu 499#define LONG_SUBIU subu
500#define LONG_L lw 500#define LONG_L lw
501#define LONG_LA la 501#define LONG_LA la
502#define LONG_S sw 502#define LONG_S sw
503#define LONG_SLL sll 503#define LONG_SLL sll
504#define LONG_SLLV sllv 504#define LONG_SLLV sllv
505#define LONG_SRL srl 505#define LONG_SRL srl
506#define LONG_SRLV srlv 506#define LONG_SRLV srlv
507#define LONG_SRA sra 507#define LONG_SRA sra
508#define LONG_SRAV srav 508#define LONG_SRAV srav
509#define LONG_LL ll 509#define LONG_LL ll
510#define LONG_SC sc 510#define LONG_SC sc
511#define LONG_WORD .word 511#define LONG_WORD .word
512#define LONG_SCALESHIFT 2 512#define LONG_SCALESHIFT 2
513#else 513#else
514#define LONG_ADD dadd 514#define LONG_ADD dadd
515#define LONG_ADDI daddi 515#define LONG_ADDI daddi
516#define LONG_ADDU daddu 516#define LONG_ADDU daddu
517#define LONG_ADDIU daddiu 517#define LONG_ADDIU daddiu
518#define LONG_SUB dsubu 518#define LONG_SUB dsubu
519#define LONG_SUBI dsubi 519#define LONG_SUBI dsubi
520#define LONG_SUBU dsubu 520#define LONG_SUBU dsubu
521#define LONG_SUBIU dsubu 521#define LONG_SUBIU dsubu
522#define LONG_L ld 522#define LONG_L ld
523#define LONG_LA dla 523#define LONG_LA dla
524#define LONG_S sd 524#define LONG_S sd
525#define LONG_SLL dsll 525#define LONG_SLL dsll
526#define LONG_SLLV dsllv 526#define LONG_SLLV dsllv
527#define LONG_SRL dsrl 527#define LONG_SRL dsrl
528#define LONG_SRLV dsrlv 528#define LONG_SRLV dsrlv
529#define LONG_SRA dsra 529#define LONG_SRA dsra
530#define LONG_SRAV dsrav 530#define LONG_SRAV dsrav
531#define LONG_LL lld 531#define LONG_LL lld
532#define LONG_SC scd 532#define LONG_SC scd
533#define LONG_WORD .dword 533#define LONG_WORD .dword
534#define LONG_SCALESHIFT 3 534#define LONG_SCALESHIFT 3
535#endif 535#endif
536 536
537#if SZREG == 4 537#if SZREG == 4
538#define REG_L lw 538#define REG_L lw
539#define REG_S sw 539#define REG_S sw
540#define REG_LI li 540#define REG_LI li
541#define REG_ADDU addu 541#define REG_ADDU addu
542#define REG_SLL sll 542#define REG_SLL sll
543#define REG_SLLV sllv 543#define REG_SLLV sllv
544#define REG_SRL srl 544#define REG_SRL srl
545#define REG_SRLV srlv 545#define REG_SRLV srlv
546#define REG_SRA sra 546#define REG_SRA sra
547#define REG_SRAV srav 547#define REG_SRAV srav
548#define REG_LL ll 548#define REG_LL ll
549#define REG_SC sc 549#define REG_SC sc
550#define REG_SCALESHIFT 2 550#define REG_SCALESHIFT 2
551#else 551#else
552#define REG_L ld 552#define REG_L ld
553#define REG_S sd 553#define REG_S sd
554#define REG_LI dli 554#define REG_LI dli
555#define REG_ADDU daddu 555#define REG_ADDU daddu
556#define REG_SLL dsll 556#define REG_SLL dsll
557#define REG_SLLV dsllv 557#define REG_SLLV dsllv
558#define REG_SRL dsrl 558#define REG_SRL dsrl
559#define REG_SRLV dsrlv 559#define REG_SRLV dsrlv
560#define REG_SRA dsra 560#define REG_SRA dsra
561#define REG_SRAV dsrav 561#define REG_SRAV dsrav
562#define REG_LL lld 562#define REG_LL lld
563#define REG_SC scd 563#define REG_SC scd
564#define REG_SCALESHIFT 3 564#define REG_SCALESHIFT 3
565#endif 565#endif
566 566
567#if (MIPS1 + MIPS2) > 0 567#if (MIPS1 + MIPS2) > 0
568#define NOP_L nop 568#define NOP_L nop
569#else 569#else
570#define NOP_L /* nothing */ 570#define NOP_L /* nothing */
571#endif 571#endif
572 572
573/* compiler define */ 573/* compiler define */
574#if defined(__OCTEON__) 574#if defined(__OCTEON__)
575 /* early cnMIPS have erratum which means 2 */ 575 /* early cnMIPS have erratum which means 2 */
576#define LLSCSYNC sync 4; sync 4 576#define LLSCSYNC sync 4; sync 4
577#define BDSYNC sync 4 /* sync 4 == syncw - sync all writes */ 577#define BDSYNC sync
578#define BDSYNC_ACQ sync 578#define BDSYNC_ACQ sync
579#define SYNC_ACQ sync 579#define SYNC_ACQ sync
580#define SYNC_REL sync 580#define SYNC_REL sync
581#define BDSYNC_PLUNGER sync 4 581#define BDSYNC_PLUNGER sync 4
582#define SYNC_PLUNGER sync 4 582#define SYNC_PLUNGER sync 4
583#elif __mips >= 3 || !defined(__mips_o32) 583#elif __mips >= 3 || !defined(__mips_o32)
584#define LLSCSYNC sync 584#define LLSCSYNC sync
585#define BDSYNC sync 585#define BDSYNC sync
586#define BDSYNC_ACQ sync 586#define BDSYNC_ACQ sync
587#define SYNC_ACQ sync 587#define SYNC_ACQ sync
588#define SYNC_REL sync 588#define SYNC_REL sync
589#define BDSYNC_PLUNGER nop 589#define BDSYNC_PLUNGER nop
590#define SYNC_PLUNGER /* nothing */ 590#define SYNC_PLUNGER /* nothing */
591#else 591#else
592#define LLSCSYNC /* nothing */ 592#define LLSCSYNC /* nothing */
593#define BDSYNC nop 593#define BDSYNC nop
594#define BDSYNC_ACQ nop 594#define BDSYNC_ACQ nop
595#define SYNC_ACQ /* nothing */ 595#define SYNC_ACQ /* nothing */
596#define SYNC_REL /* nothing */ 596#define SYNC_REL /* nothing */
597#define BDSYNC_PLUNGER nop 597#define BDSYNC_PLUNGER nop
598#define SYNC_PLUNGER /* nothing */ 598#define SYNC_PLUNGER /* nothing */
599#endif 599#endif
600 600
601/* CPU dependent hook for cp0 load delays */ 601/* CPU dependent hook for cp0 load delays */
602#if defined(MIPS1) || defined(MIPS2) || defined(MIPS3) 602#if defined(MIPS1) || defined(MIPS2) || defined(MIPS3)
603#define MFC0_HAZARD sll $0,$0,1 /* super scalar nop */ 603#define MFC0_HAZARD sll $0,$0,1 /* super scalar nop */
604#else 604#else
605#define MFC0_HAZARD /* nothing */ 605#define MFC0_HAZARD /* nothing */
606#endif 606#endif
607 607
608#if _MIPS_ISA == _MIPS_ISA_MIPS1 || _MIPS_ISA == _MIPS_ISA_MIPS2 || \ 608#if _MIPS_ISA == _MIPS_ISA_MIPS1 || _MIPS_ISA == _MIPS_ISA_MIPS2 || \
609 _MIPS_ISA == _MIPS_ISA_MIPS32 609 _MIPS_ISA == _MIPS_ISA_MIPS32
610#define MFC0 mfc0 610#define MFC0 mfc0
611#define MTC0 mtc0 611#define MTC0 mtc0
612#endif 612#endif
613#if _MIPS_ISA == _MIPS_ISA_MIPS3 || _MIPS_ISA == _MIPS_ISA_MIPS4 || \ 613#if _MIPS_ISA == _MIPS_ISA_MIPS3 || _MIPS_ISA == _MIPS_ISA_MIPS4 || \
614 _MIPS_ISA == _MIPS_ISA_MIPS64 614 _MIPS_ISA == _MIPS_ISA_MIPS64
615#define MFC0 dmfc0 615#define MFC0 dmfc0
616#define MTC0 dmtc0 616#define MTC0 dmtc0
617#endif 617#endif
618 618
619#if defined(__mips_o32) || defined(__mips_o64) 619#if defined(__mips_o32) || defined(__mips_o64)
620 620
621#ifdef __mips_abicalls 621#ifdef __mips_abicalls
622#define CPRESTORE(r) .cprestore r 622#define CPRESTORE(r) .cprestore r
623#define CPLOAD(r) .cpload r 623#define CPLOAD(r) .cpload r
624#else 624#else
625#define CPRESTORE(r) /* not needed */ 625#define CPRESTORE(r) /* not needed */
626#define CPLOAD(r) /* not needed */ 626#define CPLOAD(r) /* not needed */
627#endif 627#endif
628 628
629#define SETUP_GP \ 629#define SETUP_GP \
630 .set push; \ 630 .set push; \
631 .set noreorder; \ 631 .set noreorder; \
632 .cpload t9; \ 632 .cpload t9; \
633 .set pop 633 .set pop
634#define SETUP_GPX(r) \ 634#define SETUP_GPX(r) \
635 .set push; \ 635 .set push; \
636 .set noreorder; \ 636 .set noreorder; \
637 move r,ra; /* save old ra */ \ 637 move r,ra; /* save old ra */ \
638 bal 7f; \ 638 bal 7f; \
639 nop; \ 639 nop; \
640 7: .cpload ra; \ 640 7: .cpload ra; \
641 move ra,r; \ 641 move ra,r; \
642 .set pop 642 .set pop
643#define SETUP_GPX_L(r,lbl) \ 643#define SETUP_GPX_L(r,lbl) \
644 .set push; \ 644 .set push; \
645 .set noreorder; \ 645 .set noreorder; \
646 move r,ra; /* save old ra */ \ 646 move r,ra; /* save old ra */ \
647 bal lbl; \ 647 bal lbl; \
648 nop; \ 648 nop; \
649 lbl: .cpload ra; \ 649 lbl: .cpload ra; \
650 move ra,r; \ 650 move ra,r; \
651 .set pop 651 .set pop
652#define SAVE_GP(x) .cprestore x 652#define SAVE_GP(x) .cprestore x
653 653
654#define SETUP_GP64(a,b) /* n32/n64 specific */ 654#define SETUP_GP64(a,b) /* n32/n64 specific */
655#define SETUP_GP64_R(a,b) /* n32/n64 specific */ 655#define SETUP_GP64_R(a,b) /* n32/n64 specific */
656#define SETUP_GPX64(a,b) /* n32/n64 specific */ 656#define SETUP_GPX64(a,b) /* n32/n64 specific */
657#define SETUP_GPX64_L(a,b,c) /* n32/n64 specific */ 657#define SETUP_GPX64_L(a,b,c) /* n32/n64 specific */
658#define RESTORE_GP64 /* n32/n64 specific */ 658#define RESTORE_GP64 /* n32/n64 specific */
659#define USE_ALT_CP(a) /* n32/n64 specific */ 659#define USE_ALT_CP(a) /* n32/n64 specific */
660#endif /* __mips_o32 || __mips_o64 */ 660#endif /* __mips_o32 || __mips_o64 */
661 661
662#if defined(__mips_o32) || defined(__mips_o64) 662#if defined(__mips_o32) || defined(__mips_o64)
663#define REG_PROLOGUE .set push 663#define REG_PROLOGUE .set push
664#define REG_EPILOGUE .set pop 664#define REG_EPILOGUE .set pop
665#endif 665#endif
666#if defined(__mips_n32) || defined(__mips_n64) 666#if defined(__mips_n32) || defined(__mips_n64)
667#define REG_PROLOGUE .set push ; .set mips3 667#define REG_PROLOGUE .set push ; .set mips3
668#define REG_EPILOGUE .set pop 668#define REG_EPILOGUE .set pop
669#endif 669#endif
670 670
671#if defined(__mips_n32) || defined(__mips_n64) 671#if defined(__mips_n32) || defined(__mips_n64)
672#define SETUP_GP /* o32 specific */ 672#define SETUP_GP /* o32 specific */
673#define SETUP_GPX(r) /* o32 specific */ 673#define SETUP_GPX(r) /* o32 specific */
674#define SETUP_GPX_L(r,lbl) /* o32 specific */ 674#define SETUP_GPX_L(r,lbl) /* o32 specific */
675#define SAVE_GP(x) /* o32 specific */ 675#define SAVE_GP(x) /* o32 specific */
676#define SETUP_GP64(a,b) .cpsetup t9, a, b 676#define SETUP_GP64(a,b) .cpsetup t9, a, b
677#define SETUP_GPX64(a,b) \ 677#define SETUP_GPX64(a,b) \
678 .set push; \ 678 .set push; \
679 move b,ra; \ 679 move b,ra; \
680 .set noreorder; \ 680 .set noreorder; \
681 bal 7f; \ 681 bal 7f; \
682 nop; \ 682 nop; \
683 7: .set pop; \ 683 7: .set pop; \
684 .cpsetup ra, a, 7b; \ 684 .cpsetup ra, a, 7b; \
685 move ra,b 685 move ra,b
686#define SETUP_GPX64_L(a,b,c) \ 686#define SETUP_GPX64_L(a,b,c) \
687 .set push; \ 687 .set push; \
688 move b,ra; \ 688 move b,ra; \
689 .set noreorder; \ 689 .set noreorder; \
690 bal c; \ 690 bal c; \
691 nop; \ 691 nop; \
692 c: .set pop; \ 692 c: .set pop; \
693 .cpsetup ra, a, c; \ 693 .cpsetup ra, a, c; \
694 move ra,b 694 move ra,b
695#define RESTORE_GP64 .cpreturn 695#define RESTORE_GP64 .cpreturn
696#define USE_ALT_CP(a) .cplocal a 696#define USE_ALT_CP(a) .cplocal a
697#endif /* __mips_n32 || __mips_n64 */ 697#endif /* __mips_n32 || __mips_n64 */
698 698
699/* 699/*
700 * The DYNAMIC_STATUS_MASK option adds an additional masking operation 700 * The DYNAMIC_STATUS_MASK option adds an additional masking operation
701 * when updating the hardware interrupt mask in the status register. 701 * when updating the hardware interrupt mask in the status register.
702 * 702 *
703 * This is useful for platforms that need to at run-time mask 703 * This is useful for platforms that need to at run-time mask
704 * interrupts based on motherboard configuration or to handle 704 * interrupts based on motherboard configuration or to handle
705 * slowly clearing interrupts. 705 * slowly clearing interrupts.
706 * 706 *
707 * XXX this is only currently implemented for mips3. 707 * XXX this is only currently implemented for mips3.
708 */ 708 */
709#ifdef MIPS_DYNAMIC_STATUS_MASK 709#ifdef MIPS_DYNAMIC_STATUS_MASK
710#define DYNAMIC_STATUS_MASK(sr,scratch) \ 710#define DYNAMIC_STATUS_MASK(sr,scratch) \
711 lw scratch, mips_dynamic_status_mask; \ 711 lw scratch, mips_dynamic_status_mask; \
712 and sr, sr, scratch 712 and sr, sr, scratch
713 713
714#define DYNAMIC_STATUS_MASK_TOUSER(sr,scratch1) \ 714#define DYNAMIC_STATUS_MASK_TOUSER(sr,scratch1) \
715 ori sr, (MIPS_INT_MASK | MIPS_SR_INT_IE); \ 715 ori sr, (MIPS_INT_MASK | MIPS_SR_INT_IE); \
716 DYNAMIC_STATUS_MASK(sr,scratch1) 716 DYNAMIC_STATUS_MASK(sr,scratch1)
717#else 717#else
718#define DYNAMIC_STATUS_MASK(sr,scratch) 718#define DYNAMIC_STATUS_MASK(sr,scratch)
719#define DYNAMIC_STATUS_MASK_TOUSER(sr,scratch1) 719#define DYNAMIC_STATUS_MASK_TOUSER(sr,scratch1)
720#endif 720#endif
721 721
722/* See lock_stubs.S. */ 722/* See lock_stubs.S. */
723#define LOG2_MIPS_LOCK_RAS_SIZE 8 723#define LOG2_MIPS_LOCK_RAS_SIZE 8
724#define MIPS_LOCK_RAS_SIZE 256 /* 16 bytes left over */ 724#define MIPS_LOCK_RAS_SIZE 256 /* 16 bytes left over */
725 725
726#define CPUVAR(off) _C_LABEL(cpu_info_store)+__CONCAT(CPU_INFO_,off) 726#define CPUVAR(off) _C_LABEL(cpu_info_store)+__CONCAT(CPU_INFO_,off)
727 727
728#endif /* _MIPS_ASM_H */ 728#endif /* _MIPS_ASM_H */