~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Linux/include/asm-sparc64/ttable.h

Version: ~ [ 2.4.0 ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* $Id: ttable.h,v 1.15 2000/04/03 10:36:42 davem Exp $ */
  2 #ifndef _SPARC64_TTABLE_H
  3 #define _SPARC64_TTABLE_H
  4 
  5 #include <linux/config.h>
  6 #include <asm/asm_offsets.h>
  7 #include <asm/utrap.h>
  8 
  9 #define BOOT_KERNEL b sparc64_boot; nop; nop; nop; nop; nop; nop; nop;
 10 
 11 /* We need a "cleaned" instruction... */
 12 #define CLEAN_WINDOW                                                    \
 13         rdpr    %cleanwin, %l0;         add     %l0, 1, %l0;            \
 14         wrpr    %l0, 0x0, %cleanwin;                                    \
 15         clr     %o0;    clr     %o1;    clr     %o2;    clr     %o3;    \
 16         clr     %o4;    clr     %o5;    clr     %o6;    clr     %o7;    \
 17         clr     %l0;    clr     %l1;    clr     %l2;    clr     %l3;    \
 18         clr     %l4;    clr     %l5;    clr     %l6;    clr     %l7;    \
 19         retry;                                                          \
 20         nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;
 21 
 22 #define TRAP(routine)                                   \
 23         sethi   %hi(109f), %g7;                         \
 24         ba,pt   %xcc, etrap;                            \
 25 109:     or     %g7, %lo(109b), %g7;                    \
 26         call    routine;                                \
 27          add    %sp, STACK_BIAS + REGWIN_SZ, %o0;       \
 28         ba,pt   %xcc, rtrap;                            \
 29          clr    %l6;                                    \
 30         nop;
 31 
 32 #define TRAP_SAVEFPU(routine)                           \
 33         sethi   %hi(109f), %g7;                         \
 34         ba,pt   %xcc, do_fptrap;                        \
 35 109:     or     %g7, %lo(109b), %g7;                    \
 36         call    routine;                                \
 37          add    %sp, STACK_BIAS + REGWIN_SZ, %o0;       \
 38         ba,pt   %xcc, rtrap;                            \
 39          clr    %l6;                                    \
 40         nop;
 41 
 42 #define TRAP_NOSAVE(routine)                            \
 43         ba,pt   %xcc, routine;                          \
 44          nop;                                           \
 45         nop; nop; nop; nop; nop; nop;
 46         
 47 #define TRAPTL1(routine)                                \
 48         sethi   %hi(109f), %g7;                         \
 49         ba,pt   %xcc, etraptl1;                         \
 50 109:     or     %g7, %lo(109b), %g7;                    \
 51         call    routine;                                \
 52          add    %sp, STACK_BIAS + REGWIN_SZ, %o0;       \
 53         ba,pt   %xcc, rtrap;                            \
 54          clr    %l6;                                    \
 55         nop;
 56         
 57 #define TRAPTL1_CEE                     \
 58         ldxa    [%g0] ASI_AFSR, %g1;    \
 59         membar  #Sync;                  \
 60         stxa    %g1, [%g0] ASI_AFSR;    \
 61         membar  #Sync;                  \
 62         retry; nop; nop; nop;
 63 
 64 #define TRAP_ARG(routine, arg)                          \
 65         sethi   %hi(109f), %g7;                         \
 66         ba,pt   %xcc, etrap;                            \
 67 109:     or     %g7, %lo(109b), %g7;                    \
 68         add     %sp, STACK_BIAS + REGWIN_SZ, %o0;       \
 69         call    routine;                                \
 70          mov    arg, %o1;                               \
 71         ba,pt   %xcc, rtrap;                            \
 72          clr    %l6;
 73         
 74 #define TRAPTL1_ARG(routine, arg)                       \
 75         sethi   %hi(109f), %g7;                         \
 76         ba,pt   %xcc, etraptl1;                         \
 77 109:     or     %g7, %lo(109b), %g7;                    \
 78         add     %sp, STACK_BIAS + REGWIN_SZ, %o0;       \
 79         call    routine;                                \
 80          mov    arg, %o1;                               \
 81         ba,pt   %xcc, rtrap;                            \
 82          clr    %l6;
 83         
 84 #define SYSCALL_TRAP(routine, systbl)                   \
 85         sethi   %hi(109f), %g7;                         \
 86         ba,pt   %xcc, scetrap;                          \
 87 109:     or     %g7, %lo(109b), %g7;                    \
 88         ba,pt   %xcc, routine;                          \
 89          sethi  %hi(systbl), %l7;                       \
 90         nop; nop; nop;
 91         
 92 #define INDIRECT_SOLARIS_SYSCALL(num)                   \
 93         sethi   %hi(109f), %g7;                         \
 94         ba,pt   %xcc, etrap;                            \
 95 109:     or     %g7, %lo(109b), %g7;                    \
 96         ba,pt   %xcc, tl0_solaris + 0xc;                \
 97          mov    num, %g1;                               \
 98         nop;nop;nop;
 99         
100 #define TRAP_UTRAP(handler,lvl)                                         \
101         ldx     [%g6 + AOFF_task_thread + AOFF_thread_utraps], %g1;     \
102         sethi   %hi(109f), %g7;                                         \
103         brz,pn  %g1, utrap;                                             \
104          or     %g7, %lo(109f), %g7;                                    \
105         ba,pt   %xcc, utrap;                                            \
106 109:     ldx    [%g1 + handler*8], %g1;                                 \
107         ba,pt   %xcc, utrap_ill;                                        \
108          mov    lvl, %o1;
109 
110 #ifdef CONFIG_SUNOS_EMUL
111 #define SUNOS_SYSCALL_TRAP SYSCALL_TRAP(linux_sparc_syscall32, sunos_sys_table)
112 #else
113 #define SUNOS_SYSCALL_TRAP TRAP(sunos_syscall)
114 #endif
115 #define LINUX_32BIT_SYSCALL_TRAP SYSCALL_TRAP(linux_sparc_syscall32, sys_call_table32)
116 #define LINUX_64BIT_SYSCALL_TRAP SYSCALL_TRAP(linux_sparc_syscall, sys_call_table64)
117 #define GETCC_TRAP TRAP(getcc)
118 #define SETCC_TRAP TRAP(setcc)
119 #ifdef CONFIG_SOLARIS_EMUL
120 #define SOLARIS_SYSCALL_TRAP TRAP(solaris_sparc_syscall)
121 #else
122 #define SOLARIS_SYSCALL_TRAP TRAP(solaris_syscall)
123 #endif
124 /* FIXME: Write these actually */       
125 #define NETBSD_SYSCALL_TRAP TRAP(netbsd_syscall)
126 #define BREAKPOINT_TRAP TRAP(breakpoint_trap)
127 
128 #define TRAP_IRQ(routine, level)                        \
129         rdpr    %pil, %g2;                              \
130         wrpr    %g0, 15, %pil;                          \
131         b,pt    %xcc, etrap_irq;                        \
132          rd     %pc, %g7;                               \
133         mov     level, %o0;                             \
134         call    routine;                                \
135          add    %sp, STACK_BIAS + REGWIN_SZ, %o1;       \
136         ba,a,pt %xcc, rtrap_clr_l6;
137         
138 #define TICK_SMP_IRQ                                    \
139         rdpr    %pil, %g2;                              \
140         wrpr    %g0, 15, %pil;                          \
141         sethi   %hi(109f), %g7;                         \
142         b,pt    %xcc, etrap_irq;                        \
143 109:     or     %g7, %lo(109b), %g7;                    \
144         call    smp_percpu_timer_interrupt;             \
145          add    %sp, STACK_BIAS + REGWIN_SZ, %o0;       \
146         ba,a,pt %xcc, rtrap_clr_l6;
147 
148 #define TRAP_IVEC TRAP_NOSAVE(do_ivec)
149 
150 #define BTRAP(lvl) TRAP_ARG(bad_trap, lvl)
151 
152 #define BTRAPTL1(lvl) TRAPTL1_ARG(bad_trap_tl1, lvl)
153 
154 #define FLUSH_WINDOW_TRAP                                               \
155         ba,pt   %xcc, etrap;                                            \
156          rd     %pc, %g7;                                               \
157         flushw;                                                         \
158         ldx     [%sp + STACK_BIAS + REGWIN_SZ + PT_V9_TNPC], %l1;       \
159         add     %l1, 4, %l2;                                            \
160         stx     %l1, [%sp + STACK_BIAS + REGWIN_SZ + PT_V9_TPC];        \
161         ba,pt   %xcc, rtrap_clr_l6;                                     \
162          stx    %l2, [%sp + STACK_BIAS + REGWIN_SZ + PT_V9_TNPC];
163                 
164 /* Before touching these macros, you owe it to yourself to go and
165  * see how arch/sparc64/kernel/winfixup.S works... -DaveM
166  *
167  * For the user cases we used to use the %asi register, but
168  * it turns out that the "wr xxx, %asi" costs ~5 cycles, so
169  * now we use immediate ASI loads and stores instead.  Kudos
170  * to Greg Onufer for pointing out this performance anomaly.
171  *
172  * Further note that we cannot use the g2, g4, g5, and g7 alternate
173  * globals in the spill routines, check out the save instruction in
174  * arch/sparc64/kernel/etrap.S to see what I mean about g2, and
175  * g4/g5 are the globals which are preserved by etrap processing
176  * for the caller of it.  The g7 register is the return pc for
177  * etrap.  Finally, g6 is the current thread register so we cannot
178  * us it in the spill handlers either.  Most of these rules do not
179  * apply to fill processing, only g6 is not usable.
180  */
181 
182 /* Normal kernel spill */
183 #define SPILL_0_NORMAL                                  \
184         stx     %l0, [%sp + STACK_BIAS + 0x00];         \
185         stx     %l1, [%sp + STACK_BIAS + 0x08];         \
186         stx     %l2, [%sp + STACK_BIAS + 0x10];         \
187         stx     %l3, [%sp + STACK_BIAS + 0x18];         \
188         stx     %l4, [%sp + STACK_BIAS + 0x20];         \
189         stx     %l5, [%sp + STACK_BIAS + 0x28];         \
190         stx     %l6, [%sp + STACK_BIAS + 0x30];         \
191         stx     %l7, [%sp + STACK_BIAS + 0x38];         \
192         stx     %i0, [%sp + STACK_BIAS + 0x40];         \
193         stx     %i1, [%sp + STACK_BIAS + 0x48];         \
194         stx     %i2, [%sp + STACK_BIAS + 0x50];         \
195         stx     %i3, [%sp + STACK_BIAS + 0x58];         \
196         stx     %i4, [%sp + STACK_BIAS + 0x60];         \
197         stx     %i5, [%sp + STACK_BIAS + 0x68];         \
198         stx     %i6, [%sp + STACK_BIAS + 0x70];         \
199         stx     %i7, [%sp + STACK_BIAS + 0x78];         \
200         saved; retry; nop; nop; nop; nop; nop; nop;     \
201         nop; nop; nop; nop; nop; nop; nop; nop;
202 
203 /* Normal 64bit spill */
204 #define SPILL_1_GENERIC(ASI)                            \
205         add     %sp, STACK_BIAS + 0x00, %g1;            \
206         stxa    %l0, [%g1 + %g0] ASI;                   \
207         mov     0x08, %g3;                              \
208         stxa    %l1, [%g1 + %g3] ASI;                   \
209         add     %g1, 0x10, %g1;                         \
210         stxa    %l2, [%g1 + %g0] ASI;                   \
211         stxa    %l3, [%g1 + %g3] ASI;                   \
212         add     %g1, 0x10, %g1;                         \
213         stxa    %l4, [%g1 + %g0] ASI;                   \
214         stxa    %l5, [%g1 + %g3] ASI;                   \
215         add     %g1, 0x10, %g1;                         \
216         stxa    %l6, [%g1 + %g0] ASI;                   \
217         stxa    %l7, [%g1 + %g3] ASI;                   \
218         add     %g1, 0x10, %g1;                         \
219         stxa    %i0, [%g1 + %g0] ASI;                   \
220         stxa    %i1, [%g1 + %g3] ASI;                   \
221         add     %g1, 0x10, %g1;                         \
222         stxa    %i2, [%g1 + %g0] ASI;                   \
223         stxa    %i3, [%g1 + %g3] ASI;                   \
224         add     %g1, 0x10, %g1;                         \
225         stxa    %i4, [%g1 + %g0] ASI;                   \
226         stxa    %i5, [%g1 + %g3] ASI;                   \
227         add     %g1, 0x10, %g1;                         \
228         stxa    %i6, [%g1 + %g0] ASI;                   \
229         stxa    %i7, [%g1 + %g3] ASI;                   \
230         saved;                                          \
231         retry; nop; nop;                                \
232         b,a,pt  %xcc, spill_fixup_dax;                  \
233         b,a,pt  %xcc, spill_fixup_mna;                  \
234         b,a,pt  %xcc, spill_fixup;
235 
236 /* Normal 32bit spill */
237 #define SPILL_2_GENERIC(ASI)                            \
238         srl     %sp, 0, %sp;                            \
239         stwa    %l0, [%sp + %g0] ASI;                   \
240         mov     0x04, %g3;                              \
241         stwa    %l1, [%sp + %g3] ASI;                   \
242         add     %sp, 0x08, %g1;                         \
243         stwa    %l2, [%g1 + %g0] ASI;                   \
244         stwa    %l3, [%g1 + %g3] ASI;                   \
245         add     %g1, 0x08, %g1;                         \
246         stwa    %l4, [%g1 + %g0] ASI;                   \
247         stwa    %l5, [%g1 + %g3] ASI;                   \
248         add     %g1, 0x08, %g1;                         \
249         stwa    %l6, [%g1 + %g0] ASI;                   \
250         stwa    %l7, [%g1 + %g3] ASI;                   \
251         add     %g1, 0x08, %g1;                         \
252         stwa    %i0, [%g1 + %g0] ASI;                   \
253         stwa    %i1, [%g1 + %g3] ASI;                   \
254         add     %g1, 0x08, %g1;                         \
255         stwa    %i2, [%g1 + %g0] ASI;                   \
256         stwa    %i3, [%g1 + %g3] ASI;                   \
257         add     %g1, 0x08, %g1;                         \
258         stwa    %i4, [%g1 + %g0] ASI;                   \
259         stwa    %i5, [%g1 + %g3] ASI;                   \
260         add     %g1, 0x08, %g1;                         \
261         stwa    %i6, [%g1 + %g0] ASI;                   \
262         stwa    %i7, [%g1 + %g3] ASI;                   \
263         saved;                                          \
264         retry; nop; nop;                                \
265         b,a,pt  %xcc, spill_fixup_dax;                  \
266         b,a,pt  %xcc, spill_fixup_mna;                  \
267         b,a,pt  %xcc, spill_fixup;
268 
269 #define SPILL_1_NORMAL SPILL_1_GENERIC(ASI_AIUP)
270 #define SPILL_2_NORMAL SPILL_2_GENERIC(ASI_AIUP)
271 #define SPILL_3_NORMAL SPILL_0_NORMAL
272 #define SPILL_4_NORMAL SPILL_0_NORMAL
273 #define SPILL_5_NORMAL SPILL_0_NORMAL
274 #define SPILL_6_NORMAL SPILL_0_NORMAL
275 #define SPILL_7_NORMAL SPILL_0_NORMAL
276 
277 #define SPILL_0_OTHER SPILL_0_NORMAL
278 #define SPILL_1_OTHER SPILL_1_GENERIC(ASI_AIUS)
279 #define SPILL_2_OTHER SPILL_2_GENERIC(ASI_AIUS)
280 #define SPILL_3_OTHER SPILL_3_NORMAL
281 #define SPILL_4_OTHER SPILL_4_NORMAL
282 #define SPILL_5_OTHER SPILL_5_NORMAL
283 #define SPILL_6_OTHER SPILL_6_NORMAL
284 #define SPILL_7_OTHER SPILL_7_NORMAL
285 
286 /* Normal kernel fill */
287 #define FILL_0_NORMAL                                   \
288         ldx     [%sp + STACK_BIAS + 0x00], %l0;         \
289         ldx     [%sp + STACK_BIAS + 0x08], %l1;         \
290         ldx     [%sp + STACK_BIAS + 0x10], %l2;         \
291         ldx     [%sp + STACK_BIAS + 0x18], %l3;         \
292         ldx     [%sp + STACK_BIAS + 0x20], %l4;         \
293         ldx     [%sp + STACK_BIAS + 0x28], %l5;         \
294         ldx     [%sp + STACK_BIAS + 0x30], %l6;         \
295         ldx     [%sp + STACK_BIAS + 0x38], %l7;         \
296         ldx     [%sp + STACK_BIAS + 0x40], %i0;         \
297         ldx     [%sp + STACK_BIAS + 0x48], %i1;         \
298         ldx     [%sp + STACK_BIAS + 0x50], %i2;         \
299         ldx     [%sp + STACK_BIAS + 0x58], %i3;         \
300         ldx     [%sp + STACK_BIAS + 0x60], %i4;         \
301         ldx     [%sp + STACK_BIAS + 0x68], %i5;         \
302         ldx     [%sp + STACK_BIAS + 0x70], %i6;         \
303         ldx     [%sp + STACK_BIAS + 0x78], %i7;         \
304         restored; retry; nop; nop; nop; nop; nop; nop;  \
305         nop; nop; nop; nop; nop; nop; nop; nop;
306 
307 /* Normal 64bit fill */
308 #define FILL_1_GENERIC(ASI)                             \
309         add     %sp, STACK_BIAS + 0x00, %g1;            \
310         ldxa    [%g1 + %g0] ASI, %l0;                   \
311         mov     0x08, %g2;                              \
312         mov     0x10, %g3;                              \
313         ldxa    [%g1 + %g2] ASI, %l1;                   \
314         mov     0x18, %g5;                              \
315         ldxa    [%g1 + %g3] ASI, %l2;                   \
316         ldxa    [%g1 + %g5] ASI, %l3;                   \
317         add     %g1, 0x20, %g1;                         \
318         ldxa    [%g1 + %g0] ASI, %l4;                   \
319         ldxa    [%g1 + %g2] ASI, %l5;                   \
320         ldxa    [%g1 + %g3] ASI, %l6;                   \
321         ldxa    [%g1 + %g5] ASI, %l7;                   \
322         add     %g1, 0x20, %g1;                         \
323         ldxa    [%g1 + %g0] ASI, %i0;                   \
324         ldxa    [%g1 + %g2] ASI, %i1;                   \
325         ldxa    [%g1 + %g3] ASI, %i2;                   \
326         ldxa    [%g1 + %g5] ASI, %i3;                   \
327         add     %g1, 0x20, %g1;                         \
328         ldxa    [%g1 + %g0] ASI, %i4;                   \
329         ldxa    [%g1 + %g2] ASI, %i5;                   \
330         ldxa    [%g1 + %g3] ASI, %i6;                   \
331         ldxa    [%g1 + %g5] ASI, %i7;                   \
332         restored;                                       \
333         retry; nop; nop; nop; nop;                      \
334         b,a,pt  %xcc, fill_fixup_dax;                   \
335         b,a,pt  %xcc, fill_fixup_mna;                   \
336         b,a,pt  %xcc, fill_fixup;
337 
338 /* Normal 32bit fill */
339 #define FILL_2_GENERIC(ASI)                             \
340         srl     %sp, 0, %sp;                            \
341         lduwa   [%sp + %g0] ASI, %l0;                   \
342         mov     0x04, %g2;                              \
343         mov     0x08, %g3;                              \
344         lduwa   [%sp + %g2] ASI, %l1;                   \
345         mov     0x0c, %g5;                              \
346         lduwa   [%sp + %g3] ASI, %l2;                   \
347         lduwa   [%sp + %g5] ASI, %l3;                   \
348         add     %sp, 0x10, %g1;                         \
349         lduwa   [%g1 + %g0] ASI, %l4;                   \
350         lduwa   [%g1 + %g2] ASI, %l5;                   \
351         lduwa   [%g1 + %g3] ASI, %l6;                   \
352         lduwa   [%g1 + %g5] ASI, %l7;                   \
353         add     %g1, 0x10, %g1;                         \
354         lduwa   [%g1 + %g0] ASI, %i0;                   \
355         lduwa   [%g1 + %g2] ASI, %i1;                   \
356         lduwa   [%g1 + %g3] ASI, %i2;                   \
357         lduwa   [%g1 + %g5] ASI, %i3;                   \
358         add     %g1, 0x10, %g1;                         \
359         lduwa   [%g1 + %g0] ASI, %i4;                   \
360         lduwa   [%g1 + %g2] ASI, %i5;                   \
361         lduwa   [%g1 + %g3] ASI, %i6;                   \
362         lduwa   [%g1 + %g5] ASI, %i7;                   \
363         restored;                                       \
364         retry; nop; nop; nop; nop;                      \
365         b,a,pt  %xcc, fill_fixup_dax;                   \
366         b,a,pt  %xcc, fill_fixup_mna;                   \
367         b,a,pt  %xcc, fill_fixup;
368 
369 #define FILL_1_NORMAL FILL_1_GENERIC(ASI_AIUP)
370 #define FILL_2_NORMAL FILL_2_GENERIC(ASI_AIUP)
371 #define FILL_3_NORMAL FILL_0_NORMAL
372 #define FILL_4_NORMAL FILL_0_NORMAL
373 #define FILL_5_NORMAL FILL_0_NORMAL
374 #define FILL_6_NORMAL FILL_0_NORMAL
375 #define FILL_7_NORMAL FILL_0_NORMAL
376 
377 #define FILL_0_OTHER FILL_0_NORMAL
378 #define FILL_1_OTHER FILL_1_GENERIC(ASI_AIUS)
379 #define FILL_2_OTHER FILL_2_GENERIC(ASI_AIUS)
380 #define FILL_3_OTHER FILL_3_NORMAL
381 #define FILL_4_OTHER FILL_4_NORMAL
382 #define FILL_5_OTHER FILL_5_NORMAL
383 #define FILL_6_OTHER FILL_6_NORMAL
384 #define FILL_7_OTHER FILL_7_NORMAL
385 
386 #endif /* !(_SPARC64_TTABLE_H) */
387 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.