Committer: Michael Beasley <mike@snafu.setup>
[mikesnafu-overlay.git] / include / asm-sparc64 / ttable.h
blob6ef3d3b62baed40640b9711208c98f3873a27faa
1 /* $Id: ttable.h,v 1.18 2002/02/09 19:49:32 davem Exp $ */
2 #ifndef _SPARC64_TTABLE_H
3 #define _SPARC64_TTABLE_H
5 #include <asm/utrap.h>
7 #ifdef __ASSEMBLY__
8 #include <asm/thread_info.h>
9 #endif
11 #define BOOT_KERNEL b sparc64_boot; nop; nop; nop; nop; nop; nop; nop;
13 /* We need a "cleaned" instruction... */
14 #define CLEAN_WINDOW \
15 rdpr %cleanwin, %l0; add %l0, 1, %l0; \
16 wrpr %l0, 0x0, %cleanwin; \
17 clr %o0; clr %o1; clr %o2; clr %o3; \
18 clr %o4; clr %o5; clr %o6; clr %o7; \
19 clr %l0; clr %l1; clr %l2; clr %l3; \
20 clr %l4; clr %l5; clr %l6; clr %l7; \
21 retry; \
22 nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;
24 #define TRAP(routine) \
25 sethi %hi(109f), %g7; \
26 ba,pt %xcc, etrap; \
27 109: or %g7, %lo(109b), %g7; \
28 call routine; \
29 add %sp, PTREGS_OFF, %o0; \
30 ba,pt %xcc, rtrap; \
31 clr %l6; \
32 nop;
34 #define TRAP_7INSNS(routine) \
35 sethi %hi(109f), %g7; \
36 ba,pt %xcc, etrap; \
37 109: or %g7, %lo(109b), %g7; \
38 call routine; \
39 add %sp, PTREGS_OFF, %o0; \
40 ba,pt %xcc, rtrap; \
41 clr %l6;
43 #define TRAP_SAVEFPU(routine) \
44 sethi %hi(109f), %g7; \
45 ba,pt %xcc, do_fptrap; \
46 109: or %g7, %lo(109b), %g7; \
47 call routine; \
48 add %sp, PTREGS_OFF, %o0; \
49 ba,pt %xcc, rtrap; \
50 clr %l6; \
51 nop;
53 #define TRAP_NOSAVE(routine) \
54 ba,pt %xcc, routine; \
55 nop; \
56 nop; nop; nop; nop; nop; nop;
58 #define TRAP_NOSAVE_7INSNS(routine) \
59 ba,pt %xcc, routine; \
60 nop; \
61 nop; nop; nop; nop; nop;
63 #define TRAPTL1(routine) \
64 sethi %hi(109f), %g7; \
65 ba,pt %xcc, etraptl1; \
66 109: or %g7, %lo(109b), %g7; \
67 call routine; \
68 add %sp, PTREGS_OFF, %o0; \
69 ba,pt %xcc, rtrap; \
70 clr %l6; \
71 nop;
73 #define TRAP_ARG(routine, arg) \
74 sethi %hi(109f), %g7; \
75 ba,pt %xcc, etrap; \
76 109: or %g7, %lo(109b), %g7; \
77 add %sp, PTREGS_OFF, %o0; \
78 call routine; \
79 mov arg, %o1; \
80 ba,pt %xcc, rtrap; \
81 clr %l6;
83 #define TRAPTL1_ARG(routine, arg) \
84 sethi %hi(109f), %g7; \
85 ba,pt %xcc, etraptl1; \
86 109: or %g7, %lo(109b), %g7; \
87 add %sp, PTREGS_OFF, %o0; \
88 call routine; \
89 mov arg, %o1; \
90 ba,pt %xcc, rtrap; \
91 clr %l6;
93 #define SYSCALL_TRAP(routine, systbl) \
94 rdpr %pil, %g2; \
95 mov TSTATE_SYSCALL, %g3; \
96 sethi %hi(109f), %g7; \
97 ba,pt %xcc, etrap_syscall; \
98 109: or %g7, %lo(109b), %g7; \
99 sethi %hi(systbl), %l7; \
100 ba,pt %xcc, routine; \
101 or %l7, %lo(systbl), %l7;
103 #define INDIRECT_SOLARIS_SYSCALL(num) \
104 sethi %hi(109f), %g7; \
105 ba,pt %xcc, etrap; \
106 109: or %g7, %lo(109b), %g7; \
107 ba,pt %xcc, tl0_solaris + 0xc; \
108 mov num, %g1; \
109 nop;nop;nop;
111 #define TRAP_UTRAP(handler,lvl) \
112 mov handler, %g3; \
113 ba,pt %xcc, utrap_trap; \
114 mov lvl, %g4; \
115 nop; \
116 nop; \
117 nop; \
118 nop; \
119 nop;
121 #ifdef CONFIG_SUNOS_EMUL
122 #define SUNOS_SYSCALL_TRAP SYSCALL_TRAP(linux_sparc_syscall32, sunos_sys_table)
123 #else
124 #define SUNOS_SYSCALL_TRAP TRAP(sunos_syscall)
125 #endif
126 #ifdef CONFIG_COMPAT
127 #define LINUX_32BIT_SYSCALL_TRAP SYSCALL_TRAP(linux_sparc_syscall32, sys_call_table32)
128 #else
129 #define LINUX_32BIT_SYSCALL_TRAP BTRAP(0x110)
130 #endif
131 #define LINUX_64BIT_SYSCALL_TRAP SYSCALL_TRAP(linux_sparc_syscall, sys_call_table64)
132 #define GETCC_TRAP TRAP(getcc)
133 #define SETCC_TRAP TRAP(setcc)
134 #ifdef CONFIG_SOLARIS_EMUL
135 #define SOLARIS_SYSCALL_TRAP TRAP(solaris_sparc_syscall)
136 #else
137 #define SOLARIS_SYSCALL_TRAP TRAP(solaris_syscall)
138 #endif
139 #define BREAKPOINT_TRAP TRAP(breakpoint_trap)
141 #ifdef CONFIG_TRACE_IRQFLAGS
143 #define TRAP_IRQ(routine, level) \
144 rdpr %pil, %g2; \
145 wrpr %g0, 15, %pil; \
146 sethi %hi(1f-4), %g7; \
147 ba,pt %xcc, etrap_irq; \
148 or %g7, %lo(1f-4), %g7; \
149 nop; \
150 nop; \
151 nop; \
152 .subsection 2; \
153 1: call trace_hardirqs_off; \
154 nop; \
155 mov level, %o0; \
156 call routine; \
157 add %sp, PTREGS_OFF, %o1; \
158 ba,a,pt %xcc, rtrap_irq; \
159 .previous;
161 #else
163 #define TRAP_IRQ(routine, level) \
164 rdpr %pil, %g2; \
165 wrpr %g0, 15, %pil; \
166 ba,pt %xcc, etrap_irq; \
167 rd %pc, %g7; \
168 mov level, %o0; \
169 call routine; \
170 add %sp, PTREGS_OFF, %o1; \
171 ba,a,pt %xcc, rtrap_irq;
173 #endif
175 #define TRAP_IVEC TRAP_NOSAVE(do_ivec)
177 #define BTRAP(lvl) TRAP_ARG(bad_trap, lvl)
179 #define BTRAPTL1(lvl) TRAPTL1_ARG(bad_trap_tl1, lvl)
181 #define FLUSH_WINDOW_TRAP \
182 ba,pt %xcc, etrap; \
183 rd %pc, %g7; \
184 flushw; \
185 ldx [%sp + PTREGS_OFF + PT_V9_TNPC], %l1; \
186 add %l1, 4, %l2; \
187 stx %l1, [%sp + PTREGS_OFF + PT_V9_TPC]; \
188 ba,pt %xcc, rtrap_clr_l6; \
189 stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC];
191 #ifdef CONFIG_KPROBES
192 #define KPROBES_TRAP(lvl) TRAP_IRQ(kprobe_trap, lvl)
193 #else
194 #define KPROBES_TRAP(lvl) TRAP_ARG(bad_trap, lvl)
195 #endif
197 #define SUN4V_ITSB_MISS \
198 ldxa [%g0] ASI_SCRATCHPAD, %g2; \
199 ldx [%g2 + HV_FAULT_I_ADDR_OFFSET], %g4; \
200 ldx [%g2 + HV_FAULT_I_CTX_OFFSET], %g5; \
201 srlx %g4, 22, %g6; \
202 ba,pt %xcc, sun4v_itsb_miss; \
203 nop; \
204 nop; \
205 nop;
207 #define SUN4V_DTSB_MISS \
208 ldxa [%g0] ASI_SCRATCHPAD, %g2; \
209 ldx [%g2 + HV_FAULT_D_ADDR_OFFSET], %g4; \
210 ldx [%g2 + HV_FAULT_D_CTX_OFFSET], %g5; \
211 srlx %g4, 22, %g6; \
212 ba,pt %xcc, sun4v_dtsb_miss; \
213 nop; \
214 nop; \
215 nop;
217 /* Before touching these macros, you owe it to yourself to go and
218 * see how arch/sparc64/kernel/winfixup.S works... -DaveM
220 * For the user cases we used to use the %asi register, but
221 * it turns out that the "wr xxx, %asi" costs ~5 cycles, so
222 * now we use immediate ASI loads and stores instead. Kudos
223 * to Greg Onufer for pointing out this performance anomaly.
225 * Further note that we cannot use the g2, g4, g5, and g7 alternate
226 * globals in the spill routines, check out the save instruction in
227 * arch/sparc64/kernel/etrap.S to see what I mean about g2, and
228 * g4/g5 are the globals which are preserved by etrap processing
229 * for the caller of it. The g7 register is the return pc for
230 * etrap. Finally, g6 is the current thread register so we cannot
231 * us it in the spill handlers either. Most of these rules do not
232 * apply to fill processing, only g6 is not usable.
235 /* Normal kernel spill */
236 #define SPILL_0_NORMAL \
237 stx %l0, [%sp + STACK_BIAS + 0x00]; \
238 stx %l1, [%sp + STACK_BIAS + 0x08]; \
239 stx %l2, [%sp + STACK_BIAS + 0x10]; \
240 stx %l3, [%sp + STACK_BIAS + 0x18]; \
241 stx %l4, [%sp + STACK_BIAS + 0x20]; \
242 stx %l5, [%sp + STACK_BIAS + 0x28]; \
243 stx %l6, [%sp + STACK_BIAS + 0x30]; \
244 stx %l7, [%sp + STACK_BIAS + 0x38]; \
245 stx %i0, [%sp + STACK_BIAS + 0x40]; \
246 stx %i1, [%sp + STACK_BIAS + 0x48]; \
247 stx %i2, [%sp + STACK_BIAS + 0x50]; \
248 stx %i3, [%sp + STACK_BIAS + 0x58]; \
249 stx %i4, [%sp + STACK_BIAS + 0x60]; \
250 stx %i5, [%sp + STACK_BIAS + 0x68]; \
251 stx %i6, [%sp + STACK_BIAS + 0x70]; \
252 stx %i7, [%sp + STACK_BIAS + 0x78]; \
253 saved; retry; nop; nop; nop; nop; nop; nop; \
254 nop; nop; nop; nop; nop; nop; nop; nop;
256 #define SPILL_0_NORMAL_ETRAP \
257 etrap_kernel_spill: \
258 stx %l0, [%sp + STACK_BIAS + 0x00]; \
259 stx %l1, [%sp + STACK_BIAS + 0x08]; \
260 stx %l2, [%sp + STACK_BIAS + 0x10]; \
261 stx %l3, [%sp + STACK_BIAS + 0x18]; \
262 stx %l4, [%sp + STACK_BIAS + 0x20]; \
263 stx %l5, [%sp + STACK_BIAS + 0x28]; \
264 stx %l6, [%sp + STACK_BIAS + 0x30]; \
265 stx %l7, [%sp + STACK_BIAS + 0x38]; \
266 stx %i0, [%sp + STACK_BIAS + 0x40]; \
267 stx %i1, [%sp + STACK_BIAS + 0x48]; \
268 stx %i2, [%sp + STACK_BIAS + 0x50]; \
269 stx %i3, [%sp + STACK_BIAS + 0x58]; \
270 stx %i4, [%sp + STACK_BIAS + 0x60]; \
271 stx %i5, [%sp + STACK_BIAS + 0x68]; \
272 stx %i6, [%sp + STACK_BIAS + 0x70]; \
273 stx %i7, [%sp + STACK_BIAS + 0x78]; \
274 saved; \
275 sub %g1, 2, %g1; \
276 ba,pt %xcc, etrap_save; \
277 wrpr %g1, %cwp; \
278 nop; nop; nop; nop; nop; nop; nop; nop; \
279 nop; nop; nop; nop;
281 /* Normal 64bit spill */
282 #define SPILL_1_GENERIC(ASI) \
283 add %sp, STACK_BIAS + 0x00, %g1; \
284 stxa %l0, [%g1 + %g0] ASI; \
285 mov 0x08, %g3; \
286 stxa %l1, [%g1 + %g3] ASI; \
287 add %g1, 0x10, %g1; \
288 stxa %l2, [%g1 + %g0] ASI; \
289 stxa %l3, [%g1 + %g3] ASI; \
290 add %g1, 0x10, %g1; \
291 stxa %l4, [%g1 + %g0] ASI; \
292 stxa %l5, [%g1 + %g3] ASI; \
293 add %g1, 0x10, %g1; \
294 stxa %l6, [%g1 + %g0] ASI; \
295 stxa %l7, [%g1 + %g3] ASI; \
296 add %g1, 0x10, %g1; \
297 stxa %i0, [%g1 + %g0] ASI; \
298 stxa %i1, [%g1 + %g3] ASI; \
299 add %g1, 0x10, %g1; \
300 stxa %i2, [%g1 + %g0] ASI; \
301 stxa %i3, [%g1 + %g3] ASI; \
302 add %g1, 0x10, %g1; \
303 stxa %i4, [%g1 + %g0] ASI; \
304 stxa %i5, [%g1 + %g3] ASI; \
305 add %g1, 0x10, %g1; \
306 stxa %i6, [%g1 + %g0] ASI; \
307 stxa %i7, [%g1 + %g3] ASI; \
308 saved; \
309 retry; nop; nop; \
310 b,a,pt %xcc, spill_fixup_dax; \
311 b,a,pt %xcc, spill_fixup_mna; \
312 b,a,pt %xcc, spill_fixup;
314 #define SPILL_1_GENERIC_ETRAP \
315 etrap_user_spill_64bit: \
316 stxa %l0, [%sp + STACK_BIAS + 0x00] %asi; \
317 stxa %l1, [%sp + STACK_BIAS + 0x08] %asi; \
318 stxa %l2, [%sp + STACK_BIAS + 0x10] %asi; \
319 stxa %l3, [%sp + STACK_BIAS + 0x18] %asi; \
320 stxa %l4, [%sp + STACK_BIAS + 0x20] %asi; \
321 stxa %l5, [%sp + STACK_BIAS + 0x28] %asi; \
322 stxa %l6, [%sp + STACK_BIAS + 0x30] %asi; \
323 stxa %l7, [%sp + STACK_BIAS + 0x38] %asi; \
324 stxa %i0, [%sp + STACK_BIAS + 0x40] %asi; \
325 stxa %i1, [%sp + STACK_BIAS + 0x48] %asi; \
326 stxa %i2, [%sp + STACK_BIAS + 0x50] %asi; \
327 stxa %i3, [%sp + STACK_BIAS + 0x58] %asi; \
328 stxa %i4, [%sp + STACK_BIAS + 0x60] %asi; \
329 stxa %i5, [%sp + STACK_BIAS + 0x68] %asi; \
330 stxa %i6, [%sp + STACK_BIAS + 0x70] %asi; \
331 stxa %i7, [%sp + STACK_BIAS + 0x78] %asi; \
332 saved; \
333 sub %g1, 2, %g1; \
334 ba,pt %xcc, etrap_save; \
335 wrpr %g1, %cwp; \
336 nop; nop; nop; nop; nop; \
337 nop; nop; nop; nop; \
338 ba,a,pt %xcc, etrap_spill_fixup_64bit; \
339 ba,a,pt %xcc, etrap_spill_fixup_64bit; \
340 ba,a,pt %xcc, etrap_spill_fixup_64bit;
342 #define SPILL_1_GENERIC_ETRAP_FIXUP \
343 etrap_spill_fixup_64bit: \
344 ldub [%g6 + TI_WSAVED], %g1; \
345 sll %g1, 3, %g3; \
346 add %g6, %g3, %g3; \
347 stx %sp, [%g3 + TI_RWIN_SPTRS]; \
348 sll %g1, 7, %g3; \
349 add %g6, %g3, %g3; \
350 stx %l0, [%g3 + TI_REG_WINDOW + 0x00]; \
351 stx %l1, [%g3 + TI_REG_WINDOW + 0x08]; \
352 stx %l2, [%g3 + TI_REG_WINDOW + 0x10]; \
353 stx %l3, [%g3 + TI_REG_WINDOW + 0x18]; \
354 stx %l4, [%g3 + TI_REG_WINDOW + 0x20]; \
355 stx %l5, [%g3 + TI_REG_WINDOW + 0x28]; \
356 stx %l6, [%g3 + TI_REG_WINDOW + 0x30]; \
357 stx %l7, [%g3 + TI_REG_WINDOW + 0x38]; \
358 stx %i0, [%g3 + TI_REG_WINDOW + 0x40]; \
359 stx %i1, [%g3 + TI_REG_WINDOW + 0x48]; \
360 stx %i2, [%g3 + TI_REG_WINDOW + 0x50]; \
361 stx %i3, [%g3 + TI_REG_WINDOW + 0x58]; \
362 stx %i4, [%g3 + TI_REG_WINDOW + 0x60]; \
363 stx %i5, [%g3 + TI_REG_WINDOW + 0x68]; \
364 stx %i6, [%g3 + TI_REG_WINDOW + 0x70]; \
365 stx %i7, [%g3 + TI_REG_WINDOW + 0x78]; \
366 add %g1, 1, %g1; \
367 stb %g1, [%g6 + TI_WSAVED]; \
368 saved; \
369 rdpr %cwp, %g1; \
370 sub %g1, 2, %g1; \
371 ba,pt %xcc, etrap_save; \
372 wrpr %g1, %cwp; \
373 nop; nop; nop
375 /* Normal 32bit spill */
376 #define SPILL_2_GENERIC(ASI) \
377 srl %sp, 0, %sp; \
378 stwa %l0, [%sp + %g0] ASI; \
379 mov 0x04, %g3; \
380 stwa %l1, [%sp + %g3] ASI; \
381 add %sp, 0x08, %g1; \
382 stwa %l2, [%g1 + %g0] ASI; \
383 stwa %l3, [%g1 + %g3] ASI; \
384 add %g1, 0x08, %g1; \
385 stwa %l4, [%g1 + %g0] ASI; \
386 stwa %l5, [%g1 + %g3] ASI; \
387 add %g1, 0x08, %g1; \
388 stwa %l6, [%g1 + %g0] ASI; \
389 stwa %l7, [%g1 + %g3] ASI; \
390 add %g1, 0x08, %g1; \
391 stwa %i0, [%g1 + %g0] ASI; \
392 stwa %i1, [%g1 + %g3] ASI; \
393 add %g1, 0x08, %g1; \
394 stwa %i2, [%g1 + %g0] ASI; \
395 stwa %i3, [%g1 + %g3] ASI; \
396 add %g1, 0x08, %g1; \
397 stwa %i4, [%g1 + %g0] ASI; \
398 stwa %i5, [%g1 + %g3] ASI; \
399 add %g1, 0x08, %g1; \
400 stwa %i6, [%g1 + %g0] ASI; \
401 stwa %i7, [%g1 + %g3] ASI; \
402 saved; \
403 retry; nop; nop; \
404 b,a,pt %xcc, spill_fixup_dax; \
405 b,a,pt %xcc, spill_fixup_mna; \
406 b,a,pt %xcc, spill_fixup;
408 #define SPILL_2_GENERIC_ETRAP \
409 etrap_user_spill_32bit: \
410 srl %sp, 0, %sp; \
411 stwa %l0, [%sp + 0x00] %asi; \
412 stwa %l1, [%sp + 0x04] %asi; \
413 stwa %l2, [%sp + 0x08] %asi; \
414 stwa %l3, [%sp + 0x0c] %asi; \
415 stwa %l4, [%sp + 0x10] %asi; \
416 stwa %l5, [%sp + 0x14] %asi; \
417 stwa %l6, [%sp + 0x18] %asi; \
418 stwa %l7, [%sp + 0x1c] %asi; \
419 stwa %i0, [%sp + 0x20] %asi; \
420 stwa %i1, [%sp + 0x24] %asi; \
421 stwa %i2, [%sp + 0x28] %asi; \
422 stwa %i3, [%sp + 0x2c] %asi; \
423 stwa %i4, [%sp + 0x30] %asi; \
424 stwa %i5, [%sp + 0x34] %asi; \
425 stwa %i6, [%sp + 0x38] %asi; \
426 stwa %i7, [%sp + 0x3c] %asi; \
427 saved; \
428 sub %g1, 2, %g1; \
429 ba,pt %xcc, etrap_save; \
430 wrpr %g1, %cwp; \
431 nop; nop; nop; nop; \
432 nop; nop; nop; nop; \
433 ba,a,pt %xcc, etrap_spill_fixup_32bit; \
434 ba,a,pt %xcc, etrap_spill_fixup_32bit; \
435 ba,a,pt %xcc, etrap_spill_fixup_32bit;
437 #define SPILL_2_GENERIC_ETRAP_FIXUP \
438 etrap_spill_fixup_32bit: \
439 ldub [%g6 + TI_WSAVED], %g1; \
440 sll %g1, 3, %g3; \
441 add %g6, %g3, %g3; \
442 stx %sp, [%g3 + TI_RWIN_SPTRS]; \
443 sll %g1, 7, %g3; \
444 add %g6, %g3, %g3; \
445 stw %l0, [%g3 + TI_REG_WINDOW + 0x00]; \
446 stw %l1, [%g3 + TI_REG_WINDOW + 0x04]; \
447 stw %l2, [%g3 + TI_REG_WINDOW + 0x08]; \
448 stw %l3, [%g3 + TI_REG_WINDOW + 0x0c]; \
449 stw %l4, [%g3 + TI_REG_WINDOW + 0x10]; \
450 stw %l5, [%g3 + TI_REG_WINDOW + 0x14]; \
451 stw %l6, [%g3 + TI_REG_WINDOW + 0x18]; \
452 stw %l7, [%g3 + TI_REG_WINDOW + 0x1c]; \
453 stw %i0, [%g3 + TI_REG_WINDOW + 0x20]; \
454 stw %i1, [%g3 + TI_REG_WINDOW + 0x24]; \
455 stw %i2, [%g3 + TI_REG_WINDOW + 0x28]; \
456 stw %i3, [%g3 + TI_REG_WINDOW + 0x2c]; \
457 stw %i4, [%g3 + TI_REG_WINDOW + 0x30]; \
458 stw %i5, [%g3 + TI_REG_WINDOW + 0x34]; \
459 stw %i6, [%g3 + TI_REG_WINDOW + 0x38]; \
460 stw %i7, [%g3 + TI_REG_WINDOW + 0x3c]; \
461 add %g1, 1, %g1; \
462 stb %g1, [%g6 + TI_WSAVED]; \
463 saved; \
464 rdpr %cwp, %g1; \
465 sub %g1, 2, %g1; \
466 ba,pt %xcc, etrap_save; \
467 wrpr %g1, %cwp; \
468 nop; nop; nop
470 #define SPILL_1_NORMAL SPILL_1_GENERIC(ASI_AIUP)
471 #define SPILL_2_NORMAL SPILL_2_GENERIC(ASI_AIUP)
472 #define SPILL_3_NORMAL SPILL_0_NORMAL
473 #define SPILL_4_NORMAL SPILL_0_NORMAL
474 #define SPILL_5_NORMAL SPILL_0_NORMAL
475 #define SPILL_6_NORMAL SPILL_0_NORMAL
476 #define SPILL_7_NORMAL SPILL_0_NORMAL
478 #define SPILL_0_OTHER SPILL_0_NORMAL
479 #define SPILL_1_OTHER SPILL_1_GENERIC(ASI_AIUS)
480 #define SPILL_2_OTHER SPILL_2_GENERIC(ASI_AIUS)
481 #define SPILL_3_OTHER SPILL_3_NORMAL
482 #define SPILL_4_OTHER SPILL_4_NORMAL
483 #define SPILL_5_OTHER SPILL_5_NORMAL
484 #define SPILL_6_OTHER SPILL_6_NORMAL
485 #define SPILL_7_OTHER SPILL_7_NORMAL
487 /* Normal kernel fill */
488 #define FILL_0_NORMAL \
489 ldx [%sp + STACK_BIAS + 0x00], %l0; \
490 ldx [%sp + STACK_BIAS + 0x08], %l1; \
491 ldx [%sp + STACK_BIAS + 0x10], %l2; \
492 ldx [%sp + STACK_BIAS + 0x18], %l3; \
493 ldx [%sp + STACK_BIAS + 0x20], %l4; \
494 ldx [%sp + STACK_BIAS + 0x28], %l5; \
495 ldx [%sp + STACK_BIAS + 0x30], %l6; \
496 ldx [%sp + STACK_BIAS + 0x38], %l7; \
497 ldx [%sp + STACK_BIAS + 0x40], %i0; \
498 ldx [%sp + STACK_BIAS + 0x48], %i1; \
499 ldx [%sp + STACK_BIAS + 0x50], %i2; \
500 ldx [%sp + STACK_BIAS + 0x58], %i3; \
501 ldx [%sp + STACK_BIAS + 0x60], %i4; \
502 ldx [%sp + STACK_BIAS + 0x68], %i5; \
503 ldx [%sp + STACK_BIAS + 0x70], %i6; \
504 ldx [%sp + STACK_BIAS + 0x78], %i7; \
505 restored; retry; nop; nop; nop; nop; nop; nop; \
506 nop; nop; nop; nop; nop; nop; nop; nop;
508 #define FILL_0_NORMAL_RTRAP \
509 kern_rtt_fill: \
510 rdpr %cwp, %g1; \
511 sub %g1, 1, %g1; \
512 wrpr %g1, %cwp; \
513 ldx [%sp + STACK_BIAS + 0x00], %l0; \
514 ldx [%sp + STACK_BIAS + 0x08], %l1; \
515 ldx [%sp + STACK_BIAS + 0x10], %l2; \
516 ldx [%sp + STACK_BIAS + 0x18], %l3; \
517 ldx [%sp + STACK_BIAS + 0x20], %l4; \
518 ldx [%sp + STACK_BIAS + 0x28], %l5; \
519 ldx [%sp + STACK_BIAS + 0x30], %l6; \
520 ldx [%sp + STACK_BIAS + 0x38], %l7; \
521 ldx [%sp + STACK_BIAS + 0x40], %i0; \
522 ldx [%sp + STACK_BIAS + 0x48], %i1; \
523 ldx [%sp + STACK_BIAS + 0x50], %i2; \
524 ldx [%sp + STACK_BIAS + 0x58], %i3; \
525 ldx [%sp + STACK_BIAS + 0x60], %i4; \
526 ldx [%sp + STACK_BIAS + 0x68], %i5; \
527 ldx [%sp + STACK_BIAS + 0x70], %i6; \
528 ldx [%sp + STACK_BIAS + 0x78], %i7; \
529 restored; \
530 add %g1, 1, %g1; \
531 ba,pt %xcc, kern_rtt_restore; \
532 wrpr %g1, %cwp; \
533 nop; nop; nop; nop; nop; \
534 nop; nop; nop; nop;
537 /* Normal 64bit fill */
538 #define FILL_1_GENERIC(ASI) \
539 add %sp, STACK_BIAS + 0x00, %g1; \
540 ldxa [%g1 + %g0] ASI, %l0; \
541 mov 0x08, %g2; \
542 mov 0x10, %g3; \
543 ldxa [%g1 + %g2] ASI, %l1; \
544 mov 0x18, %g5; \
545 ldxa [%g1 + %g3] ASI, %l2; \
546 ldxa [%g1 + %g5] ASI, %l3; \
547 add %g1, 0x20, %g1; \
548 ldxa [%g1 + %g0] ASI, %l4; \
549 ldxa [%g1 + %g2] ASI, %l5; \
550 ldxa [%g1 + %g3] ASI, %l6; \
551 ldxa [%g1 + %g5] ASI, %l7; \
552 add %g1, 0x20, %g1; \
553 ldxa [%g1 + %g0] ASI, %i0; \
554 ldxa [%g1 + %g2] ASI, %i1; \
555 ldxa [%g1 + %g3] ASI, %i2; \
556 ldxa [%g1 + %g5] ASI, %i3; \
557 add %g1, 0x20, %g1; \
558 ldxa [%g1 + %g0] ASI, %i4; \
559 ldxa [%g1 + %g2] ASI, %i5; \
560 ldxa [%g1 + %g3] ASI, %i6; \
561 ldxa [%g1 + %g5] ASI, %i7; \
562 restored; \
563 retry; nop; nop; nop; nop; \
564 b,a,pt %xcc, fill_fixup_dax; \
565 b,a,pt %xcc, fill_fixup_mna; \
566 b,a,pt %xcc, fill_fixup;
568 #define FILL_1_GENERIC_RTRAP \
569 user_rtt_fill_64bit: \
570 ldxa [%sp + STACK_BIAS + 0x00] %asi, %l0; \
571 ldxa [%sp + STACK_BIAS + 0x08] %asi, %l1; \
572 ldxa [%sp + STACK_BIAS + 0x10] %asi, %l2; \
573 ldxa [%sp + STACK_BIAS + 0x18] %asi, %l3; \
574 ldxa [%sp + STACK_BIAS + 0x20] %asi, %l4; \
575 ldxa [%sp + STACK_BIAS + 0x28] %asi, %l5; \
576 ldxa [%sp + STACK_BIAS + 0x30] %asi, %l6; \
577 ldxa [%sp + STACK_BIAS + 0x38] %asi, %l7; \
578 ldxa [%sp + STACK_BIAS + 0x40] %asi, %i0; \
579 ldxa [%sp + STACK_BIAS + 0x48] %asi, %i1; \
580 ldxa [%sp + STACK_BIAS + 0x50] %asi, %i2; \
581 ldxa [%sp + STACK_BIAS + 0x58] %asi, %i3; \
582 ldxa [%sp + STACK_BIAS + 0x60] %asi, %i4; \
583 ldxa [%sp + STACK_BIAS + 0x68] %asi, %i5; \
584 ldxa [%sp + STACK_BIAS + 0x70] %asi, %i6; \
585 ldxa [%sp + STACK_BIAS + 0x78] %asi, %i7; \
586 ba,pt %xcc, user_rtt_pre_restore; \
587 restored; \
588 nop; nop; nop; nop; nop; nop; \
589 nop; nop; nop; nop; nop; \
590 ba,a,pt %xcc, user_rtt_fill_fixup; \
591 ba,a,pt %xcc, user_rtt_fill_fixup; \
592 ba,a,pt %xcc, user_rtt_fill_fixup;
595 /* Normal 32bit fill */
596 #define FILL_2_GENERIC(ASI) \
597 srl %sp, 0, %sp; \
598 lduwa [%sp + %g0] ASI, %l0; \
599 mov 0x04, %g2; \
600 mov 0x08, %g3; \
601 lduwa [%sp + %g2] ASI, %l1; \
602 mov 0x0c, %g5; \
603 lduwa [%sp + %g3] ASI, %l2; \
604 lduwa [%sp + %g5] ASI, %l3; \
605 add %sp, 0x10, %g1; \
606 lduwa [%g1 + %g0] ASI, %l4; \
607 lduwa [%g1 + %g2] ASI, %l5; \
608 lduwa [%g1 + %g3] ASI, %l6; \
609 lduwa [%g1 + %g5] ASI, %l7; \
610 add %g1, 0x10, %g1; \
611 lduwa [%g1 + %g0] ASI, %i0; \
612 lduwa [%g1 + %g2] ASI, %i1; \
613 lduwa [%g1 + %g3] ASI, %i2; \
614 lduwa [%g1 + %g5] ASI, %i3; \
615 add %g1, 0x10, %g1; \
616 lduwa [%g1 + %g0] ASI, %i4; \
617 lduwa [%g1 + %g2] ASI, %i5; \
618 lduwa [%g1 + %g3] ASI, %i6; \
619 lduwa [%g1 + %g5] ASI, %i7; \
620 restored; \
621 retry; nop; nop; nop; nop; \
622 b,a,pt %xcc, fill_fixup_dax; \
623 b,a,pt %xcc, fill_fixup_mna; \
624 b,a,pt %xcc, fill_fixup;
626 #define FILL_2_GENERIC_RTRAP \
627 user_rtt_fill_32bit: \
628 srl %sp, 0, %sp; \
629 lduwa [%sp + 0x00] %asi, %l0; \
630 lduwa [%sp + 0x04] %asi, %l1; \
631 lduwa [%sp + 0x08] %asi, %l2; \
632 lduwa [%sp + 0x0c] %asi, %l3; \
633 lduwa [%sp + 0x10] %asi, %l4; \
634 lduwa [%sp + 0x14] %asi, %l5; \
635 lduwa [%sp + 0x18] %asi, %l6; \
636 lduwa [%sp + 0x1c] %asi, %l7; \
637 lduwa [%sp + 0x20] %asi, %i0; \
638 lduwa [%sp + 0x24] %asi, %i1; \
639 lduwa [%sp + 0x28] %asi, %i2; \
640 lduwa [%sp + 0x2c] %asi, %i3; \
641 lduwa [%sp + 0x30] %asi, %i4; \
642 lduwa [%sp + 0x34] %asi, %i5; \
643 lduwa [%sp + 0x38] %asi, %i6; \
644 lduwa [%sp + 0x3c] %asi, %i7; \
645 ba,pt %xcc, user_rtt_pre_restore; \
646 restored; \
647 nop; nop; nop; nop; nop; \
648 nop; nop; nop; nop; nop; \
649 ba,a,pt %xcc, user_rtt_fill_fixup; \
650 ba,a,pt %xcc, user_rtt_fill_fixup; \
651 ba,a,pt %xcc, user_rtt_fill_fixup;
654 #define FILL_1_NORMAL FILL_1_GENERIC(ASI_AIUP)
655 #define FILL_2_NORMAL FILL_2_GENERIC(ASI_AIUP)
656 #define FILL_3_NORMAL FILL_0_NORMAL
657 #define FILL_4_NORMAL FILL_0_NORMAL
658 #define FILL_5_NORMAL FILL_0_NORMAL
659 #define FILL_6_NORMAL FILL_0_NORMAL
660 #define FILL_7_NORMAL FILL_0_NORMAL
662 #define FILL_0_OTHER FILL_0_NORMAL
663 #define FILL_1_OTHER FILL_1_GENERIC(ASI_AIUS)
664 #define FILL_2_OTHER FILL_2_GENERIC(ASI_AIUS)
665 #define FILL_3_OTHER FILL_3_NORMAL
666 #define FILL_4_OTHER FILL_4_NORMAL
667 #define FILL_5_OTHER FILL_5_NORMAL
668 #define FILL_6_OTHER FILL_6_NORMAL
669 #define FILL_7_OTHER FILL_7_NORMAL
671 #endif /* !(_SPARC64_TTABLE_H) */